blob: bb6011505100089ba3729375e98c5fe27936dae2 [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
22namespace DM {
23
24// This is just convenience. It lets you use either return "foo" or return SkStringPrintf(...).
25struct ImplicitString : public SkString {
26 template <typename T>
27 ImplicitString(const T& s) : SkString(s) {}
msarett9e707a02015-09-01 14:57:57 -070028 ImplicitString() : SkString("") {}
mtklein748ca3b2015-01-15 10:56:12 -080029};
mtklein748ca3b2015-01-15 10:56:12 -080030typedef ImplicitString Name;
mtklein8d17a132015-01-30 11:42:31 -080031typedef ImplicitString Path;
mtklein748ca3b2015-01-15 10:56:12 -080032
mtklein4089ef72015-03-05 08:40:28 -080033class Error {
34public:
35 Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {}
36 Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {}
37
38 Error(const Error&) = default;
39 Error& operator=(const Error&) = default;
40
41 static Error Nonfatal(const SkString& s) { return Nonfatal(s.c_str()); }
42 static Error Nonfatal(const char* s) {
43 Error e(s);
44 e.fFatal = false;
45 return e;
46 }
47
48 const char* c_str() const { return fMsg.c_str(); }
49 bool isEmpty() const { return fMsg.isEmpty(); }
50 bool isFatal() const { return fFatal; }
51
52private:
53 SkString fMsg;
54 bool fFatal;
55};
56
mtklein99cab4e2015-07-31 06:43:04 -070057struct SinkFlags {
58 enum { kNull, kGPU, kVector, kRaster } type;
59 enum { kDirect, kIndirect } approach;
60};
mtkleine0effd62015-07-29 06:37:28 -070061
mtklein748ca3b2015-01-15 10:56:12 -080062struct Src {
mtklein748ca3b2015-01-15 10:56:12 -080063 virtual ~Src() {}
64 virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0;
65 virtual SkISize size() const = 0;
66 virtual Name name() const = 0;
bsalomon4ee6bd82015-05-27 13:23:23 -070067 virtual void modifyGrContextOptions(GrContextOptions* options) const {}
mtklein99cab4e2015-07-31 06:43:04 -070068 virtual bool veto(SinkFlags) const { return false; }
mtklein21eaf3b2016-02-08 12:39:59 -080069
halcanary45420a92016-06-02 12:41:14 -070070 virtual int pageCount() const { return 1; }
71 virtual Error SK_WARN_UNUSED_RESULT draw(int, SkCanvas* canvas) const {
72 return this->draw(canvas);
73 }
74 virtual SkISize size(int) const { return this->size(); }
mtklein21eaf3b2016-02-08 12:39:59 -080075 // Force Tasks using this Src to run on the main thread?
76 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080077};
78
79struct Sink {
80 virtual ~Sink() {}
mtkleinb9eb4ac2015-02-02 18:26:03 -080081 // You may write to either the bitmap or stream. If you write to log, we'll print that out.
82 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*, SkString* log)
83 const = 0;
mtklein21eaf3b2016-02-08 12:39:59 -080084
85 // Force Tasks using this Sink to run on the main thread?
86 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080087
88 // File extension for the content draw() outputs, e.g. "png", "pdf".
89 virtual const char* fileExtension() const = 0;
mtklein99cab4e2015-07-31 06:43:04 -070090
91 virtual SinkFlags flags() const = 0;
mtklein748ca3b2015-01-15 10:56:12 -080092};
93
mtklein748ca3b2015-01-15 10:56:12 -080094/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
95
mtklein748ca3b2015-01-15 10:56:12 -080096class GMSrc : public Src {
97public:
98 explicit GMSrc(skiagm::GMRegistry::Factory);
99
mtklein36352bf2015-03-25 18:17:31 -0700100 Error draw(SkCanvas*) const override;
101 SkISize size() const override;
102 Name name() const override;
bsalomon4ee6bd82015-05-27 13:23:23 -0700103 void modifyGrContextOptions(GrContextOptions* options) const override;
104
mtklein748ca3b2015-01-15 10:56:12 -0800105private:
106 skiagm::GMRegistry::Factory fFactory;
107};
108
scroggo9b77ddd2015-03-19 06:03:39 -0700109class CodecSrc : public Src {
110public:
scroggo9c59ebc2015-03-25 13:48:49 -0700111 enum Mode {
msarett9e707a02015-09-01 14:57:57 -0700112 kCodec_Mode,
msarettbb25b532016-01-13 09:31:39 -0800113 // We choose to test only one mode with zero initialized memory.
114 // This will exercise all of the interesting cases in SkSwizzler
115 // without doubling the size of our test suite.
116 kCodecZeroInit_Mode,
scroggo9c59ebc2015-03-25 13:48:49 -0700117 kScanline_Mode,
msarett0a242972015-06-11 14:27:27 -0700118 kStripe_Mode, // Tests the skipping of scanlines
msarett91c22b22016-02-22 12:27:46 -0800119 kCroppedScanline_Mode, // Tests (jpeg) cropped scanline optimization
scroggob636b452015-07-22 07:16:20 -0700120 kSubset_Mode, // For codecs that support subsets directly.
scroggo19b91532016-10-24 09:03:26 -0700121 kAnimated_Mode, // For codecs that support animation.
scroggo9c59ebc2015-03-25 13:48:49 -0700122 };
msarett438b2ad2015-04-09 12:43:10 -0700123 enum DstColorType {
124 kGetFromCanvas_DstColorType,
125 kIndex8_Always_DstColorType,
126 kGrayscale_Always_DstColorType,
msarett34e0ec42016-04-22 16:27:24 -0700127 kNonNative8888_Always_DstColorType,
msarett438b2ad2015-04-09 12:43:10 -0700128 };
scroggoc5560be2016-02-03 09:42:42 -0800129 CodecSrc(Path, Mode, DstColorType, SkAlphaType, float);
scroggo9b77ddd2015-03-19 06:03:39 -0700130
mtklein36352bf2015-03-25 18:17:31 -0700131 Error draw(SkCanvas*) const override;
132 SkISize size() const override;
133 Name name() const override;
mtklein99cab4e2015-07-31 06:43:04 -0700134 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800135 bool serial() const override { return fRunSerially; }
scroggo9b77ddd2015-03-19 06:03:39 -0700136private:
msarett9e707a02015-09-01 14:57:57 -0700137 Path fPath;
138 Mode fMode;
139 DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800140 SkAlphaType fDstAlphaType;
msarett9e707a02015-09-01 14:57:57 -0700141 float fScale;
scroggo3ac66e92016-02-08 15:09:48 -0800142 bool fRunSerially;
scroggo9b77ddd2015-03-19 06:03:39 -0700143};
144
msarett3d9d7a72015-10-21 10:27:10 -0700145class AndroidCodecSrc : public Src {
146public:
scroggof8dc9df2016-05-16 09:04:13 -0700147 AndroidCodecSrc(Path, CodecSrc::DstColorType, SkAlphaType, int sampleSize);
msarett3d9d7a72015-10-21 10:27:10 -0700148
149 Error draw(SkCanvas*) const override;
150 SkISize size() const override;
151 Name name() const override;
152 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800153 bool serial() const override { return fRunSerially; }
msarett3d9d7a72015-10-21 10:27:10 -0700154private:
155 Path fPath;
msarett3d9d7a72015-10-21 10:27:10 -0700156 CodecSrc::DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800157 SkAlphaType fDstAlphaType;
msarett3d9d7a72015-10-21 10:27:10 -0700158 int fSampleSize;
scroggo3ac66e92016-02-08 15:09:48 -0800159 bool fRunSerially;
msarett3d9d7a72015-10-21 10:27:10 -0700160};
161
msaretta5783ae2015-09-08 15:35:32 -0700162// Allows for testing of various implementations of Android's BitmapRegionDecoder
163class BRDSrc : public Src {
164public:
165 enum Mode {
166 // Decode the entire image as one region.
167 kFullImage_Mode,
168 // Splits the image into multiple regions using a divisor and decodes the regions
169 // separately. Also, this test adds a border of a few pixels to each of the regions
170 // that it is decoding. This tests the behavior when a client asks for a region that
171 // does not fully fit in the image.
172 kDivisor_Mode,
173 };
174
msarettd1227a72016-05-18 06:23:57 -0700175 BRDSrc(Path, Mode, CodecSrc::DstColorType, uint32_t);
msaretta5783ae2015-09-08 15:35:32 -0700176
msaretta5783ae2015-09-08 15:35:32 -0700177 Error draw(SkCanvas*) const override;
178 SkISize size() const override;
179 Name name() const override;
180 bool veto(SinkFlags) const override;
181private:
182 Path fPath;
msaretta5783ae2015-09-08 15:35:32 -0700183 Mode fMode;
184 CodecSrc::DstColorType fDstColorType;
185 uint32_t fSampleSize;
186};
scroggo9b77ddd2015-03-19 06:03:39 -0700187
msarett18976312016-03-09 14:20:58 -0800188class ImageGenSrc : public Src {
189public:
190 enum Mode {
191 kCodec_Mode, // Use CodecImageGenerator
192 kPlatform_Mode, // Uses CG or WIC
193 };
194 ImageGenSrc(Path, Mode, SkAlphaType, bool);
195
196 Error draw(SkCanvas*) const override;
197 SkISize size() const override;
198 Name name() const override;
199 bool veto(SinkFlags) const override;
200 bool serial() const override { return fRunSerially; }
201private:
202 Path fPath;
203 Mode fMode;
204 SkAlphaType fDstAlphaType;
205 bool fIsGpu;
206 bool fRunSerially;
207};
208
msarett69deca82016-04-29 09:38:40 -0700209class ColorCodecSrc : public Src {
210public:
211 enum Mode {
212 // Mimic legacy behavior and apply no color correction.
213 kBaseline_Mode,
msarett888dc162016-05-23 10:21:17 -0700214
215 // Color correct images into a specific dst color space. If you happen to have this
216 // monitor, you're in luck! The unmarked outputs of this test should display
217 // correctly on this monitor in the Chrome browser. If not, it's useful to know
218 // that this monitor has a profile that is fairly similar to Adobe RGB.
msarett888dc162016-05-23 10:21:17 -0700219 kDst_HPZR30w_Mode,
msarett9876ac52016-06-01 14:47:18 -0700220
msarettd2809572016-06-20 06:07:45 -0700221 kDst_sRGB_Mode,
msarett69deca82016-04-29 09:38:40 -0700222 };
223
msarett9ce3a542016-07-15 13:54:38 -0700224 ColorCodecSrc(Path, Mode, SkColorType);
msarett69deca82016-04-29 09:38:40 -0700225
226 Error draw(SkCanvas*) const override;
227 SkISize size() const override;
228 Name name() const override;
229 bool veto(SinkFlags) const override;
230private:
231 Path fPath;
232 Mode fMode;
msarett9ce3a542016-07-15 13:54:38 -0700233 SkColorType fColorType;
msarett69deca82016-04-29 09:38:40 -0700234};
235
mtklein748ca3b2015-01-15 10:56:12 -0800236class SKPSrc : public Src {
237public:
mtklein8d17a132015-01-30 11:42:31 -0800238 explicit SKPSrc(Path path);
mtklein748ca3b2015-01-15 10:56:12 -0800239
mtklein36352bf2015-03-25 18:17:31 -0700240 Error draw(SkCanvas*) const override;
241 SkISize size() const override;
242 Name name() const override;
mtklein748ca3b2015-01-15 10:56:12 -0800243private:
mtklein8d17a132015-01-30 11:42:31 -0800244 Path fPath;
mtklein748ca3b2015-01-15 10:56:12 -0800245};
246
fmalitaa2b9fdf2016-08-03 19:53:36 -0700247#if defined(SK_XML)
fmalitabdf3e5c2016-09-17 07:26:26 -0700248} // namespace DM
249
250class SkSVGDOM;
251
252namespace DM {
253
fmalitaa2b9fdf2016-08-03 19:53:36 -0700254class SVGSrc : public Src {
255public:
256 explicit SVGSrc(Path path);
257
258 Error draw(SkCanvas*) const override;
259 SkISize size() const override;
260 Name name() const override;
fmalita179d8852016-08-16 14:23:29 -0700261 bool veto(SinkFlags) const override;
fmalitaa2b9fdf2016-08-03 19:53:36 -0700262
263private:
fmalitabdf3e5c2016-09-17 07:26:26 -0700264 Error ensureDom() const;
265
266 Path fPath;
267 mutable sk_sp<SkSVGDOM> fDom;
268 mutable 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,
306 sk_gpu_test::GrContextFactory::ContextOptions,
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:
bsalomon85b4b532016-04-05 11:06:27 -0700315 sk_gpu_test::GrContextFactory::ContextType fContextType;
316 sk_gpu_test::GrContextFactory::ContextOptions fContextOptions;
bsalomon3724e572016-03-30 18:56:19 -0700317 int fSampleCount;
318 bool fUseDIText;
319 SkColorType fColorType;
brianosmanb109b8c2016-06-16 13:03:24 -0700320 sk_sp<SkColorSpace> fColorSpace;
bsalomon3724e572016-03-30 18:56:19 -0700321 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
halcanary7a76f9c2016-02-03 11:53:18 -0800472class ViaMojo : public Via {
473public:
474 explicit ViaMojo(Sink* sink) : Via(sink) {}
475 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
476};
477
mtklein9c5052f2016-08-06 12:51:51 -0700478class ViaLite : public Via {
479public:
480 explicit ViaLite(Sink* sink) : Via(sink) {}
481 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
482};
483
mtklein748ca3b2015-01-15 10:56:12 -0800484} // namespace DM
485
486#endif//DMSrcSink_DEFINED