blob: e7bba1a6f9e573351ac5d8d3809ac4b9591ecefc [file] [log] [blame]
reed@google.com63d73742012-01-10 15:33:12 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
9#include "include/core/SkCanvas.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040010#include "include/core/SkColor.h"
11#include "include/core/SkFont.h"
12#include "include/core/SkFontStyle.h"
13#include "include/core/SkPaint.h"
14#include "include/core/SkPath.h"
15#include "include/core/SkRect.h"
16#include "include/core/SkScalar.h"
17#include "include/core/SkString.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050018#include "include/core/SkTypeface.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040019#include "include/core/SkTypes.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050020#include "src/core/SkPathPriv.h"
21#include "src/core/SkTextFormatParams.h"
22#include "tools/ToolUtils.h"
reed@google.com63d73742012-01-10 15:33:12 +000023
caryclark52b64612016-02-05 13:59:31 -080024DEF_SIMPLE_GM(bug339297, canvas, 640, 480) {
25 SkPath path;
26 path.moveTo(-469515, -10354890);
27 path.cubicTo(771919.62f, -10411179, 2013360.1f, -10243774, 3195542.8f, -9860664);
28 path.lineTo(3195550, -9860655);
29 path.lineTo(3195539, -9860652);
30 path.lineTo(3195539, -9860652);
31 path.lineTo(3195539, -9860652);
32 path.cubicTo(2013358.1f, -10243761, 771919.25f, -10411166, -469513.84f, -10354877);
33 path.lineTo(-469515, -10354890);
34 path.close();
35
36 canvas->translate(258, 10365663);
37
38 SkPaint paint;
39 paint.setAntiAlias(true);
40 paint.setColor(SK_ColorBLACK);
41 paint.setStyle(SkPaint::kFill_Style);
42 canvas->drawPath(path, paint);
43
44 paint.setColor(SK_ColorRED);
45 paint.setStyle(SkPaint::kStroke_Style);
46 paint.setStrokeWidth(1);
47 canvas->drawPath(path, paint);
48}
Stephen White2cee2832017-08-23 09:37:16 -040049
Chris Daltona32a3c32017-12-05 10:05:21 -070050DEF_SIMPLE_GM(bug339297_as_clip, canvas, 640, 480) {
51 SkPath path;
52 path.moveTo(-469515, -10354890);
53 path.cubicTo(771919.62f, -10411179, 2013360.1f, -10243774, 3195542.8f, -9860664);
54 path.lineTo(3195550, -9860655);
55 path.lineTo(3195539, -9860652);
56 path.lineTo(3195539, -9860652);
57 path.lineTo(3195539, -9860652);
58 path.cubicTo(2013358.1f, -10243761, 771919.25f, -10411166, -469513.84f, -10354877);
59 path.lineTo(-469515, -10354890);
60 path.close();
61
62 canvas->translate(258, 10365663);
63
64 canvas->save();
65 canvas->clipPath(path, true);
66 canvas->clear(SK_ColorBLACK);
67 canvas->restore();
68
69 SkPaint paint;
70 paint.setAntiAlias(true);
71 paint.setStyle(SkPaint::kFill_Style);
72 paint.setColor(SK_ColorRED);
73 paint.setStyle(SkPaint::kStroke_Style);
74 paint.setStrokeWidth(1);
75 canvas->drawPath(path, paint);
76}
77
Stephen White2cee2832017-08-23 09:37:16 -040078DEF_SIMPLE_GM(bug6987, canvas, 200, 200) {
79 SkPaint paint;
80 paint.setStyle(SkPaint::kStroke_Style);
81 paint.setStrokeWidth(0.0001f);
82 paint.setAntiAlias(true);
83 SkPath path;
84 canvas->save();
85 canvas->scale(50000.0f, 50000.0f);
86 path.moveTo(0.0005f, 0.0004f);
87 path.lineTo(0.0008f, 0.0010f);
88 path.lineTo(0.0002f, 0.0010f);
89 path.close();
90 canvas->drawPath(path, paint);
91 canvas->restore();
92}