blob: 0d6042c33ff0a599b4edf67966302ffd904b06d7 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +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 */
Hal Canary8a001442018-09-19 11:31:27 -04007
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04008#include "Sample.h"
Hal Canary8a001442018-09-19 11:31:27 -04009
10#include "DecodeFile.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000011#include "Sk1DPathEffect.h"
12#include "Sk2DPathEffect.h"
Hal Canary8a001442018-09-19 11:31:27 -040013#include "SkBlurMask.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000014#include "SkBlurMaskFilter.h"
Hal Canary8a001442018-09-19 11:31:27 -040015#include "SkCanvas.h"
reed0daf5dd2016-01-11 12:34:04 -080016#include "SkColorMatrixFilter.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000017#include "SkColorPriv.h"
18#include "SkCornerPathEffect.h"
19#include "SkDashPathEffect.h"
20#include "SkDiscretePathEffect.h"
21#include "SkEmbossMaskFilter.h"
22#include "SkGradientShader.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000023#include "SkMath.h"
24#include "SkPath.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000025#include "SkPathMeasure.h"
26#include "SkPicture.h"
Hal Canary8a001442018-09-19 11:31:27 -040027#include "SkPictureRecorder.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000028#include "SkRandom.h"
Hal Canary8a001442018-09-19 11:31:27 -040029#include "SkReadBuffer.h"
30#include "SkRegion.h"
31#include "SkShader.h"
Mike Reeda62d0362018-08-28 16:26:06 -040032#include "SkTextOnPath.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000033#include "SkTypeface.h"
Hal Canaryea60b952018-08-21 11:45:46 -040034#include "SkUTF.h"
Hal Canary8a001442018-09-19 11:31:27 -040035#include "SkWriteBuffer.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000036
37#include <math.h>
rmistry@google.comae933ce2012-08-23 18:19:56 +000038
reed@android.com8a1c16f2008-12-17 15:59:43 +000039class Dot2DPathEffect : public Sk2DPathEffect {
40public:
41 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix)
42 : Sk2DPathEffect(matrix), fRadius(radius) {}
43
djsollen@google.comba28d032012-03-26 17:57:35 +000044 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
reed@android.com8a1c16f2008-12-17 15:59:43 +000045
46protected:
mtklein36352bf2015-03-25 18:17:31 -070047 void next(const SkPoint& loc, int u, int v, SkPath* dst) const override {
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 dst->addCircle(loc.fX, loc.fY, fRadius);
49 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000050
mtklein36352bf2015-03-25 18:17:31 -070051 void flatten(SkWriteBuffer& buffer) const override {
djsollen@google.com54924242012-03-29 15:18:04 +000052 this->INHERITED::flatten(buffer);
53 buffer.writeScalar(fRadius);
54 }
55
reed@android.com8a1c16f2008-12-17 15:59:43 +000056private:
57 SkScalar fRadius;
58
reed@android.com8a1c16f2008-12-17 15:59:43 +000059 typedef Sk2DPathEffect INHERITED;
60};
61
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040062class DemoView : public Sample {
reed@android.com8a1c16f2008-12-17 15:59:43 +000063public:
reed@google.com2f3dc9d2011-05-02 17:33:45 +000064 DemoView() {}
rmistry@google.comae933ce2012-08-23 18:19:56 +000065
reed@android.com8a1c16f2008-12-17 15:59:43 +000066protected:
Ben Wagnerb2c4ea62018-08-08 11:36:17 -040067 virtual bool onQuery(Sample::Event* evt) {
68 if (Sample::TitleQ(*evt)) {
69 Sample::TitleR(evt, "Demo");
reed@android.com8a1c16f2008-12-17 15:59:43 +000070 return true;
71 }
72 return this->INHERITED::onQuery(evt);
73 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000074
mike@reedtribe.org5fd92432011-05-05 01:59:48 +000075 virtual bool onClick(Click* click) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000076 return this->INHERITED::onClick(click);
77 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000078
mike@reedtribe.org5fd92432011-05-05 01:59:48 +000079 void makePath(SkPath& path) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000080 path.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(20),
81 SkPath::kCCW_Direction);
82 for (int index = 0; index < 10; index++) {
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +000083 SkScalar x = (float) cos(index / 10.0f * 2 * 3.1415925358f);
84 SkScalar y = (float) sin(index / 10.0f * 2 * 3.1415925358f);
reed@android.com8a1c16f2008-12-17 15:59:43 +000085 x *= index & 1 ? 7 : 14;
86 y *= index & 1 ? 7 : 14;
87 x += SkIntToScalar(20);
88 y += SkIntToScalar(20);
89 if (index == 0)
90 path.moveTo(x, y);
91 else
92 path.lineTo(x, y);
93 }
94 path.close();
95 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000096
mike@reedtribe.org5fd92432011-05-05 01:59:48 +000097 virtual void onDrawContent(SkCanvas* canvas) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000098 canvas->save();
robertphillips@google.com84b18c72014-04-13 19:09:42 +000099 this->drawPicture(canvas, 0);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000100 canvas->restore();
101
102 {
robertphillips@google.com84b18c72014-04-13 19:09:42 +0000103 SkPictureRecorder recorder;
104 {
halcanary96fcdcc2015-08-27 07:41:13 -0700105 SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0);
robertphillips@google.com84b18c72014-04-13 19:09:42 +0000106 this->drawPicture(record, 120);
107 }
reedca2622b2016-03-18 07:25:55 -0700108 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
robertphillips@google.com84b18c72014-04-13 19:09:42 +0000109
reed@android.com8a1c16f2008-12-17 15:59:43 +0000110 canvas->translate(0, SkIntToScalar(120));
111
112 SkRect clip;
113 clip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160));
114 do {
115 canvas->save();
116 canvas->clipRect(clip);
robertphillipsc5ba71d2014-09-04 08:42:50 -0700117 picture->playback(canvas);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000118 canvas->restore();
119 if (clip.fRight < SkIntToScalar(320))
120 clip.offset(SkIntToScalar(160), 0);
121 else if (clip.fBottom < SkIntToScalar(480))
122 clip.offset(-SkIntToScalar(320), SkIntToScalar(160));
123 else
124 break;
125 } while (true);
126 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000127 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000128
mike@reedtribe.org5fd92432011-05-05 01:59:48 +0000129 void drawPicture(SkCanvas* canvas, int spriteOffset) {
rmistry@google.comae933ce2012-08-23 18:19:56 +0000130 SkMatrix matrix; matrix.reset();
131 SkPaint paint;
132 SkPath path;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000133 SkPoint start = {0, 0};
134 SkPoint stop = { SkIntToScalar(40), SkIntToScalar(40) };
rmistry@google.comae933ce2012-08-23 18:19:56 +0000135 SkRect rect = {0, 0, SkIntToScalar(40), SkIntToScalar(40) };
136 SkRect rect2 = {0, 0, SkIntToScalar(65), SkIntToScalar(20) };
137 SkScalar left = 0, top = 0, x = 0, y = 0;
reed@google.com7fa2a652014-01-27 13:42:58 +0000138 int index;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000139
140 char ascii[] = "ascii...";
reed@google.com7fa2a652014-01-27 13:42:58 +0000141 int asciiLength = sizeof(ascii) - 1;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000142 char utf8[] = "utf8" "\xe2\x80\xa6";
143 short utf16[] = {'u', 't', 'f', '1', '6', 0x2026 };
144 short utf16simple[] = {'u', 't', 'f', '1', '6', '!' };
145
reed@android.com8a1c16f2008-12-17 15:59:43 +0000146 makePath(path);
Ben Wagner1a1d2412017-10-17 17:33:44 -0400147 SkTDArray<SkPoint> pos;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000148 pos.setCount(asciiLength);
149 for (index = 0; index < asciiLength; index++)
150 pos[index].set(SkIntToScalar((unsigned int)index * 10),
tomhudson@google.comffe39bd2012-05-17 15:38:00 +0000151 SkIntToScalar((unsigned int)index * 2));
Ben Wagner1a1d2412017-10-17 17:33:44 -0400152 SkTDArray<SkPoint> pos2;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000153 pos2.setCount(asciiLength);
154 for (index = 0; index < asciiLength; index++)
155 pos2[index].set(SkIntToScalar((unsigned int)index * 10),
tomhudson@google.comffe39bd2012-05-17 15:38:00 +0000156 SkIntToScalar(20));
rmistry@google.comae933ce2012-08-23 18:19:56 +0000157
reed@android.com8a1c16f2008-12-17 15:59:43 +0000158 // shaders
senorblanco@chromium.org64cc5792011-05-19 19:58:58 +0000159 SkPoint linearPoints[] = { { 0, 0, }, { SkIntToScalar(40), SkIntToScalar(40) } };
reed@android.com8a1c16f2008-12-17 15:59:43 +0000160 SkColor linearColors[] = { SK_ColorRED, SK_ColorBLUE };
halcanary96fcdcc2015-08-27 07:41:13 -0700161 SkScalar* linearPos = nullptr;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000162 int linearCount = 2;
163 SkShader::TileMode linearMode = SkShader::kMirror_TileMode;
reed8a21c9f2016-03-08 18:50:00 -0800164 auto linear = SkGradientShader::MakeLinear(linearPoints,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000165 linearColors, linearPos, linearCount, linearMode);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000166
167 SkPoint radialCenter = { SkIntToScalar(25), SkIntToScalar(25) };
168 SkScalar radialRadius = SkIntToScalar(25);
169 SkColor radialColors[] = { SK_ColorGREEN, SK_ColorGRAY, SK_ColorRED };
170 SkScalar radialPos[] = { 0, SkIntToScalar(3) / 5, SkIntToScalar(1)};
171 int radialCount = 3;
172 SkShader::TileMode radialMode = SkShader::kRepeat_TileMode;
reed8a21c9f2016-03-08 18:50:00 -0800173 auto radial = SkGradientShader::MakeRadial(radialCenter,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000174 radialRadius, radialColors, radialPos, radialCount,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000175 radialMode);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000176
reed@android.com8a1c16f2008-12-17 15:59:43 +0000177 SkEmbossMaskFilter::Light light;
178 light.fDirection[0] = SK_Scalar1/2;
179 light.fDirection[1] = SK_Scalar1/2;
180 light.fDirection[2] = SK_Scalar1/3;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000181 light.fAmbient = 0x48;
182 light.fSpecular = 0x80;
rmistry@google.comae933ce2012-08-23 18:19:56 +0000183
reedd053ce92016-03-22 10:17:23 -0700184 auto lightingFilter = SkColorMatrixFilter::MakeLightingFilter(
reed@android.com8a1c16f2008-12-17 15:59:43 +0000185 0xff89bc45, 0xff112233);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000186
reed@android.com8a1c16f2008-12-17 15:59:43 +0000187 canvas->save();
rmistry@google.comae933ce2012-08-23 18:19:56 +0000188 canvas->translate(SkIntToScalar(0), SkIntToScalar(5));
reed@google.com9cfc83c2013-07-22 17:18:18 +0000189 paint.setAntiAlias(true);
reed93a12152015-03-16 10:08:34 -0700190 paint.setFilterQuality(kLow_SkFilterQuality);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000191 // !!! draw through a clip
192 paint.setColor(SK_ColorLTGRAY);
193 paint.setStyle(SkPaint::kFill_Style);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000194 SkRect clip = {0, 0, SkIntToScalar(320), SkIntToScalar(120)};
195 canvas->clipRect(clip);
reed8a21c9f2016-03-08 18:50:00 -0800196 paint.setShader(SkShader::MakeBitmapShader(fTx,
197 SkShader::kMirror_TileMode, SkShader::kRepeat_TileMode));
rmistry@google.comae933ce2012-08-23 18:19:56 +0000198 canvas->drawPaint(paint);
199 canvas->save();
200
reed@android.com8a1c16f2008-12-17 15:59:43 +0000201 // line (exercises xfermode, colorShader, colorFilter, filterShader)
rmistry@google.comae933ce2012-08-23 18:19:56 +0000202 paint.setColor(SK_ColorGREEN);
203 paint.setStrokeWidth(SkIntToScalar(10));
204 paint.setStyle(SkPaint::kStroke_Style);
reed374772b2016-10-05 17:33:02 -0700205 paint.setBlendMode(SkBlendMode::kXor);
reedd053ce92016-03-22 10:17:23 -0700206 paint.setColorFilter(lightingFilter);
Hal Canary23e474c2017-05-15 13:35:35 -0400207 canvas->drawLine(start, stop, paint); // should not be green
reed374772b2016-10-05 17:33:02 -0700208 paint.setBlendMode(SkBlendMode::kSrcOver);
halcanary96fcdcc2015-08-27 07:41:13 -0700209 paint.setColorFilter(nullptr);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000210
reed@android.com8a1c16f2008-12-17 15:59:43 +0000211 // rectangle
rmistry@google.comae933ce2012-08-23 18:19:56 +0000212 paint.setStyle(SkPaint::kFill_Style);
213 canvas->translate(SkIntToScalar(50), 0);
214 paint.setColor(SK_ColorYELLOW);
reed8a21c9f2016-03-08 18:50:00 -0800215 paint.setShader(linear);
reeda4393342016-03-18 11:22:57 -0700216 paint.setPathEffect(pathEffectTest());
rmistry@google.comae933ce2012-08-23 18:19:56 +0000217 canvas->drawRect(rect, paint);
halcanary96fcdcc2015-08-27 07:41:13 -0700218 paint.setPathEffect(nullptr);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000219
reed@android.com8a1c16f2008-12-17 15:59:43 +0000220 // circle w/ emboss & transparent (exercises 3dshader)
rmistry@google.comae933ce2012-08-23 18:19:56 +0000221 canvas->translate(SkIntToScalar(50), 0);
reedefdfd512016-04-04 10:02:58 -0700222 paint.setMaskFilter(SkEmbossMaskFilter::Make(
223 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5), light));
reed@android.com8a1c16f2008-12-17 15:59:43 +0000224 canvas->drawOval(rect, paint);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000225 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
reed56263c72015-06-05 11:31:26 -0700226// paint.setShader(transparentShader)->unref();
reed@android.com8a1c16f2008-12-17 15:59:43 +0000227 canvas->drawOval(rect, paint);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000228 canvas->translate(0, SkIntToScalar(-10));
229
reed@android.com8a1c16f2008-12-17 15:59:43 +0000230 // path
rmistry@google.comae933ce2012-08-23 18:19:56 +0000231 canvas->translate(SkIntToScalar(50), 0);
232 paint.setColor(SK_ColorRED);
233 paint.setStyle(SkPaint::kStroke_Style);
234 paint.setStrokeWidth(SkIntToScalar(5));
reed8a21c9f2016-03-08 18:50:00 -0800235 paint.setShader(radial);
halcanary96fcdcc2015-08-27 07:41:13 -0700236 paint.setMaskFilter(nullptr);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000237 canvas->drawPath(path, paint);
238
halcanary96fcdcc2015-08-27 07:41:13 -0700239 paint.setShader(nullptr);
reed6f45c172015-11-04 08:34:07 -0800240 // bitmap
rmistry@google.comae933ce2012-08-23 18:19:56 +0000241 canvas->translate(SkIntToScalar(50), 0);
242 paint.setStyle(SkPaint::kFill_Style);
243 canvas->drawBitmap(fBug, left, top, &paint);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000244
rmistry@google.comae933ce2012-08-23 18:19:56 +0000245 canvas->translate(-SkIntToScalar(30), SkIntToScalar(30));
reed8a21c9f2016-03-08 18:50:00 -0800246 paint.setShader(shaderTest()); // test compose shader
rmistry@google.comae933ce2012-08-23 18:19:56 +0000247 canvas->drawRect(rect2, paint);
halcanary96fcdcc2015-08-27 07:41:13 -0700248 paint.setShader(nullptr);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000249
reed@android.com8a1c16f2008-12-17 15:59:43 +0000250 canvas->restore();
251 // text
reed@android.com8a1c16f2008-12-17 15:59:43 +0000252 canvas->translate(0, SkIntToScalar(60));
rmistry@google.comae933ce2012-08-23 18:19:56 +0000253 canvas->save();
254 paint.setColor(SK_ColorGRAY);
255 canvas->drawPosText(ascii, asciiLength, pos.begin(), paint);
256 canvas->drawPosText(ascii, asciiLength, pos2.begin(), paint);
257
258 canvas->translate(SkIntToScalar(50), 0);
259 paint.setColor(SK_ColorCYAN);
260 canvas->drawText(utf8, sizeof(utf8) - 1, x, y, paint);
261
262 canvas->translate(SkIntToScalar(30), 0);
263 paint.setColor(SK_ColorMAGENTA);
264 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
265 matrix.setTranslate(SkIntToScalar(10), SkIntToScalar(10));
Mike Reeda62d0362018-08-28 16:26:06 -0400266 SkDrawTextOnPath((void*)utf16, sizeof(utf16), paint, path, &matrix, canvas);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000267 canvas->translate(0, SkIntToScalar(20));
Mike Reeda62d0362018-08-28 16:26:06 -0400268 SkDrawTextOnPath((void*) utf16simple, sizeof(utf16simple), paint, path, &matrix, canvas);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000269 canvas->restore();
270
271 canvas->translate(0, SkIntToScalar(60));
272 paint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000273 canvas->restore();
274 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000275
Ben Wagnerb2c4ea62018-08-08 11:36:17 -0400276 virtual Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000277 fClickPt.set(x, y);
reed@google.com4d5c26d2013-01-08 16:17:50 +0000278 return this->INHERITED::onFindClickHandler(x, y, modi);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000279 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000280
reeda4393342016-03-18 11:22:57 -0700281 sk_sp<SkPathEffect> pathEffectTest() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000282 static const int gXY[] = { 1, 0, 0, -1, 2, -1, 3, 0, 2, 1, 0, 1 };
283 SkScalar gPhase = 0;
284 SkPath path;
285 path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
286 for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2)
287 path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
288 path.close();
289 path.offset(SkIntToScalar(-6), 0);
reeda4393342016-03-18 11:22:57 -0700290 auto outer = SkPath1DPathEffect::Make(path, SkIntToScalar(12),
reed@android.com8a1c16f2008-12-17 15:59:43 +0000291 gPhase, SkPath1DPathEffect::kRotate_Style);
reeda4393342016-03-18 11:22:57 -0700292 auto inner = SkDiscretePathEffect::Make(SkIntToScalar(2),
reed@android.com8a1c16f2008-12-17 15:59:43 +0000293 SkIntToScalar(1)/10); // SkCornerPathEffect(SkIntToScalar(2));
Mike Reeda07741a2017-02-25 22:34:32 -0500294 return SkPathEffect::MakeCompose(outer, inner);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000295 }
reed@google.com963a8fa2012-05-10 13:04:59 +0000296
reed8a21c9f2016-03-08 18:50:00 -0800297 sk_sp<SkShader> shaderTest() {
senorblanco@chromium.org64cc5792011-05-19 19:58:58 +0000298 SkPoint pts[] = { { 0, 0, }, { SkIntToScalar(100), 0 } };
reed@android.com8a1c16f2008-12-17 15:59:43 +0000299 SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
reed8a21c9f2016-03-08 18:50:00 -0800300 auto shaderA = SkGradientShader::MakeLinear(pts, colors, nullptr,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000301 2, SkShader::kClamp_TileMode);
302 pts[1].set(0, SkIntToScalar(100));
303 SkColor colors2[] = {SK_ColorBLACK, SkColorSetARGB(0x80, 0, 0, 0)};
reed8a21c9f2016-03-08 18:50:00 -0800304 auto shaderB = SkGradientShader::MakeLinear(pts, colors2, nullptr,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000305 2, SkShader::kClamp_TileMode);
reedcfb6bdf2016-03-29 11:32:50 -0700306 return SkShader::MakeComposeShader(std::move(shaderA), std::move(shaderB),
Mike Reed7d954ad2016-10-28 15:42:34 -0400307 SkBlendMode::kDstIn);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000308 }
309
310 virtual void startTest() {
msarettd15750c2016-03-18 15:48:49 -0700311 decode_file("/Users/caryclark/Desktop/bugcirc.gif", &fBug);
312 decode_file("/Users/caryclark/Desktop/tbcirc.gif", &fTb);
313 decode_file("/Users/caryclark/Desktop/05psp04.gif", &fTx);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000314 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000315
reed@android.com8a1c16f2008-12-17 15:59:43 +0000316private:
317 SkPoint fClickPt;
318 SkBitmap fBug, fTb, fTx;
Ben Wagnerb2c4ea62018-08-08 11:36:17 -0400319 typedef Sample INHERITED;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000320};
321
322//////////////////////////////////////////////////////////////////////////////
323
Ben Wagnerb2c4ea62018-08-08 11:36:17 -0400324DEF_SAMPLE( return new DemoView(); )