blob: 92c5773d3607d78fbbefb50c7f75e4d0392df58f [file] [log] [blame]
scroggo478652e2015-03-25 07:11:02 -07001/*
2 * Copyright 2015 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
mtklein748ca3b2015-01-15 10:56:12 -08008#ifndef DMSrcSink_DEFINED
9#define DMSrcSink_DEFINED
10
11#include "DMGpuSupport.h"
12#include "SkBBHFactory.h"
13#include "SkBBoxHierarchy.h"
14#include "SkBitmap.h"
msarett5cb48852015-11-06 08:56:32 -080015#include "SkBitmapRegionDecoder.h"
mtklein748ca3b2015-01-15 10:56:12 -080016#include "SkCanvas.h"
17#include "SkData.h"
halcanary45420a92016-06-02 12:41:14 -070018#include "SkMultiPictureDocumentReader.h"
mtklein748ca3b2015-01-15 10:56:12 -080019#include "SkPicture.h"
mtklein748ca3b2015-01-15 10:56:12 -080020#include "gm.h"
21
Mike Reedbae888e2017-02-18 16:50:45 -050022//#define TEST_VIA_SVG
23
mtklein748ca3b2015-01-15 10:56:12 -080024namespace DM {
25
26// This is just convenience. It lets you use either return "foo" or return SkStringPrintf(...).
27struct ImplicitString : public SkString {
28 template <typename T>
29 ImplicitString(const T& s) : SkString(s) {}
msarett9e707a02015-09-01 14:57:57 -070030 ImplicitString() : SkString("") {}
mtklein748ca3b2015-01-15 10:56:12 -080031};
mtklein748ca3b2015-01-15 10:56:12 -080032typedef ImplicitString Name;
mtklein8d17a132015-01-30 11:42:31 -080033typedef ImplicitString Path;
mtklein748ca3b2015-01-15 10:56:12 -080034
mtklein4089ef72015-03-05 08:40:28 -080035class Error {
36public:
37 Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {}
38 Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {}
39
40 Error(const Error&) = default;
41 Error& operator=(const Error&) = default;
42
43 static Error Nonfatal(const SkString& s) { return Nonfatal(s.c_str()); }
44 static Error Nonfatal(const char* s) {
45 Error e(s);
46 e.fFatal = false;
47 return e;
48 }
49
50 const char* c_str() const { return fMsg.c_str(); }
51 bool isEmpty() const { return fMsg.isEmpty(); }
52 bool isFatal() const { return fFatal; }
53
54private:
55 SkString fMsg;
56 bool fFatal;
57};
58
mtklein99cab4e2015-07-31 06:43:04 -070059struct SinkFlags {
60 enum { kNull, kGPU, kVector, kRaster } type;
61 enum { kDirect, kIndirect } approach;
62};
mtkleine0effd62015-07-29 06:37:28 -070063
mtklein748ca3b2015-01-15 10:56:12 -080064struct Src {
mtklein748ca3b2015-01-15 10:56:12 -080065 virtual ~Src() {}
66 virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0;
67 virtual SkISize size() const = 0;
68 virtual Name name() const = 0;
bsalomon4ee6bd82015-05-27 13:23:23 -070069 virtual void modifyGrContextOptions(GrContextOptions* options) const {}
mtklein99cab4e2015-07-31 06:43:04 -070070 virtual bool veto(SinkFlags) const { return false; }
mtklein21eaf3b2016-02-08 12:39:59 -080071
halcanary45420a92016-06-02 12:41:14 -070072 virtual int pageCount() const { return 1; }
73 virtual Error SK_WARN_UNUSED_RESULT draw(int, SkCanvas* canvas) const {
74 return this->draw(canvas);
75 }
76 virtual SkISize size(int) const { return this->size(); }
mtklein21eaf3b2016-02-08 12:39:59 -080077 // Force Tasks using this Src to run on the main thread?
78 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080079};
80
81struct Sink {
82 virtual ~Sink() {}
mtkleinb9eb4ac2015-02-02 18:26:03 -080083 // You may write to either the bitmap or stream. If you write to log, we'll print that out.
84 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*, SkString* log)
85 const = 0;
mtklein21eaf3b2016-02-08 12:39:59 -080086
87 // Force Tasks using this Sink to run on the main thread?
88 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080089
90 // File extension for the content draw() outputs, e.g. "png", "pdf".
91 virtual const char* fileExtension() const = 0;
mtklein99cab4e2015-07-31 06:43:04 -070092
93 virtual SinkFlags flags() const = 0;
mtklein748ca3b2015-01-15 10:56:12 -080094};
95
mtklein748ca3b2015-01-15 10:56:12 -080096/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
97
mtklein748ca3b2015-01-15 10:56:12 -080098class GMSrc : public Src {
99public:
100 explicit GMSrc(skiagm::GMRegistry::Factory);
101
mtklein36352bf2015-03-25 18:17:31 -0700102 Error draw(SkCanvas*) const override;
103 SkISize size() const override;
104 Name name() const override;
bsalomon4ee6bd82015-05-27 13:23:23 -0700105 void modifyGrContextOptions(GrContextOptions* options) const override;
106
mtklein748ca3b2015-01-15 10:56:12 -0800107private:
108 skiagm::GMRegistry::Factory fFactory;
109};
110
scroggo9b77ddd2015-03-19 06:03:39 -0700111class CodecSrc : public Src {
112public:
scroggo9c59ebc2015-03-25 13:48:49 -0700113 enum Mode {
msarett9e707a02015-09-01 14:57:57 -0700114 kCodec_Mode,
msarettbb25b532016-01-13 09:31:39 -0800115 // We choose to test only one mode with zero initialized memory.
116 // This will exercise all of the interesting cases in SkSwizzler
117 // without doubling the size of our test suite.
118 kCodecZeroInit_Mode,
scroggo9c59ebc2015-03-25 13:48:49 -0700119 kScanline_Mode,
msarett0a242972015-06-11 14:27:27 -0700120 kStripe_Mode, // Tests the skipping of scanlines
msarett91c22b22016-02-22 12:27:46 -0800121 kCroppedScanline_Mode, // Tests (jpeg) cropped scanline optimization
scroggob636b452015-07-22 07:16:20 -0700122 kSubset_Mode, // For codecs that support subsets directly.
scroggo19b91532016-10-24 09:03:26 -0700123 kAnimated_Mode, // For codecs that support animation.
scroggo9c59ebc2015-03-25 13:48:49 -0700124 };
msarett438b2ad2015-04-09 12:43:10 -0700125 enum DstColorType {
126 kGetFromCanvas_DstColorType,
127 kIndex8_Always_DstColorType,
128 kGrayscale_Always_DstColorType,
msarett34e0ec42016-04-22 16:27:24 -0700129 kNonNative8888_Always_DstColorType,
msarett438b2ad2015-04-09 12:43:10 -0700130 };
scroggoc5560be2016-02-03 09:42:42 -0800131 CodecSrc(Path, Mode, DstColorType, SkAlphaType, float);
scroggo9b77ddd2015-03-19 06:03:39 -0700132
mtklein36352bf2015-03-25 18:17:31 -0700133 Error draw(SkCanvas*) const override;
134 SkISize size() const override;
135 Name name() const override;
mtklein99cab4e2015-07-31 06:43:04 -0700136 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800137 bool serial() const override { return fRunSerially; }
scroggo9b77ddd2015-03-19 06:03:39 -0700138private:
msarett9e707a02015-09-01 14:57:57 -0700139 Path fPath;
140 Mode fMode;
141 DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800142 SkAlphaType fDstAlphaType;
msarett9e707a02015-09-01 14:57:57 -0700143 float fScale;
scroggo3ac66e92016-02-08 15:09:48 -0800144 bool fRunSerially;
scroggo9b77ddd2015-03-19 06:03:39 -0700145};
146
msarett3d9d7a72015-10-21 10:27:10 -0700147class AndroidCodecSrc : public Src {
148public:
scroggof8dc9df2016-05-16 09:04:13 -0700149 AndroidCodecSrc(Path, CodecSrc::DstColorType, SkAlphaType, int sampleSize);
msarett3d9d7a72015-10-21 10:27:10 -0700150
151 Error draw(SkCanvas*) const override;
152 SkISize size() const override;
153 Name name() const override;
154 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800155 bool serial() const override { return fRunSerially; }
msarett3d9d7a72015-10-21 10:27:10 -0700156private:
157 Path fPath;
msarett3d9d7a72015-10-21 10:27:10 -0700158 CodecSrc::DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800159 SkAlphaType fDstAlphaType;
msarett3d9d7a72015-10-21 10:27:10 -0700160 int fSampleSize;
scroggo3ac66e92016-02-08 15:09:48 -0800161 bool fRunSerially;
msarett3d9d7a72015-10-21 10:27:10 -0700162};
163
msaretta5783ae2015-09-08 15:35:32 -0700164// Allows for testing of various implementations of Android's BitmapRegionDecoder
165class BRDSrc : public Src {
166public:
167 enum Mode {
168 // Decode the entire image as one region.
169 kFullImage_Mode,
170 // Splits the image into multiple regions using a divisor and decodes the regions
171 // separately. Also, this test adds a border of a few pixels to each of the regions
172 // that it is decoding. This tests the behavior when a client asks for a region that
173 // does not fully fit in the image.
174 kDivisor_Mode,
175 };
176
msarettd1227a72016-05-18 06:23:57 -0700177 BRDSrc(Path, Mode, CodecSrc::DstColorType, uint32_t);
msaretta5783ae2015-09-08 15:35:32 -0700178
msaretta5783ae2015-09-08 15:35:32 -0700179 Error draw(SkCanvas*) const override;
180 SkISize size() const override;
181 Name name() const override;
182 bool veto(SinkFlags) const override;
183private:
184 Path fPath;
msaretta5783ae2015-09-08 15:35:32 -0700185 Mode fMode;
186 CodecSrc::DstColorType fDstColorType;
187 uint32_t fSampleSize;
188};
scroggo9b77ddd2015-03-19 06:03:39 -0700189
msarett18976312016-03-09 14:20:58 -0800190class ImageGenSrc : public Src {
191public:
192 enum Mode {
193 kCodec_Mode, // Use CodecImageGenerator
194 kPlatform_Mode, // Uses CG or WIC
195 };
196 ImageGenSrc(Path, Mode, SkAlphaType, bool);
197
198 Error draw(SkCanvas*) const override;
199 SkISize size() const override;
200 Name name() const override;
201 bool veto(SinkFlags) const override;
202 bool serial() const override { return fRunSerially; }
203private:
204 Path fPath;
205 Mode fMode;
206 SkAlphaType fDstAlphaType;
207 bool fIsGpu;
208 bool fRunSerially;
209};
210
msarett69deca82016-04-29 09:38:40 -0700211class ColorCodecSrc : public Src {
212public:
213 enum Mode {
214 // Mimic legacy behavior and apply no color correction.
215 kBaseline_Mode,
msarett888dc162016-05-23 10:21:17 -0700216
217 // Color correct images into a specific dst color space. If you happen to have this
218 // monitor, you're in luck! The unmarked outputs of this test should display
219 // correctly on this monitor in the Chrome browser. If not, it's useful to know
220 // that this monitor has a profile that is fairly similar to Adobe RGB.
msarett888dc162016-05-23 10:21:17 -0700221 kDst_HPZR30w_Mode,
msarett9876ac52016-06-01 14:47:18 -0700222
msarettd2809572016-06-20 06:07:45 -0700223 kDst_sRGB_Mode,
msarett69deca82016-04-29 09:38:40 -0700224 };
225
msarett9ce3a542016-07-15 13:54:38 -0700226 ColorCodecSrc(Path, Mode, SkColorType);
msarett69deca82016-04-29 09:38:40 -0700227
228 Error draw(SkCanvas*) const override;
229 SkISize size() const override;
230 Name name() const override;
231 bool veto(SinkFlags) const override;
232private:
233 Path fPath;
234 Mode fMode;
msarett9ce3a542016-07-15 13:54:38 -0700235 SkColorType fColorType;
msarett69deca82016-04-29 09:38:40 -0700236};
237
mtklein748ca3b2015-01-15 10:56:12 -0800238class SKPSrc : public Src {
239public:
mtklein8d17a132015-01-30 11:42:31 -0800240 explicit SKPSrc(Path path);
mtklein748ca3b2015-01-15 10:56:12 -0800241
mtklein36352bf2015-03-25 18:17:31 -0700242 Error draw(SkCanvas*) const override;
243 SkISize size() const override;
244 Name name() const override;
mtklein748ca3b2015-01-15 10:56:12 -0800245private:
mtklein8d17a132015-01-30 11:42:31 -0800246 Path fPath;
mtklein748ca3b2015-01-15 10:56:12 -0800247};
248
fmalitaa2b9fdf2016-08-03 19:53:36 -0700249#if defined(SK_XML)
fmalitabdf3e5c2016-09-17 07:26:26 -0700250} // namespace DM
251
252class SkSVGDOM;
253
254namespace DM {
255
fmalitaa2b9fdf2016-08-03 19:53:36 -0700256class SVGSrc : public Src {
257public:
258 explicit SVGSrc(Path path);
259
260 Error draw(SkCanvas*) const override;
261 SkISize size() const override;
262 Name name() const override;
fmalita179d8852016-08-16 14:23:29 -0700263 bool veto(SinkFlags) const override;
fmalitaa2b9fdf2016-08-03 19:53:36 -0700264
265private:
fmalitaacd2f5c2016-11-08 07:13:45 -0800266 Name fName;
267 sk_sp<SkSVGDOM> fDom;
268 SkScalar fScale;
fmalitaa2b9fdf2016-08-03 19:53:36 -0700269
270 typedef Src INHERITED;
271};
272#endif // SK_XML
mtklein748ca3b2015-01-15 10:56:12 -0800273/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
274
halcanary45420a92016-06-02 12:41:14 -0700275class MSKPSrc : public Src {
276public:
277 explicit MSKPSrc(Path path);
278
279 int pageCount() const override;
280 Error draw(SkCanvas* c) const override;
281 Error draw(int, SkCanvas*) const override;
282 SkISize size() const override;
283 SkISize size(int) const override;
284 Name name() const override;
285
286private:
287 Path fPath;
288 SkMultiPictureDocumentReader fReader;
289};
290
291/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
292
mtkleinad66f9b2015-02-13 15:11:10 -0800293class NullSink : public Sink {
294public:
295 NullSink() {}
296
mtklein36352bf2015-03-25 18:17:31 -0700297 Error draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700298 const char* fileExtension() const override { return ""; }
mtklein99cab4e2015-07-31 06:43:04 -0700299 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kNull, SinkFlags::kDirect }; }
mtkleinad66f9b2015-02-13 15:11:10 -0800300};
301
302
mtklein748ca3b2015-01-15 10:56:12 -0800303class GPUSink : public Sink {
304public:
bsalomon85b4b532016-04-05 11:06:27 -0700305 GPUSink(sk_gpu_test::GrContextFactory::ContextType,
csmartdaltone812d492017-02-21 12:36:05 -0700306 sk_gpu_test::GrContextFactory::ContextOverrides,
brianosmanb109b8c2016-06-16 13:03:24 -0700307 int samples, bool diText, SkColorType colorType, sk_sp<SkColorSpace> colorSpace,
brianosmand93c1202016-03-10 07:49:08 -0800308 bool threaded);
mtklein748ca3b2015-01-15 10:56:12 -0800309
mtklein36352bf2015-03-25 18:17:31 -0700310 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein21eaf3b2016-02-08 12:39:59 -0800311 bool serial() const override { return !fThreaded; }
mtklein36352bf2015-03-25 18:17:31 -0700312 const char* fileExtension() const override { return "png"; }
mtklein99cab4e2015-07-31 06:43:04 -0700313 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect }; }
mtklein748ca3b2015-01-15 10:56:12 -0800314private:
csmartdaltone812d492017-02-21 12:36:05 -0700315 sk_gpu_test::GrContextFactory::ContextType fContextType;
316 sk_gpu_test::GrContextFactory::ContextOverrides fContextOverrides;
317 int fSampleCount;
318 bool fUseDIText;
319 SkColorType fColorType;
320 sk_sp<SkColorSpace> fColorSpace;
321 bool fThreaded;
mtklein748ca3b2015-01-15 10:56:12 -0800322};
323
324class PDFSink : public Sink {
325public:
halcanary4b656662016-04-27 07:45:18 -0700326 PDFSink(bool pdfa = false) : fPDFA(pdfa) {}
mtklein36352bf2015-03-25 18:17:31 -0700327 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700328 const char* fileExtension() const override { return "pdf"; }
mtklein99cab4e2015-07-31 06:43:04 -0700329 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
halcanary4b656662016-04-27 07:45:18 -0700330 bool fPDFA;
mtklein748ca3b2015-01-15 10:56:12 -0800331};
332
halcanary47ef4d52015-03-03 09:13:09 -0800333class XPSSink : public Sink {
334public:
335 XPSSink();
336
mtklein36352bf2015-03-25 18:17:31 -0700337 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700338 const char* fileExtension() const override { return "xps"; }
mtklein99cab4e2015-07-31 06:43:04 -0700339 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
halcanary47ef4d52015-03-03 09:13:09 -0800340};
341
reed54dc4872016-09-13 08:09:45 -0700342class PipeSink : public Sink {
343public:
344 PipeSink();
345
346 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
347 const char* fileExtension() const override { return "skpipe"; }
348 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
349};
350
mtklein748ca3b2015-01-15 10:56:12 -0800351class RasterSink : public Sink {
352public:
brianosmanb109b8c2016-06-16 13:03:24 -0700353 explicit RasterSink(SkColorType, sk_sp<SkColorSpace> = nullptr);
mtklein748ca3b2015-01-15 10:56:12 -0800354
mtklein36352bf2015-03-25 18:17:31 -0700355 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700356 const char* fileExtension() const override { return "png"; }
mtklein99cab4e2015-07-31 06:43:04 -0700357 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; }
mtklein748ca3b2015-01-15 10:56:12 -0800358private:
brianosmanb109b8c2016-06-16 13:03:24 -0700359 SkColorType fColorType;
360 sk_sp<SkColorSpace> fColorSpace;
mtklein748ca3b2015-01-15 10:56:12 -0800361};
362
mtklein9c3f17d2015-01-28 11:35:18 -0800363class SKPSink : public Sink {
364public:
365 SKPSink();
366
mtklein36352bf2015-03-25 18:17:31 -0700367 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700368 const char* fileExtension() const override { return "skp"; }
mtklein99cab4e2015-07-31 06:43:04 -0700369 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
mtklein9c3f17d2015-01-28 11:35:18 -0800370};
371
Hal Canary85c7fe82016-10-25 10:33:27 -0400372class DebugSink : public Sink {
373public:
374 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
375 const char* fileExtension() const override { return "json"; }
376 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
377};
378
mtklein8a4527e2015-01-31 20:00:58 -0800379class SVGSink : public Sink {
380public:
381 SVGSink();
382
mtklein36352bf2015-03-25 18:17:31 -0700383 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700384 const char* fileExtension() const override { return "svg"; }
mtklein99cab4e2015-07-31 06:43:04 -0700385 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
mtklein8a4527e2015-01-31 20:00:58 -0800386};
387
388
mtklein748ca3b2015-01-15 10:56:12 -0800389/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
390
mtklein78829242015-05-06 07:54:07 -0700391class Via : public Sink {
392public:
msarett62d3b102015-12-10 15:14:27 -0800393 explicit Via(Sink* sink) : fSink(sink) {}
mtklein78829242015-05-06 07:54:07 -0700394 const char* fileExtension() const override { return fSink->fileExtension(); }
mtklein21eaf3b2016-02-08 12:39:59 -0800395 bool serial() const override { return fSink->serial(); }
mtklein99cab4e2015-07-31 06:43:04 -0700396 SinkFlags flags() const override {
397 SinkFlags flags = fSink->flags();
398 flags.approach = SinkFlags::kIndirect;
399 return flags;
400 }
mtklein78829242015-05-06 07:54:07 -0700401protected:
Ben Wagner145dbcd2016-11-03 14:40:50 -0400402 std::unique_ptr<Sink> fSink;
mtklein78829242015-05-06 07:54:07 -0700403};
404
405class ViaMatrix : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800406public:
msarett62d3b102015-12-10 15:14:27 -0800407 ViaMatrix(SkMatrix, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700408 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800409private:
mtklein78829242015-05-06 07:54:07 -0700410 const SkMatrix fMatrix;
mtklein748ca3b2015-01-15 10:56:12 -0800411};
412
mtklein78829242015-05-06 07:54:07 -0700413class ViaUpright : public Via {
mtkleind603b222015-02-17 11:13:33 -0800414public:
msarett62d3b102015-12-10 15:14:27 -0800415 ViaUpright(SkMatrix, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700416 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleind603b222015-02-17 11:13:33 -0800417private:
mtklein78829242015-05-06 07:54:07 -0700418 const SkMatrix fMatrix;
mtkleind603b222015-02-17 11:13:33 -0800419};
420
mtklein78829242015-05-06 07:54:07 -0700421class ViaSerialization : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800422public:
msarett62d3b102015-12-10 15:14:27 -0800423 explicit ViaSerialization(Sink* sink) : Via(sink) {}
mtklein36352bf2015-03-25 18:17:31 -0700424 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800425};
426
mtklein4a34ecb2016-01-08 10:19:35 -0800427class ViaPicture : public Via {
428public:
429 explicit ViaPicture(Sink* sink) : Via(sink) {}
430 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
431};
432
reed54dc4872016-09-13 08:09:45 -0700433class ViaPipe : public Via {
434public:
435 explicit ViaPipe(Sink* sink) : Via(sink) {}
436 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
437};
438
reedbabc3de2016-07-08 08:43:27 -0700439class ViaDefer : public Via {
440public:
441 explicit ViaDefer(Sink* sink) : Via(sink) {}
442 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
443};
444
mtklein78829242015-05-06 07:54:07 -0700445class ViaTiles : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800446public:
msarett62d3b102015-12-10 15:14:27 -0800447 ViaTiles(int w, int h, SkBBHFactory*, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700448 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800449private:
450 const int fW, fH;
Ben Wagner145dbcd2016-11-03 14:40:50 -0400451 std::unique_ptr<SkBBHFactory> fFactory;
mtklein748ca3b2015-01-15 10:56:12 -0800452};
453
mtklein78829242015-05-06 07:54:07 -0700454class ViaSecondPicture : public Via {
mtkleinb7e8d692015-04-07 08:30:32 -0700455public:
msarett62d3b102015-12-10 15:14:27 -0800456 explicit ViaSecondPicture(Sink* sink) : Via(sink) {}
mtkleinb7e8d692015-04-07 08:30:32 -0700457 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleinb7e8d692015-04-07 08:30:32 -0700458};
459
mtklein78829242015-05-06 07:54:07 -0700460class ViaSingletonPictures : public Via {
mtkleind31c13d2015-05-05 12:59:56 -0700461public:
msarett62d3b102015-12-10 15:14:27 -0800462 explicit ViaSingletonPictures(Sink* sink) : Via(sink) {}
mtkleind31c13d2015-05-05 12:59:56 -0700463 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleind31c13d2015-05-05 12:59:56 -0700464};
465
mtklein6fbf4b32015-05-06 11:35:40 -0700466class ViaTwice : public Via {
467public:
msarett62d3b102015-12-10 15:14:27 -0800468 explicit ViaTwice(Sink* sink) : Via(sink) {}
mtklein6fbf4b32015-05-06 11:35:40 -0700469 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
470};
471
Mike Reedf67c4592017-02-17 17:06:11 -0500472class ViaSVG : public Via {
473public:
474 explicit ViaSVG(Sink* sink) : Via(sink) {}
475 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
476};
477
halcanary7a76f9c2016-02-03 11:53:18 -0800478class ViaMojo : public Via {
479public:
480 explicit ViaMojo(Sink* sink) : Via(sink) {}
481 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
482};
483
mtklein9c5052f2016-08-06 12:51:51 -0700484class ViaLite : public Via {
485public:
486 explicit ViaLite(Sink* sink) : Via(sink) {}
487 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
488};
489
mtklein748ca3b2015-01-15 10:56:12 -0800490} // namespace DM
491
492#endif//DMSrcSink_DEFINED