blob: 220738b63bced4f6b3423439c1fe1b4ad28aaa48 [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 {
Brian Salomonbd7c5512017-03-07 09:08:36 -050060 enum Type { kNull, kGPU, kVector, kRaster } type;
61 enum Approach { kDirect, kIndirect } approach;
62 enum Multisampled { kNotMultisampled, kMultisampled } multisampled;
63 SinkFlags(Type t, Approach a, Multisampled ms = kNotMultisampled)
64 : type(t), approach(a), multisampled(ms) {}
mtklein99cab4e2015-07-31 06:43:04 -070065};
mtkleine0effd62015-07-29 06:37:28 -070066
mtklein748ca3b2015-01-15 10:56:12 -080067struct Src {
mtklein748ca3b2015-01-15 10:56:12 -080068 virtual ~Src() {}
69 virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0;
70 virtual SkISize size() const = 0;
71 virtual Name name() const = 0;
bsalomon4ee6bd82015-05-27 13:23:23 -070072 virtual void modifyGrContextOptions(GrContextOptions* options) const {}
mtklein99cab4e2015-07-31 06:43:04 -070073 virtual bool veto(SinkFlags) const { return false; }
mtklein21eaf3b2016-02-08 12:39:59 -080074
halcanary45420a92016-06-02 12:41:14 -070075 virtual int pageCount() const { return 1; }
76 virtual Error SK_WARN_UNUSED_RESULT draw(int, SkCanvas* canvas) const {
77 return this->draw(canvas);
78 }
79 virtual SkISize size(int) const { return this->size(); }
mtklein21eaf3b2016-02-08 12:39:59 -080080 // Force Tasks using this Src to run on the main thread?
81 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080082};
83
84struct Sink {
85 virtual ~Sink() {}
mtkleinb9eb4ac2015-02-02 18:26:03 -080086 // You may write to either the bitmap or stream. If you write to log, we'll print that out.
87 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*, SkString* log)
88 const = 0;
mtklein21eaf3b2016-02-08 12:39:59 -080089
90 // Force Tasks using this Sink to run on the main thread?
91 virtual bool serial() const { return false; }
mtklein748ca3b2015-01-15 10:56:12 -080092
93 // File extension for the content draw() outputs, e.g. "png", "pdf".
94 virtual const char* fileExtension() const = 0;
mtklein99cab4e2015-07-31 06:43:04 -070095
96 virtual SinkFlags flags() const = 0;
mtklein748ca3b2015-01-15 10:56:12 -080097};
98
mtklein748ca3b2015-01-15 10:56:12 -080099/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
100
mtklein748ca3b2015-01-15 10:56:12 -0800101class GMSrc : public Src {
102public:
103 explicit GMSrc(skiagm::GMRegistry::Factory);
104
mtklein36352bf2015-03-25 18:17:31 -0700105 Error draw(SkCanvas*) const override;
106 SkISize size() const override;
107 Name name() const override;
bsalomon4ee6bd82015-05-27 13:23:23 -0700108 void modifyGrContextOptions(GrContextOptions* options) const override;
109
mtklein748ca3b2015-01-15 10:56:12 -0800110private:
111 skiagm::GMRegistry::Factory fFactory;
112};
113
scroggo9b77ddd2015-03-19 06:03:39 -0700114class CodecSrc : public Src {
115public:
scroggo9c59ebc2015-03-25 13:48:49 -0700116 enum Mode {
msarett9e707a02015-09-01 14:57:57 -0700117 kCodec_Mode,
msarettbb25b532016-01-13 09:31:39 -0800118 // We choose to test only one mode with zero initialized memory.
119 // This will exercise all of the interesting cases in SkSwizzler
120 // without doubling the size of our test suite.
121 kCodecZeroInit_Mode,
scroggo9c59ebc2015-03-25 13:48:49 -0700122 kScanline_Mode,
msarett0a242972015-06-11 14:27:27 -0700123 kStripe_Mode, // Tests the skipping of scanlines
msarett91c22b22016-02-22 12:27:46 -0800124 kCroppedScanline_Mode, // Tests (jpeg) cropped scanline optimization
scroggob636b452015-07-22 07:16:20 -0700125 kSubset_Mode, // For codecs that support subsets directly.
scroggo19b91532016-10-24 09:03:26 -0700126 kAnimated_Mode, // For codecs that support animation.
scroggo9c59ebc2015-03-25 13:48:49 -0700127 };
msarett438b2ad2015-04-09 12:43:10 -0700128 enum DstColorType {
129 kGetFromCanvas_DstColorType,
130 kIndex8_Always_DstColorType,
131 kGrayscale_Always_DstColorType,
msarett34e0ec42016-04-22 16:27:24 -0700132 kNonNative8888_Always_DstColorType,
msarett438b2ad2015-04-09 12:43:10 -0700133 };
scroggoc5560be2016-02-03 09:42:42 -0800134 CodecSrc(Path, Mode, DstColorType, SkAlphaType, float);
scroggo9b77ddd2015-03-19 06:03:39 -0700135
mtklein36352bf2015-03-25 18:17:31 -0700136 Error draw(SkCanvas*) const override;
137 SkISize size() const override;
138 Name name() const override;
mtklein99cab4e2015-07-31 06:43:04 -0700139 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800140 bool serial() const override { return fRunSerially; }
scroggo9b77ddd2015-03-19 06:03:39 -0700141private:
msarett9e707a02015-09-01 14:57:57 -0700142 Path fPath;
143 Mode fMode;
144 DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800145 SkAlphaType fDstAlphaType;
msarett9e707a02015-09-01 14:57:57 -0700146 float fScale;
scroggo3ac66e92016-02-08 15:09:48 -0800147 bool fRunSerially;
scroggo9b77ddd2015-03-19 06:03:39 -0700148};
149
msarett3d9d7a72015-10-21 10:27:10 -0700150class AndroidCodecSrc : public Src {
151public:
scroggof8dc9df2016-05-16 09:04:13 -0700152 AndroidCodecSrc(Path, CodecSrc::DstColorType, SkAlphaType, int sampleSize);
msarett3d9d7a72015-10-21 10:27:10 -0700153
154 Error draw(SkCanvas*) const override;
155 SkISize size() const override;
156 Name name() const override;
157 bool veto(SinkFlags) const override;
scroggo3ac66e92016-02-08 15:09:48 -0800158 bool serial() const override { return fRunSerially; }
msarett3d9d7a72015-10-21 10:27:10 -0700159private:
160 Path fPath;
msarett3d9d7a72015-10-21 10:27:10 -0700161 CodecSrc::DstColorType fDstColorType;
scroggoc5560be2016-02-03 09:42:42 -0800162 SkAlphaType fDstAlphaType;
msarett3d9d7a72015-10-21 10:27:10 -0700163 int fSampleSize;
scroggo3ac66e92016-02-08 15:09:48 -0800164 bool fRunSerially;
msarett3d9d7a72015-10-21 10:27:10 -0700165};
166
msaretta5783ae2015-09-08 15:35:32 -0700167// Allows for testing of various implementations of Android's BitmapRegionDecoder
168class BRDSrc : public Src {
169public:
170 enum Mode {
171 // Decode the entire image as one region.
172 kFullImage_Mode,
173 // Splits the image into multiple regions using a divisor and decodes the regions
174 // separately. Also, this test adds a border of a few pixels to each of the regions
175 // that it is decoding. This tests the behavior when a client asks for a region that
176 // does not fully fit in the image.
177 kDivisor_Mode,
178 };
179
msarettd1227a72016-05-18 06:23:57 -0700180 BRDSrc(Path, Mode, CodecSrc::DstColorType, uint32_t);
msaretta5783ae2015-09-08 15:35:32 -0700181
msaretta5783ae2015-09-08 15:35:32 -0700182 Error draw(SkCanvas*) const override;
183 SkISize size() const override;
184 Name name() const override;
185 bool veto(SinkFlags) const override;
186private:
187 Path fPath;
msaretta5783ae2015-09-08 15:35:32 -0700188 Mode fMode;
189 CodecSrc::DstColorType fDstColorType;
190 uint32_t fSampleSize;
191};
scroggo9b77ddd2015-03-19 06:03:39 -0700192
msarett18976312016-03-09 14:20:58 -0800193class ImageGenSrc : public Src {
194public:
195 enum Mode {
196 kCodec_Mode, // Use CodecImageGenerator
197 kPlatform_Mode, // Uses CG or WIC
198 };
199 ImageGenSrc(Path, Mode, SkAlphaType, bool);
200
201 Error draw(SkCanvas*) const override;
202 SkISize size() const override;
203 Name name() const override;
204 bool veto(SinkFlags) const override;
205 bool serial() const override { return fRunSerially; }
206private:
207 Path fPath;
208 Mode fMode;
209 SkAlphaType fDstAlphaType;
210 bool fIsGpu;
211 bool fRunSerially;
212};
213
msarett69deca82016-04-29 09:38:40 -0700214class ColorCodecSrc : public Src {
215public:
216 enum Mode {
217 // Mimic legacy behavior and apply no color correction.
218 kBaseline_Mode,
msarett888dc162016-05-23 10:21:17 -0700219
220 // Color correct images into a specific dst color space. If you happen to have this
221 // monitor, you're in luck! The unmarked outputs of this test should display
222 // correctly on this monitor in the Chrome browser. If not, it's useful to know
223 // that this monitor has a profile that is fairly similar to Adobe RGB.
msarett888dc162016-05-23 10:21:17 -0700224 kDst_HPZR30w_Mode,
msarett9876ac52016-06-01 14:47:18 -0700225
msarettd2809572016-06-20 06:07:45 -0700226 kDst_sRGB_Mode,
msarett69deca82016-04-29 09:38:40 -0700227 };
228
msarett9ce3a542016-07-15 13:54:38 -0700229 ColorCodecSrc(Path, Mode, SkColorType);
msarett69deca82016-04-29 09:38:40 -0700230
231 Error draw(SkCanvas*) const override;
232 SkISize size() const override;
233 Name name() const override;
234 bool veto(SinkFlags) const override;
235private:
236 Path fPath;
237 Mode fMode;
msarett9ce3a542016-07-15 13:54:38 -0700238 SkColorType fColorType;
msarett69deca82016-04-29 09:38:40 -0700239};
240
mtklein748ca3b2015-01-15 10:56:12 -0800241class SKPSrc : public Src {
242public:
mtklein8d17a132015-01-30 11:42:31 -0800243 explicit SKPSrc(Path path);
mtklein748ca3b2015-01-15 10:56:12 -0800244
mtklein36352bf2015-03-25 18:17:31 -0700245 Error draw(SkCanvas*) const override;
246 SkISize size() const override;
247 Name name() const override;
mtklein748ca3b2015-01-15 10:56:12 -0800248private:
mtklein8d17a132015-01-30 11:42:31 -0800249 Path fPath;
mtklein748ca3b2015-01-15 10:56:12 -0800250};
251
fmalitaa2b9fdf2016-08-03 19:53:36 -0700252#if defined(SK_XML)
fmalitabdf3e5c2016-09-17 07:26:26 -0700253} // namespace DM
254
255class SkSVGDOM;
256
257namespace DM {
258
fmalitaa2b9fdf2016-08-03 19:53:36 -0700259class SVGSrc : public Src {
260public:
261 explicit SVGSrc(Path path);
262
263 Error draw(SkCanvas*) const override;
264 SkISize size() const override;
265 Name name() const override;
fmalita179d8852016-08-16 14:23:29 -0700266 bool veto(SinkFlags) const override;
fmalitaa2b9fdf2016-08-03 19:53:36 -0700267
268private:
fmalitaacd2f5c2016-11-08 07:13:45 -0800269 Name fName;
270 sk_sp<SkSVGDOM> fDom;
271 SkScalar fScale;
fmalitaa2b9fdf2016-08-03 19:53:36 -0700272
273 typedef Src INHERITED;
274};
275#endif // SK_XML
mtklein748ca3b2015-01-15 10:56:12 -0800276/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
277
halcanary45420a92016-06-02 12:41:14 -0700278class MSKPSrc : public Src {
279public:
280 explicit MSKPSrc(Path path);
281
282 int pageCount() const override;
283 Error draw(SkCanvas* c) const override;
284 Error draw(int, SkCanvas*) const override;
285 SkISize size() const override;
286 SkISize size(int) const override;
287 Name name() const override;
288
289private:
290 Path fPath;
291 SkMultiPictureDocumentReader fReader;
292};
293
294/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
295
mtkleinad66f9b2015-02-13 15:11:10 -0800296class NullSink : public Sink {
297public:
298 NullSink() {}
299
mtklein36352bf2015-03-25 18:17:31 -0700300 Error draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700301 const char* fileExtension() const override { return ""; }
mtklein99cab4e2015-07-31 06:43:04 -0700302 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kNull, SinkFlags::kDirect }; }
mtkleinad66f9b2015-02-13 15:11:10 -0800303};
304
305
mtklein748ca3b2015-01-15 10:56:12 -0800306class GPUSink : public Sink {
307public:
bsalomon85b4b532016-04-05 11:06:27 -0700308 GPUSink(sk_gpu_test::GrContextFactory::ContextType,
csmartdaltone812d492017-02-21 12:36:05 -0700309 sk_gpu_test::GrContextFactory::ContextOverrides,
brianosmanb109b8c2016-06-16 13:03:24 -0700310 int samples, bool diText, SkColorType colorType, sk_sp<SkColorSpace> colorSpace,
brianosmand93c1202016-03-10 07:49:08 -0800311 bool threaded);
mtklein748ca3b2015-01-15 10:56:12 -0800312
mtklein36352bf2015-03-25 18:17:31 -0700313 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein21eaf3b2016-02-08 12:39:59 -0800314 bool serial() const override { return !fThreaded; }
mtklein36352bf2015-03-25 18:17:31 -0700315 const char* fileExtension() const override { return "png"; }
Brian Salomonbd7c5512017-03-07 09:08:36 -0500316 SinkFlags flags() const override {
317 return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect, SinkFlags::kMultisampled };
318 }
mtklein748ca3b2015-01-15 10:56:12 -0800319private:
csmartdaltone812d492017-02-21 12:36:05 -0700320 sk_gpu_test::GrContextFactory::ContextType fContextType;
321 sk_gpu_test::GrContextFactory::ContextOverrides fContextOverrides;
322 int fSampleCount;
323 bool fUseDIText;
324 SkColorType fColorType;
325 sk_sp<SkColorSpace> fColorSpace;
326 bool fThreaded;
mtklein748ca3b2015-01-15 10:56:12 -0800327};
328
329class PDFSink : public Sink {
330public:
halcanary4b656662016-04-27 07:45:18 -0700331 PDFSink(bool pdfa = false) : fPDFA(pdfa) {}
mtklein36352bf2015-03-25 18:17:31 -0700332 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700333 const char* fileExtension() const override { return "pdf"; }
mtklein99cab4e2015-07-31 06:43:04 -0700334 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
halcanary4b656662016-04-27 07:45:18 -0700335 bool fPDFA;
mtklein748ca3b2015-01-15 10:56:12 -0800336};
337
halcanary47ef4d52015-03-03 09:13:09 -0800338class XPSSink : public Sink {
339public:
340 XPSSink();
341
mtklein36352bf2015-03-25 18:17:31 -0700342 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700343 const char* fileExtension() const override { return "xps"; }
mtklein99cab4e2015-07-31 06:43:04 -0700344 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
halcanary47ef4d52015-03-03 09:13:09 -0800345};
346
reed54dc4872016-09-13 08:09:45 -0700347class PipeSink : public Sink {
348public:
349 PipeSink();
350
351 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
352 const char* fileExtension() const override { return "skpipe"; }
353 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
354};
355
mtklein748ca3b2015-01-15 10:56:12 -0800356class RasterSink : public Sink {
357public:
brianosmanb109b8c2016-06-16 13:03:24 -0700358 explicit RasterSink(SkColorType, sk_sp<SkColorSpace> = nullptr);
mtklein748ca3b2015-01-15 10:56:12 -0800359
mtklein36352bf2015-03-25 18:17:31 -0700360 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700361 const char* fileExtension() const override { return "png"; }
mtklein99cab4e2015-07-31 06:43:04 -0700362 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; }
mtklein748ca3b2015-01-15 10:56:12 -0800363private:
brianosmanb109b8c2016-06-16 13:03:24 -0700364 SkColorType fColorType;
365 sk_sp<SkColorSpace> fColorSpace;
mtklein748ca3b2015-01-15 10:56:12 -0800366};
367
mtklein9c3f17d2015-01-28 11:35:18 -0800368class SKPSink : public Sink {
369public:
370 SKPSink();
371
mtklein36352bf2015-03-25 18:17:31 -0700372 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700373 const char* fileExtension() const override { return "skp"; }
mtklein99cab4e2015-07-31 06:43:04 -0700374 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
mtklein9c3f17d2015-01-28 11:35:18 -0800375};
376
Hal Canary85c7fe82016-10-25 10:33:27 -0400377class DebugSink : public Sink {
378public:
379 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
380 const char* fileExtension() const override { return "json"; }
381 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
382};
383
mtklein8a4527e2015-01-31 20:00:58 -0800384class SVGSink : public Sink {
385public:
386 SVGSink();
387
mtklein36352bf2015-03-25 18:17:31 -0700388 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein36352bf2015-03-25 18:17:31 -0700389 const char* fileExtension() const override { return "svg"; }
mtklein99cab4e2015-07-31 06:43:04 -0700390 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
mtklein8a4527e2015-01-31 20:00:58 -0800391};
392
393
mtklein748ca3b2015-01-15 10:56:12 -0800394/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
395
mtklein78829242015-05-06 07:54:07 -0700396class Via : public Sink {
397public:
msarett62d3b102015-12-10 15:14:27 -0800398 explicit Via(Sink* sink) : fSink(sink) {}
mtklein78829242015-05-06 07:54:07 -0700399 const char* fileExtension() const override { return fSink->fileExtension(); }
mtklein21eaf3b2016-02-08 12:39:59 -0800400 bool serial() const override { return fSink->serial(); }
mtklein99cab4e2015-07-31 06:43:04 -0700401 SinkFlags flags() const override {
402 SinkFlags flags = fSink->flags();
403 flags.approach = SinkFlags::kIndirect;
404 return flags;
405 }
mtklein78829242015-05-06 07:54:07 -0700406protected:
Ben Wagner145dbcd2016-11-03 14:40:50 -0400407 std::unique_ptr<Sink> fSink;
mtklein78829242015-05-06 07:54:07 -0700408};
409
410class ViaMatrix : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800411public:
msarett62d3b102015-12-10 15:14:27 -0800412 ViaMatrix(SkMatrix, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700413 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800414private:
mtklein78829242015-05-06 07:54:07 -0700415 const SkMatrix fMatrix;
mtklein748ca3b2015-01-15 10:56:12 -0800416};
417
mtklein78829242015-05-06 07:54:07 -0700418class ViaUpright : public Via {
mtkleind603b222015-02-17 11:13:33 -0800419public:
msarett62d3b102015-12-10 15:14:27 -0800420 ViaUpright(SkMatrix, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700421 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleind603b222015-02-17 11:13:33 -0800422private:
mtklein78829242015-05-06 07:54:07 -0700423 const SkMatrix fMatrix;
mtkleind603b222015-02-17 11:13:33 -0800424};
425
mtklein78829242015-05-06 07:54:07 -0700426class ViaSerialization : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800427public:
msarett62d3b102015-12-10 15:14:27 -0800428 explicit ViaSerialization(Sink* sink) : Via(sink) {}
mtklein36352bf2015-03-25 18:17:31 -0700429 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800430};
431
mtklein4a34ecb2016-01-08 10:19:35 -0800432class ViaPicture : public Via {
433public:
434 explicit ViaPicture(Sink* sink) : Via(sink) {}
435 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
436};
437
reed54dc4872016-09-13 08:09:45 -0700438class ViaPipe : public Via {
439public:
440 explicit ViaPipe(Sink* sink) : Via(sink) {}
441 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
442};
443
reedbabc3de2016-07-08 08:43:27 -0700444class ViaDefer : public Via {
445public:
446 explicit ViaDefer(Sink* sink) : Via(sink) {}
447 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
448};
449
mtklein78829242015-05-06 07:54:07 -0700450class ViaTiles : public Via {
mtklein748ca3b2015-01-15 10:56:12 -0800451public:
msarett62d3b102015-12-10 15:14:27 -0800452 ViaTiles(int w, int h, SkBBHFactory*, Sink*);
mtklein36352bf2015-03-25 18:17:31 -0700453 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtklein748ca3b2015-01-15 10:56:12 -0800454private:
455 const int fW, fH;
Ben Wagner145dbcd2016-11-03 14:40:50 -0400456 std::unique_ptr<SkBBHFactory> fFactory;
mtklein748ca3b2015-01-15 10:56:12 -0800457};
458
mtklein78829242015-05-06 07:54:07 -0700459class ViaSecondPicture : public Via {
mtkleinb7e8d692015-04-07 08:30:32 -0700460public:
msarett62d3b102015-12-10 15:14:27 -0800461 explicit ViaSecondPicture(Sink* sink) : Via(sink) {}
mtkleinb7e8d692015-04-07 08:30:32 -0700462 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleinb7e8d692015-04-07 08:30:32 -0700463};
464
mtklein78829242015-05-06 07:54:07 -0700465class ViaSingletonPictures : public Via {
mtkleind31c13d2015-05-05 12:59:56 -0700466public:
msarett62d3b102015-12-10 15:14:27 -0800467 explicit ViaSingletonPictures(Sink* sink) : Via(sink) {}
mtkleind31c13d2015-05-05 12:59:56 -0700468 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
mtkleind31c13d2015-05-05 12:59:56 -0700469};
470
mtklein6fbf4b32015-05-06 11:35:40 -0700471class ViaTwice : public Via {
472public:
msarett62d3b102015-12-10 15:14:27 -0800473 explicit ViaTwice(Sink* sink) : Via(sink) {}
mtklein6fbf4b32015-05-06 11:35:40 -0700474 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
475};
476
Mike Reedf67c4592017-02-17 17:06:11 -0500477class ViaSVG : public Via {
478public:
479 explicit ViaSVG(Sink* sink) : Via(sink) {}
480 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
481};
482
halcanary7a76f9c2016-02-03 11:53:18 -0800483class ViaMojo : public Via {
484public:
485 explicit ViaMojo(Sink* sink) : Via(sink) {}
486 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
487};
488
mtklein9c5052f2016-08-06 12:51:51 -0700489class ViaLite : public Via {
490public:
491 explicit ViaLite(Sink* sink) : Via(sink) {}
492 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
493};
494
mtklein748ca3b2015-01-15 10:56:12 -0800495} // namespace DM
496
497#endif//DMSrcSink_DEFINED