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 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 8 | #include "Sample.h" |
Ben Wagner | cb3d49c | 2018-03-14 15:07:43 -0400 | [diff] [blame] | 9 | #include "SkBlendMode.h" |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 10 | #include "SkCanvas.h" |
Mike Reed | ebfce6d | 2016-12-12 10:02:12 -0500 | [diff] [blame] | 11 | #include "SkClipOpPriv.h" |
Ben Wagner | cb3d49c | 2018-03-14 15:07:43 -0400 | [diff] [blame] | 12 | #include "SkColor.h" |
| 13 | #include "SkImageInfo.h" |
| 14 | #include "SkMatrix.h" |
| 15 | #include "SkPaint.h" |
| 16 | #include "SkPath.h" |
| 17 | #include "SkPoint.h" |
| 18 | #include "SkPointPriv.h" |
| 19 | #include "SkRect.h" |
| 20 | #include "SkRefCnt.h" |
| 21 | #include "SkScalar.h" |
| 22 | #include "SkShader.h" |
| 23 | #include "SkString.h" |
| 24 | #include "SkSurface.h" |
| 25 | #include "SkTypes.h" |
Ben Wagner | cb3d49c | 2018-03-14 15:07:43 -0400 | [diff] [blame] | 26 | #include "sk_tool_utils.h" |
| 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 | |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 62 | fClipRect.set(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@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 105 | fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom)); |
| 106 | fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); |
| 107 | fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 108 | fShader0 = sk_tool_utils::create_checkerboard_shader(0xFFDDDDDD, 0xFFFFFFFF, zoom); |
| 109 | fShader1 = SkShader::MakeColorShader(SK_ColorWHITE); |
| 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; |
| 300 | r.set(pts, 2); |
| 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); |
| 314 | r.set(pts, 2); |
| 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: |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 367 | IndexClick(Sample* v, int index) : Sample::Click(v), 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: |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 394 | bool onQuery(Sample::Event* evt) override { |
| 395 | if (Sample::TitleQ(*evt)) { |
| 396 | Sample::TitleR(evt, "FatBits"); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 397 | return true; |
| 398 | } |
| 399 | SkUnichar uni; |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 400 | if (Sample::CharQ(*evt, &uni)) { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 401 | switch (uni) { |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 402 | case 'c': |
| 403 | fFB.setUseClip(!fFB.getUseClip()); |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 404 | return true; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 405 | case 'r': |
| 406 | fIsRect = !fIsRect; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 407 | return true; |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 408 | case 'o': |
| 409 | fFB.toggleRectAsOval(); |
mike@reedtribe.org | 64494e9 | 2013-03-06 02:18:33 +0000 | [diff] [blame] | 410 | return true; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 411 | case 'x': |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 412 | fFB.setGrid(!fFB.getGrid()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 413 | return true; |
| 414 | case 's': |
| 415 | if (FatBits::kStroke_Style == fFB.getStyle()) { |
| 416 | this->setStyle(FatBits::kHair_Style); |
| 417 | } else { |
| 418 | this->setStyle(FatBits::kStroke_Style); |
| 419 | } |
| 420 | return true; |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 421 | case 'k': { |
| 422 | const SkPaint::Cap caps[] = { |
| 423 | SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap, |
| 424 | }; |
| 425 | fFB.fStrokeCap = caps[(fFB.fStrokeCap + 1) % 3]; |
reed | a5d1207 | 2015-11-16 18:57:18 -0800 | [diff] [blame] | 426 | return true; |
| 427 | } break; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 428 | case 'a': |
| 429 | fFB.setAA(!fFB.getAA()); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 430 | return true; |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 431 | case 'w': |
| 432 | fFB.setShowSkeleton(!fFB.getShowSkeleton()); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 433 | return true; |
| 434 | case 'g': |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 435 | fFB.togglePixelColors(); |
reed@google.com | c83e352 | 2012-10-22 22:00:08 +0000 | [diff] [blame] | 436 | return true; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 437 | case 't': |
| 438 | fFB.setTriangle(!fFB.getTriangle()); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 439 | return true; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 440 | case '-': |
| 441 | fFB.fStrokeWidth -= 0.125f; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 442 | return true; |
| 443 | case '=': |
| 444 | fFB.fStrokeWidth += 0.125f; |
Mike Reed | ce54bce | 2017-11-01 21:17:11 -0400 | [diff] [blame] | 445 | return true; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 446 | } |
| 447 | } |
| 448 | return this->INHERITED::onQuery(evt); |
| 449 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 450 | |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 451 | void onDrawContent(SkCanvas* canvas) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 452 | fFB.drawBG(canvas); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 453 | if (fFB.getTriangle()) { |
| 454 | fFB.drawTriangle(canvas, fPts); |
| 455 | } |
| 456 | else if (fIsRect) { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 457 | fFB.drawRect(canvas, fPts); |
| 458 | } else { |
| 459 | fFB.drawLine(canvas, fPts); |
| 460 | } |
| 461 | fFB.drawFG(canvas); |
skia.committer@gmail.com | 1e34ff7 | 2012-10-24 02:01:24 +0000 | [diff] [blame] | 462 | |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 463 | { |
| 464 | SkString str; |
reed | 8716a8a | 2016-09-19 07:10:36 -0700 | [diff] [blame] | 465 | str.printf("%s %s %s", |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 466 | fFB.getAA() ? "AA" : "BW", |
| 467 | FatBits::kHair_Style == fFB.getStyle() ? "Hair" : "Stroke", |
reed@google.com | 9c0bef1 | 2012-11-02 19:59:18 +0000 | [diff] [blame] | 468 | fFB.getUseClip() ? "clip" : "noclip"); |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 469 | SkPaint paint; |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 470 | paint.setColor(SK_ColorBLUE); |
Hal Canary | 4484b8f | 2019-01-08 14:00:08 -0500 | [diff] [blame] | 471 | SkFont font(nullptr, 16); |
| 472 | canvas->drawString(str, 10, 16, font, paint); |
reed@google.com | ffe9d01 | 2012-10-23 15:33:41 +0000 | [diff] [blame] | 473 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 474 | } |
| 475 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 476 | Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 477 | SkPoint pt = { x, y }; |
| 478 | int index = -1; |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 479 | int count = fFB.getTriangle() ? 3 : 2; |
reed@google.com | cdbcb3e | 2012-10-22 22:10:20 +0000 | [diff] [blame] | 480 | SkScalar tol = 12; |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 481 | |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 482 | for (int i = 0; i < count; ++i) { |
Cary Clark | df429f3 | 2017-11-08 11:44:31 -0500 | [diff] [blame] | 483 | if (SkPointPriv::EqualsWithinTolerance(fPts[i], pt, tol)) { |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 484 | index = i; |
| 485 | break; |
| 486 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 487 | } |
mike@reedtribe.org | c892a15 | 2012-10-23 03:10:46 +0000 | [diff] [blame] | 488 | return new IndexClick(this, index); |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 489 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 490 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 491 | bool onClick(Click* click) override { |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 492 | int index = IndexClick::GetIndex(click); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 493 | if (index >= 0 && index <= 2) { |
mike@reedtribe.org | c892a15 | 2012-10-23 03:10:46 +0000 | [diff] [blame] | 494 | fPts[index] = click->fCurr; |
| 495 | } else { |
| 496 | SkScalar dx = click->fCurr.fX - click->fPrev.fX; |
| 497 | SkScalar dy = click->fCurr.fY - click->fPrev.fY; |
| 498 | fPts[0].offset(dx, dy); |
| 499 | fPts[1].offset(dx, dy); |
reed@google.com | bbe66f0 | 2013-10-30 13:41:19 +0000 | [diff] [blame] | 500 | fPts[2].offset(dx, dy); |
mike@reedtribe.org | c892a15 | 2012-10-23 03:10:46 +0000 | [diff] [blame] | 501 | } |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 502 | return true; |
| 503 | } |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 504 | |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 505 | private: |
skia.committer@gmail.com | 45ba2f7 | 2012-10-23 02:01:22 +0000 | [diff] [blame] | 506 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 507 | typedef Sample INHERITED; |
mike@reedtribe.org | 50e4c72 | 2012-10-22 03:59:34 +0000 | [diff] [blame] | 508 | }; |
| 509 | |
| 510 | ////////////////////////////////////////////////////////////////////////////// |
| 511 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 512 | DEF_SAMPLE( return new DrawLineView(); ) |