mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/core/SkBlendMode.h" |
| 9 | #include "include/core/SkCanvas.h" |
| 10 | #include "include/core/SkColor.h" |
| 11 | #include "include/core/SkImageInfo.h" |
| 12 | #include "include/core/SkMatrix.h" |
| 13 | #include "include/core/SkPaint.h" |
| 14 | #include "include/core/SkPath.h" |
| 15 | #include "include/core/SkPoint.h" |
| 16 | #include "include/core/SkRect.h" |
| 17 | #include "include/core/SkRefCnt.h" |
| 18 | #include "include/core/SkScalar.h" |
| 19 | #include "include/core/SkShader.h" |
| 20 | #include "include/core/SkString.h" |
| 21 | #include "include/core/SkSurface.h" |
| 22 | #include "include/core/SkTypes.h" |
| 23 | #include "samplecode/Sample.h" |
| 24 | #include "src/core/SkClipOpPriv.h" |
| 25 | #include "src/core/SkPointPriv.h" |
| 26 | #include "tools/ToolUtils.h" |
Ben Wagner | cb3d49c | 2018-03-14 15:07:43 -0400 | [diff] [blame] | 27 | |
| 28 | class SkEvent; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 29 | |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 30 | #define FAT_PIXEL_COLOR SK_ColorBLACK |
| 31 | #define PIXEL_CENTER_SIZE 3 |
| 32 | #define WIRE_FRAME_COLOR 0xFFFF0000 /*0xFF00FFFF*/ |
| 33 | #define WIRE_FRAME_SIZE 1.5f |
| 34 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 35 | static SkScalar apply_grid(SkScalar x) { |
| 36 | const SkScalar grid = 2; |
| 37 | return SkScalarRoundToScalar(x * grid) / grid; |
| 38 | } |
| 39 | |
| 40 | static void apply_grid(SkPoint pts[], int count) { |
| 41 | for (int i = 0; i < count; ++i) { |
| 42 | pts[i].set(apply_grid(pts[i].fX), apply_grid(pts[i].fY)); |
| 43 | } |
| 44 | } |
| 45 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 46 | static void erase(SkSurface* surface) { |
junov@google.com | dbfac8a | 2012-12-06 21:47:40 +0000 | [diff] [blame] | 47 | surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 48 | } |
| 49 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 50 | class FatBits { |
| 51 | public: |
commit-bot@chromium.org | 5970f62 | 2014-05-12 20:42:21 +0000 | [diff] [blame] | 52 | FatBits() { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 53 | fAA = false; |
| 54 | fStyle = kHair_Style; |
reed | bb88674 | 2015-08-15 07:42:31 -0700 | [diff] [blame] | 55 | fGrid = false; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 56 | fShowSkeleton = true; |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 57 | fUseClip = false; |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 58 | fRectAsOval = false; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 59 | fUseTriangle = false; |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 60 | fStrokeCap = SkPaint::kButt_Cap; |
skia.committer@gmail.com | 1aa90cf | 2012-11-06 13:18:25 +0000 | [diff] [blame] | 61 | |
Mike Reed | 92b3335 | 2019-08-24 19:39:13 -0400 | [diff] [blame] | 62 | fClipRect.setLTRB(2, 2, 11, 8 ); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 63 | } |
| 64 | |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 65 | int getZoom() const { return fZoom; } |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 66 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 67 | bool getAA() const { return fAA; } |
| 68 | void setAA(bool aa) { fAA = aa; } |
| 69 | |
| 70 | bool getGrid() const { return fGrid; } |
| 71 | void setGrid(bool g) { fGrid = g; } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 72 | |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 73 | bool getShowSkeleton() const { return fShowSkeleton; } |
| 74 | void setShowSkeleton(bool ss) { fShowSkeleton = ss; } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 75 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 76 | bool getTriangle() const { return fUseTriangle; } |
| 77 | void setTriangle(bool ut) { fUseTriangle = ut; } |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 78 | |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 79 | void toggleRectAsOval() { fRectAsOval = !fRectAsOval; } |
| 80 | |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 81 | void togglePixelColors() { |
| 82 | if (fShader == fShader0) { |
| 83 | fShader = fShader1; |
| 84 | } else { |
| 85 | fShader = fShader0; |
| 86 | } |
| 87 | } |
| 88 | |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 89 | float fStrokeWidth = 1; |
| 90 | |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 91 | bool getUseClip() const { return fUseClip; } |
| 92 | void setUseClip(bool uc) { fUseClip = uc; } |
| 93 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 94 | enum Style { |
| 95 | kHair_Style, |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 96 | kStroke_Style, |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 97 | }; |
| 98 | Style getStyle() const { return fStyle; } |
| 99 | void setStyle(Style s) { fStyle = s; } |
| 100 | |
| 101 | void setWHZ(int width, int height, int zoom) { |
| 102 | fW = width; |
| 103 | fH = height; |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 104 | fZoom = zoom; |
Mike Reed | 92b3335 | 2019-08-24 19:39:13 -0400 | [diff] [blame] | 105 | fBounds.setIWH(width * zoom, height * zoom); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 106 | fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); |
| 107 | fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 108 | fShader0 = ToolUtils::create_checkerboard_shader(0xFFDDDDDD, 0xFFFFFFFF, zoom); |
Mike Reed | c8bea7d | 2019-04-09 13:55:36 -0400 | [diff] [blame] | 109 | fShader1 = SkShaders::Color(SK_ColorWHITE); |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 110 | fShader = fShader0; |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 111 | |
commit-bot@chromium.org | 32678d9 | 2014-01-15 02:38:22 +0000 | [diff] [blame] | 112 | SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 113 | fMinSurface = SkSurface::MakeRaster(info); |
reed | e5ea500 | 2014-09-03 11:54:58 -0700 | [diff] [blame] | 114 | info = info.makeWH(width * zoom, height * zoom); |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 115 | fMaxSurface = SkSurface::MakeRaster(info); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | void drawBG(SkCanvas*); |
| 119 | void drawFG(SkCanvas*); |
| 120 | void drawLine(SkCanvas*, SkPoint pts[2]); |
| 121 | void drawRect(SkCanvas* canvas, SkPoint pts[2]); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 122 | void drawTriangle(SkCanvas* canvas, SkPoint pts[3]); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 123 | |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 124 | SkPaint::Cap fStrokeCap; |
| 125 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 126 | private: |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 127 | bool fAA, fGrid, fShowSkeleton, fUseClip, fRectAsOval, fUseTriangle; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 128 | Style fStyle; |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 129 | int fW, fH, fZoom; |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 130 | SkMatrix fMatrix, fInverse; |
| 131 | SkRect fBounds, fClipRect; |
| 132 | sk_sp<SkShader> fShader0; |
| 133 | sk_sp<SkShader> fShader1; |
| 134 | sk_sp<SkShader> fShader; |
| 135 | sk_sp<SkSurface> fMinSurface; |
| 136 | sk_sp<SkSurface> fMaxSurface; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 137 | |
| 138 | void setupPaint(SkPaint* paint) { |
| 139 | bool aa = this->getAA(); |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 140 | paint->setStrokeCap(fStrokeCap); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 141 | switch (fStyle) { |
| 142 | case kHair_Style: |
| 143 | paint->setStrokeWidth(0); |
| 144 | break; |
| 145 | case kStroke_Style: |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 146 | paint->setStrokeWidth(fStrokeWidth); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 147 | break; |
| 148 | } |
| 149 | paint->setAntiAlias(aa); |
| 150 | } |
| 151 | |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 152 | void setupSkeletonPaint(SkPaint* paint) { |
| 153 | paint->setStyle(SkPaint::kStroke_Style); |
| 154 | paint->setStrokeWidth(WIRE_FRAME_SIZE); |
| 155 | paint->setColor(fShowSkeleton ? WIRE_FRAME_COLOR : 0); |
| 156 | paint->setAntiAlias(true); |
| 157 | } |
| 158 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 159 | void drawTriangleSkeleton(SkCanvas* max, const SkPoint pts[]); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 160 | void drawLineSkeleton(SkCanvas* max, const SkPoint pts[]); |
| 161 | void drawRectSkeleton(SkCanvas* max, const SkRect& r) { |
| 162 | SkPaint paint; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 163 | this->setupSkeletonPaint(&paint); |
| 164 | SkPath path; |
| 165 | |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 166 | fRectAsOval ? path.addOval(r) : path.addRect(r); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 167 | max->drawPath(path, paint); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 168 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 169 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 170 | void copyMinToMax() { |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 171 | erase(fMaxSurface.get()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 172 | SkCanvas* canvas = fMaxSurface->getCanvas(); |
| 173 | canvas->save(); |
| 174 | canvas->concat(fMatrix); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 175 | fMinSurface->draw(canvas, 0, 0, nullptr); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 176 | canvas->restore(); |
| 177 | |
| 178 | SkPaint paint; |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 179 | paint.setBlendMode(SkBlendMode::kClear); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 180 | for (int iy = 1; iy < fH; ++iy) { |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 181 | SkScalar y = SkIntToScalar(iy * fZoom); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 182 | canvas->drawLine(0, y - SK_ScalarHalf, 999, y - SK_ScalarHalf, paint); |
| 183 | } |
| 184 | for (int ix = 1; ix < fW; ++ix) { |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 185 | SkScalar x = SkIntToScalar(ix * fZoom); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 186 | canvas->drawLine(x - SK_ScalarHalf, 0, x - SK_ScalarHalf, 999, paint); |
| 187 | } |
| 188 | } |
| 189 | }; |
| 190 | |
| 191 | void FatBits::drawBG(SkCanvas* canvas) { |
| 192 | SkPaint paint; |
| 193 | |
| 194 | paint.setShader(fShader); |
| 195 | canvas->drawRect(fBounds, paint); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 196 | paint.setShader(nullptr); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | void FatBits::drawFG(SkCanvas* canvas) { |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 200 | SkPaint inner, outer; |
| 201 | |
| 202 | inner.setAntiAlias(true); |
| 203 | inner.setColor(SK_ColorBLACK); |
| 204 | inner.setStrokeWidth(PIXEL_CENTER_SIZE); |
| 205 | |
| 206 | outer.setAntiAlias(true); |
| 207 | outer.setColor(SK_ColorWHITE); |
| 208 | outer.setStrokeWidth(PIXEL_CENTER_SIZE + 2); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 209 | |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 210 | SkScalar half = SkIntToScalar(fZoom) / 2; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 211 | for (int iy = 0; iy < fH; ++iy) { |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 212 | SkScalar y = SkIntToScalar(iy * fZoom) + half; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 213 | for (int ix = 0; ix < fW; ++ix) { |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 214 | SkScalar x = SkIntToScalar(ix * fZoom) + half; |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 215 | |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 216 | canvas->drawPoint(x, y, outer); |
| 217 | canvas->drawPoint(x, y, inner); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 218 | } |
| 219 | } |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 220 | |
| 221 | if (fUseClip) { |
| 222 | SkPaint p; |
| 223 | p.setStyle(SkPaint::kStroke_Style); |
| 224 | p.setColor(SK_ColorLTGRAY); |
| 225 | SkRect r = { |
robertphillips@google.com | ca47aae | 2012-12-12 15:58:25 +0000 | [diff] [blame] | 226 | fClipRect.fLeft * fZoom, |
| 227 | fClipRect.fTop * fZoom, |
| 228 | fClipRect.fRight * fZoom, |
| 229 | fClipRect.fBottom * fZoom |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 230 | }; |
| 231 | canvas->drawRect(r, p); |
| 232 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | void FatBits::drawLineSkeleton(SkCanvas* max, const SkPoint pts[]) { |
| 236 | SkPaint paint; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 237 | this->setupSkeletonPaint(&paint); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 238 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 239 | SkPath path; |
| 240 | path.moveTo(pts[0]); |
| 241 | path.lineTo(pts[1]); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 242 | |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 243 | if (fStyle == kStroke_Style) { |
| 244 | SkPaint p; |
| 245 | p.setStyle(SkPaint::kStroke_Style); |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 246 | p.setStrokeWidth(fStrokeWidth * fZoom); |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 247 | p.setStrokeCap(fStrokeCap); |
| 248 | SkPath dst; |
| 249 | p.getFillPath(path, &dst); |
| 250 | path = dst; |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 251 | |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 252 | path.moveTo(pts[0]); |
| 253 | path.lineTo(pts[1]); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 254 | } |
| 255 | max->drawPath(path, paint); |
| 256 | } |
| 257 | |
| 258 | void FatBits::drawLine(SkCanvas* canvas, SkPoint pts[]) { |
| 259 | SkPaint paint; |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 260 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 261 | fInverse.mapPoints(pts, 2); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 262 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 263 | if (fGrid) { |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 264 | apply_grid(pts, 2); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 265 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 266 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 267 | erase(fMinSurface.get()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 268 | this->setupPaint(&paint); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 269 | paint.setColor(FAT_PIXEL_COLOR); |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 270 | if (fUseClip) { |
| 271 | fMinSurface->getCanvas()->save(); |
| 272 | SkRect r = fClipRect; |
| 273 | r.inset(SK_Scalar1/3, SK_Scalar1/3); |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 274 | fMinSurface->getCanvas()->clipRect(r, kIntersect_SkClipOp, true); |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 275 | } |
Hal Canary | 23e474c | 2017-05-15 13:35:35 -0400 | [diff] [blame] | 276 | fMinSurface->getCanvas()->drawLine(pts[0], pts[1], paint); |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 277 | if (fUseClip) { |
| 278 | fMinSurface->getCanvas()->restore(); |
| 279 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 280 | this->copyMinToMax(); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 281 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 282 | SkCanvas* max = fMaxSurface->getCanvas(); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 283 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 284 | fMatrix.mapPoints(pts, 2); |
| 285 | this->drawLineSkeleton(max, pts); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 286 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 287 | fMaxSurface->draw(canvas, 0, 0, nullptr); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | void FatBits::drawRect(SkCanvas* canvas, SkPoint pts[2]) { |
| 291 | SkPaint paint; |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 292 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 293 | fInverse.mapPoints(pts, 2); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 294 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 295 | if (fGrid) { |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 296 | apply_grid(pts, 2); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 297 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 298 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 299 | SkRect r; |
Mike Reed | 92b3335 | 2019-08-24 19:39:13 -0400 | [diff] [blame] | 300 | r.setBounds(pts, 2); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 301 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 302 | erase(fMinSurface.get()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 303 | this->setupPaint(&paint); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 304 | paint.setColor(FAT_PIXEL_COLOR); |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 305 | { |
| 306 | SkCanvas* c = fMinSurface->getCanvas(); |
| 307 | fRectAsOval ? c->drawOval(r, paint) : c->drawRect(r, paint); |
| 308 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 309 | this->copyMinToMax(); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 310 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 311 | SkCanvas* max = fMaxSurface->getCanvas(); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 312 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 313 | fMatrix.mapPoints(pts, 2); |
Mike Reed | 92b3335 | 2019-08-24 19:39:13 -0400 | [diff] [blame] | 314 | r.setBounds(pts, 2); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 315 | this->drawRectSkeleton(max, r); |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 316 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 317 | fMaxSurface->draw(canvas, 0, 0, nullptr); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 318 | } |
| 319 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 320 | void FatBits::drawTriangleSkeleton(SkCanvas* max, const SkPoint pts[]) { |
| 321 | SkPaint paint; |
| 322 | this->setupSkeletonPaint(&paint); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 323 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 324 | SkPath path; |
| 325 | path.moveTo(pts[0]); |
| 326 | path.lineTo(pts[1]); |
| 327 | path.lineTo(pts[2]); |
| 328 | path.close(); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 329 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 330 | max->drawPath(path, paint); |
| 331 | } |
| 332 | |
| 333 | void FatBits::drawTriangle(SkCanvas* canvas, SkPoint pts[3]) { |
| 334 | SkPaint paint; |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 335 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 336 | fInverse.mapPoints(pts, 3); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 337 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 338 | if (fGrid) { |
| 339 | apply_grid(pts, 3); |
| 340 | } |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 341 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 342 | SkPath path; |
| 343 | path.moveTo(pts[0]); |
| 344 | path.lineTo(pts[1]); |
| 345 | path.lineTo(pts[2]); |
| 346 | path.close(); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 347 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 348 | erase(fMinSurface.get()); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 349 | this->setupPaint(&paint); |
| 350 | paint.setColor(FAT_PIXEL_COLOR); |
| 351 | fMinSurface->getCanvas()->drawPath(path, paint); |
| 352 | this->copyMinToMax(); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 353 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 354 | SkCanvas* max = fMaxSurface->getCanvas(); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 355 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 356 | fMatrix.mapPoints(pts, 3); |
| 357 | this->drawTriangleSkeleton(max, pts); |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 358 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 359 | fMaxSurface->draw(canvas, 0, 0, nullptr); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 360 | } |
| 361 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 362 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 363 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 364 | class IndexClick : public Sample::Click { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 365 | int fIndex; |
| 366 | public: |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 367 | IndexClick(int index) : fIndex(index) {} |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 368 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 369 | static int GetIndex(Sample::Click* click) { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 370 | return ((IndexClick*)click)->fIndex; |
| 371 | } |
| 372 | }; |
| 373 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 374 | class DrawLineView : public Sample { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 375 | FatBits fFB; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 376 | SkPoint fPts[3]; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 377 | bool fIsRect; |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 378 | int fZoom = 64; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 379 | public: |
| 380 | DrawLineView() { |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 381 | fFB.setWHZ(24*2, 16*2, fZoom); |
reed | bb88674 | 2015-08-15 07:42:31 -0700 | [diff] [blame] | 382 | fPts[0].set(1, 1); |
| 383 | fPts[1].set(5, 4); |
| 384 | fPts[2].set(2, 6); |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 385 | SkMatrix::MakeScale(SkIntToScalar(fZoom)).mapPoints(fPts, 3); |
reed@google.com | cdbcb3e | 2012-10-22 22:10:20 +0000 | [diff] [blame] | 386 | fIsRect = false; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 387 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 388 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 389 | void setStyle(FatBits::Style s) { |
| 390 | fFB.setStyle(s); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | protected: |
Hal Canary | 8a02731 | 2019-07-03 10:55:44 -0400 | [diff] [blame] | 394 | SkString name() override { return SkString("FatBits"); } |
| 395 | |
Hal Canary | 6cc65e1 | 2019-07-03 15:53:04 -0400 | [diff] [blame] | 396 | bool onChar(SkUnichar uni) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 397 | switch (uni) { |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 398 | case 'c': |
| 399 | fFB.setUseClip(!fFB.getUseClip()); |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 400 | return true; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 401 | case 'r': |
| 402 | fIsRect = !fIsRect; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 403 | return true; |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 404 | case 'o': |
| 405 | fFB.toggleRectAsOval(); |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 406 | return true; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 407 | case 'x': |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 408 | fFB.setGrid(!fFB.getGrid()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 409 | return true; |
| 410 | case 's': |
| 411 | if (FatBits::kStroke_Style == fFB.getStyle()) { |
| 412 | this->setStyle(FatBits::kHair_Style); |
| 413 | } else { |
| 414 | this->setStyle(FatBits::kStroke_Style); |
| 415 | } |
| 416 | return true; |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 417 | case 'k': { |
| 418 | const SkPaint::Cap caps[] = { |
| 419 | SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap, |
| 420 | }; |
| 421 | fFB.fStrokeCap = caps[(fFB.fStrokeCap + 1) % 3]; |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 422 | return true; |
| 423 | } break; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 424 | case 'a': |
| 425 | fFB.setAA(!fFB.getAA()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 426 | return true; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 427 | case 'w': |
| 428 | fFB.setShowSkeleton(!fFB.getShowSkeleton()); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 429 | return true; |
| 430 | case 'g': |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 431 | fFB.togglePixelColors(); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 432 | return true; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 433 | case 't': |
| 434 | fFB.setTriangle(!fFB.getTriangle()); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 435 | return true; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 436 | case '-': |
| 437 | fFB.fStrokeWidth -= 0.125f; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 438 | return true; |
| 439 | case '=': |
| 440 | fFB.fStrokeWidth += 0.125f; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 441 | return true; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 442 | } |
Hal Canary | 6cc65e1 | 2019-07-03 15:53:04 -0400 | [diff] [blame] | 443 | return false; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 444 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 445 | |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 446 | void onDrawContent(SkCanvas* canvas) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 447 | fFB.drawBG(canvas); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 448 | if (fFB.getTriangle()) { |
| 449 | fFB.drawTriangle(canvas, fPts); |
| 450 | } |
| 451 | else if (fIsRect) { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 452 | fFB.drawRect(canvas, fPts); |
| 453 | } else { |
| 454 | fFB.drawLine(canvas, fPts); |
| 455 | } |
| 456 | fFB.drawFG(canvas); |
skia.committer@gmail.com | 1e34ff7 | 2012-10-24 02:01:24 +0000 | [diff] [blame] | 457 | |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 458 | { |
| 459 | SkString str; |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 460 | str.printf("%s %s %s", |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 461 | fFB.getAA() ? "AA" : "BW", |
| 462 | FatBits::kHair_Style == fFB.getStyle() ? "Hair" : "Stroke", |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 463 | fFB.getUseClip() ? "clip" : "noclip"); |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 464 | SkPaint paint; |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 465 | paint.setColor(SK_ColorBLUE); |
Hal Canary | 4484b8f | 2019-01-08 14:00:08 -0500 | [diff] [blame] | 466 | SkFont font(nullptr, 16); |
| 467 | canvas->drawString(str, 10, 16, font, paint); |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 468 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 469 | } |
| 470 | |
Hal Canary | b1f411a | 2019-08-29 10:39:22 -0400 | [diff] [blame] | 471 | Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 472 | SkPoint pt = { x, y }; |
| 473 | int index = -1; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 474 | int count = fFB.getTriangle() ? 3 : 2; |
reed@google.com | cdbcb3e | 2012-10-22 22:10:20 +0000 | [diff] [blame] | 475 | SkScalar tol = 12; |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 476 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 477 | for (int i = 0; i < count; ++i) { |
Cary Clark | df429f3 | 2017-11-08 11:44:31 -0500 | [diff] [blame] | 478 | if (SkPointPriv::EqualsWithinTolerance(fPts[i], pt, tol)) { |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 479 | index = i; |
| 480 | break; |
| 481 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 482 | } |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 483 | return new IndexClick(index); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 484 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 485 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 486 | bool onClick(Click* click) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 487 | int index = IndexClick::GetIndex(click); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 488 | if (index >= 0 && index <= 2) { |
mike@reedtribe.org | c892a15 | 2012-10-23 03:10:46 +0000 | [diff] [blame] | 489 | fPts[index] = click->fCurr; |
| 490 | } else { |
| 491 | SkScalar dx = click->fCurr.fX - click->fPrev.fX; |
| 492 | SkScalar dy = click->fCurr.fY - click->fPrev.fY; |
| 493 | fPts[0].offset(dx, dy); |
| 494 | fPts[1].offset(dx, dy); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 495 | fPts[2].offset(dx, dy); |
mike@reedtribe.org | c892a15 | 2012-10-23 03:10:46 +0000 | [diff] [blame] | 496 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 497 | return true; |
| 498 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 499 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 500 | private: |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 501 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 502 | typedef Sample INHERITED; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 503 | }; |
| 504 | |
| 505 | ////////////////////////////////////////////////////////////////////////////// |
| 506 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 507 | DEF_SAMPLE( return new DrawLineView(); ) |