scroggo | 478652e | 2015-03-25 07:11:02 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 8 | #ifndef DMSrcSink_DEFINED |
| 9 | #define DMSrcSink_DEFINED |
| 10 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 11 | #include "SkBBHFactory.h" |
| 12 | #include "SkBBoxHierarchy.h" |
| 13 | #include "SkBitmap.h" |
msarett | 5cb4885 | 2015-11-06 08:56:32 -0800 | [diff] [blame] | 14 | #include "SkBitmapRegionDecoder.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 15 | #include "SkCanvas.h" |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 16 | #include "SkCommonFlagsConfig.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 17 | #include "SkData.h" |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 18 | #include "SkMultiPictureDocument.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 19 | #include "SkPicture.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 20 | #include "gm.h" |
| 21 | |
Mike Reed | bae888e | 2017-02-18 16:50:45 -0500 | [diff] [blame] | 22 | //#define TEST_VIA_SVG |
| 23 | |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 24 | namespace skottie { class Animation; } |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 25 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 26 | namespace DM { |
| 27 | |
| 28 | // This is just convenience. It lets you use either return "foo" or return SkStringPrintf(...). |
| 29 | struct ImplicitString : public SkString { |
| 30 | template <typename T> |
| 31 | ImplicitString(const T& s) : SkString(s) {} |
msarett | 9e707a0 | 2015-09-01 14:57:57 -0700 | [diff] [blame] | 32 | ImplicitString() : SkString("") {} |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 33 | }; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 34 | typedef ImplicitString Name; |
mtklein | 8d17a13 | 2015-01-30 11:42:31 -0800 | [diff] [blame] | 35 | typedef ImplicitString Path; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 36 | |
mtklein | 4089ef7 | 2015-03-05 08:40:28 -0800 | [diff] [blame] | 37 | class Error { |
| 38 | public: |
| 39 | Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {} |
| 40 | Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {} |
| 41 | |
| 42 | Error(const Error&) = default; |
| 43 | Error& operator=(const Error&) = default; |
| 44 | |
| 45 | static Error Nonfatal(const SkString& s) { return Nonfatal(s.c_str()); } |
| 46 | static Error Nonfatal(const char* s) { |
| 47 | Error e(s); |
| 48 | e.fFatal = false; |
| 49 | return e; |
| 50 | } |
| 51 | |
| 52 | const char* c_str() const { return fMsg.c_str(); } |
| 53 | bool isEmpty() const { return fMsg.isEmpty(); } |
| 54 | bool isFatal() const { return fFatal; } |
| 55 | |
| 56 | private: |
| 57 | SkString fMsg; |
| 58 | bool fFatal; |
| 59 | }; |
| 60 | |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 61 | struct SinkFlags { |
Brian Salomon | bd7c551 | 2017-03-07 09:08:36 -0500 | [diff] [blame] | 62 | enum Type { kNull, kGPU, kVector, kRaster } type; |
| 63 | enum Approach { kDirect, kIndirect } approach; |
| 64 | enum Multisampled { kNotMultisampled, kMultisampled } multisampled; |
| 65 | SinkFlags(Type t, Approach a, Multisampled ms = kNotMultisampled) |
| 66 | : type(t), approach(a), multisampled(ms) {} |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 67 | }; |
mtklein | e0effd6 | 2015-07-29 06:37:28 -0700 | [diff] [blame] | 68 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 69 | struct Src { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 70 | virtual ~Src() {} |
| 71 | virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0; |
| 72 | virtual SkISize size() const = 0; |
| 73 | virtual Name name() const = 0; |
bsalomon | 4ee6bd8 | 2015-05-27 13:23:23 -0700 | [diff] [blame] | 74 | virtual void modifyGrContextOptions(GrContextOptions* options) const {} |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 75 | virtual bool veto(SinkFlags) const { return false; } |
mtklein | 21eaf3b | 2016-02-08 12:39:59 -0800 | [diff] [blame] | 76 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 77 | virtual int pageCount() const { return 1; } |
| 78 | virtual Error SK_WARN_UNUSED_RESULT draw(int, SkCanvas* canvas) const { |
| 79 | return this->draw(canvas); |
| 80 | } |
| 81 | virtual SkISize size(int) const { return this->size(); } |
mtklein | 21eaf3b | 2016-02-08 12:39:59 -0800 | [diff] [blame] | 82 | // Force Tasks using this Src to run on the main thread? |
| 83 | virtual bool serial() const { return false; } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | struct Sink { |
| 87 | virtual ~Sink() {} |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 88 | // You may write to either the bitmap or stream. If you write to log, we'll print that out. |
| 89 | virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*, SkString* log) |
| 90 | const = 0; |
mtklein | 21eaf3b | 2016-02-08 12:39:59 -0800 | [diff] [blame] | 91 | |
| 92 | // Force Tasks using this Sink to run on the main thread? |
| 93 | virtual bool serial() const { return false; } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 94 | |
| 95 | // File extension for the content draw() outputs, e.g. "png", "pdf". |
| 96 | virtual const char* fileExtension() const = 0; |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 97 | |
| 98 | virtual SinkFlags flags() const = 0; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 99 | }; |
| 100 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 101 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 102 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 103 | class GMSrc : public Src { |
| 104 | public: |
| 105 | explicit GMSrc(skiagm::GMRegistry::Factory); |
| 106 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 107 | Error draw(SkCanvas*) const override; |
| 108 | SkISize size() const override; |
| 109 | Name name() const override; |
bsalomon | 4ee6bd8 | 2015-05-27 13:23:23 -0700 | [diff] [blame] | 110 | void modifyGrContextOptions(GrContextOptions* options) const override; |
| 111 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 112 | private: |
| 113 | skiagm::GMRegistry::Factory fFactory; |
| 114 | }; |
| 115 | |
scroggo | 9b77ddd | 2015-03-19 06:03:39 -0700 | [diff] [blame] | 116 | class CodecSrc : public Src { |
| 117 | public: |
scroggo | 9c59ebc | 2015-03-25 13:48:49 -0700 | [diff] [blame] | 118 | enum Mode { |
msarett | 9e707a0 | 2015-09-01 14:57:57 -0700 | [diff] [blame] | 119 | kCodec_Mode, |
msarett | bb25b53 | 2016-01-13 09:31:39 -0800 | [diff] [blame] | 120 | // We choose to test only one mode with zero initialized memory. |
| 121 | // This will exercise all of the interesting cases in SkSwizzler |
| 122 | // without doubling the size of our test suite. |
| 123 | kCodecZeroInit_Mode, |
scroggo | 9c59ebc | 2015-03-25 13:48:49 -0700 | [diff] [blame] | 124 | kScanline_Mode, |
msarett | 0a24297 | 2015-06-11 14:27:27 -0700 | [diff] [blame] | 125 | kStripe_Mode, // Tests the skipping of scanlines |
msarett | 91c22b2 | 2016-02-22 12:27:46 -0800 | [diff] [blame] | 126 | kCroppedScanline_Mode, // Tests (jpeg) cropped scanline optimization |
scroggo | b636b45 | 2015-07-22 07:16:20 -0700 | [diff] [blame] | 127 | kSubset_Mode, // For codecs that support subsets directly. |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 128 | kAnimated_Mode, // For codecs that support animation. |
scroggo | 9c59ebc | 2015-03-25 13:48:49 -0700 | [diff] [blame] | 129 | }; |
msarett | 438b2ad | 2015-04-09 12:43:10 -0700 | [diff] [blame] | 130 | enum DstColorType { |
| 131 | kGetFromCanvas_DstColorType, |
msarett | 438b2ad | 2015-04-09 12:43:10 -0700 | [diff] [blame] | 132 | kGrayscale_Always_DstColorType, |
msarett | 34e0ec4 | 2016-04-22 16:27:24 -0700 | [diff] [blame] | 133 | kNonNative8888_Always_DstColorType, |
msarett | 438b2ad | 2015-04-09 12:43:10 -0700 | [diff] [blame] | 134 | }; |
scroggo | c5560be | 2016-02-03 09:42:42 -0800 | [diff] [blame] | 135 | CodecSrc(Path, Mode, DstColorType, SkAlphaType, float); |
scroggo | 9b77ddd | 2015-03-19 06:03:39 -0700 | [diff] [blame] | 136 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 137 | Error draw(SkCanvas*) const override; |
| 138 | SkISize size() const override; |
| 139 | Name name() const override; |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 140 | bool veto(SinkFlags) const override; |
scroggo | 3ac66e9 | 2016-02-08 15:09:48 -0800 | [diff] [blame] | 141 | bool serial() const override { return fRunSerially; } |
scroggo | 9b77ddd | 2015-03-19 06:03:39 -0700 | [diff] [blame] | 142 | private: |
msarett | 9e707a0 | 2015-09-01 14:57:57 -0700 | [diff] [blame] | 143 | Path fPath; |
| 144 | Mode fMode; |
| 145 | DstColorType fDstColorType; |
scroggo | c5560be | 2016-02-03 09:42:42 -0800 | [diff] [blame] | 146 | SkAlphaType fDstAlphaType; |
msarett | 9e707a0 | 2015-09-01 14:57:57 -0700 | [diff] [blame] | 147 | float fScale; |
scroggo | 3ac66e9 | 2016-02-08 15:09:48 -0800 | [diff] [blame] | 148 | bool fRunSerially; |
scroggo | 9b77ddd | 2015-03-19 06:03:39 -0700 | [diff] [blame] | 149 | }; |
| 150 | |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 151 | class AndroidCodecSrc : public Src { |
| 152 | public: |
scroggo | f8dc9df | 2016-05-16 09:04:13 -0700 | [diff] [blame] | 153 | AndroidCodecSrc(Path, CodecSrc::DstColorType, SkAlphaType, int sampleSize); |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 154 | |
| 155 | Error draw(SkCanvas*) const override; |
| 156 | SkISize size() const override; |
| 157 | Name name() const override; |
| 158 | bool veto(SinkFlags) const override; |
scroggo | 3ac66e9 | 2016-02-08 15:09:48 -0800 | [diff] [blame] | 159 | bool serial() const override { return fRunSerially; } |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 160 | private: |
| 161 | Path fPath; |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 162 | CodecSrc::DstColorType fDstColorType; |
scroggo | c5560be | 2016-02-03 09:42:42 -0800 | [diff] [blame] | 163 | SkAlphaType fDstAlphaType; |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 164 | int fSampleSize; |
scroggo | 3ac66e9 | 2016-02-08 15:09:48 -0800 | [diff] [blame] | 165 | bool fRunSerially; |
msarett | 3d9d7a7 | 2015-10-21 10:27:10 -0700 | [diff] [blame] | 166 | }; |
| 167 | |
msarett | a5783ae | 2015-09-08 15:35:32 -0700 | [diff] [blame] | 168 | // Allows for testing of various implementations of Android's BitmapRegionDecoder |
| 169 | class BRDSrc : public Src { |
| 170 | public: |
| 171 | enum Mode { |
| 172 | // Decode the entire image as one region. |
| 173 | kFullImage_Mode, |
| 174 | // Splits the image into multiple regions using a divisor and decodes the regions |
| 175 | // separately. Also, this test adds a border of a few pixels to each of the regions |
| 176 | // that it is decoding. This tests the behavior when a client asks for a region that |
| 177 | // does not fully fit in the image. |
| 178 | kDivisor_Mode, |
| 179 | }; |
| 180 | |
msarett | d1227a7 | 2016-05-18 06:23:57 -0700 | [diff] [blame] | 181 | BRDSrc(Path, Mode, CodecSrc::DstColorType, uint32_t); |
msarett | a5783ae | 2015-09-08 15:35:32 -0700 | [diff] [blame] | 182 | |
msarett | a5783ae | 2015-09-08 15:35:32 -0700 | [diff] [blame] | 183 | Error draw(SkCanvas*) const override; |
| 184 | SkISize size() const override; |
| 185 | Name name() const override; |
| 186 | bool veto(SinkFlags) const override; |
| 187 | private: |
| 188 | Path fPath; |
msarett | a5783ae | 2015-09-08 15:35:32 -0700 | [diff] [blame] | 189 | Mode fMode; |
| 190 | CodecSrc::DstColorType fDstColorType; |
| 191 | uint32_t fSampleSize; |
| 192 | }; |
scroggo | 9b77ddd | 2015-03-19 06:03:39 -0700 | [diff] [blame] | 193 | |
msarett | 1897631 | 2016-03-09 14:20:58 -0800 | [diff] [blame] | 194 | class ImageGenSrc : public Src { |
| 195 | public: |
| 196 | enum Mode { |
| 197 | kCodec_Mode, // Use CodecImageGenerator |
| 198 | kPlatform_Mode, // Uses CG or WIC |
| 199 | }; |
| 200 | ImageGenSrc(Path, Mode, SkAlphaType, bool); |
| 201 | |
| 202 | Error draw(SkCanvas*) const override; |
| 203 | SkISize size() const override; |
| 204 | Name name() const override; |
| 205 | bool veto(SinkFlags) const override; |
| 206 | bool serial() const override { return fRunSerially; } |
| 207 | private: |
| 208 | Path fPath; |
| 209 | Mode fMode; |
| 210 | SkAlphaType fDstAlphaType; |
| 211 | bool fIsGpu; |
| 212 | bool fRunSerially; |
| 213 | }; |
| 214 | |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 215 | class ColorCodecSrc : public Src { |
| 216 | public: |
| 217 | enum Mode { |
| 218 | // Mimic legacy behavior and apply no color correction. |
| 219 | kBaseline_Mode, |
msarett | 888dc16 | 2016-05-23 10:21:17 -0700 | [diff] [blame] | 220 | |
| 221 | // Color correct images into a specific dst color space. If you happen to have this |
| 222 | // monitor, you're in luck! The unmarked outputs of this test should display |
| 223 | // correctly on this monitor in the Chrome browser. If not, it's useful to know |
| 224 | // that this monitor has a profile that is fairly similar to Adobe RGB. |
msarett | 888dc16 | 2016-05-23 10:21:17 -0700 | [diff] [blame] | 225 | kDst_HPZR30w_Mode, |
msarett | 9876ac5 | 2016-06-01 14:47:18 -0700 | [diff] [blame] | 226 | |
msarett | d280957 | 2016-06-20 06:07:45 -0700 | [diff] [blame] | 227 | kDst_sRGB_Mode, |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 228 | }; |
| 229 | |
msarett | 9ce3a54 | 2016-07-15 13:54:38 -0700 | [diff] [blame] | 230 | ColorCodecSrc(Path, Mode, SkColorType); |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 231 | |
| 232 | Error draw(SkCanvas*) const override; |
| 233 | SkISize size() const override; |
| 234 | Name name() const override; |
| 235 | bool veto(SinkFlags) const override; |
| 236 | private: |
| 237 | Path fPath; |
| 238 | Mode fMode; |
msarett | 9ce3a54 | 2016-07-15 13:54:38 -0700 | [diff] [blame] | 239 | SkColorType fColorType; |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 240 | }; |
| 241 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 242 | class SKPSrc : public Src { |
| 243 | public: |
mtklein | 8d17a13 | 2015-01-30 11:42:31 -0800 | [diff] [blame] | 244 | explicit SKPSrc(Path path); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 245 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 246 | Error draw(SkCanvas*) const override; |
| 247 | SkISize size() const override; |
| 248 | Name name() const override; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 249 | private: |
mtklein | 8d17a13 | 2015-01-30 11:42:31 -0800 | [diff] [blame] | 250 | Path fPath; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 251 | }; |
| 252 | |
Robert Phillips | ad8a43f | 2017-08-30 12:06:35 -0400 | [diff] [blame] | 253 | |
Florin Malita | 87ccf33 | 2018-05-04 12:23:24 -0400 | [diff] [blame] | 254 | #if defined(SK_ENABLE_SKOTTIE) |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 255 | class SkottieSrc final : public Src { |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 256 | public: |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 257 | explicit SkottieSrc(Path path); |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 258 | |
| 259 | Error draw(SkCanvas*) const override; |
| 260 | SkISize size() const override; |
| 261 | Name name() const override; |
| 262 | bool veto(SinkFlags) const override; |
| 263 | |
| 264 | private: |
| 265 | // Generates a kTileCount x kTileCount filmstrip with evenly distributed frames. |
Florin Malita | 1022f74 | 2018-02-23 11:10:22 -0500 | [diff] [blame] | 266 | static constexpr int kTileCount = 5; |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 267 | |
Florin Malita | 1022f74 | 2018-02-23 11:10:22 -0500 | [diff] [blame] | 268 | Name fName; |
| 269 | SkISize fTileSize = SkISize::MakeEmpty(); |
| 270 | sk_sp<skottie::Animation> fAnimation; |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 271 | }; |
Florin Malita | 124d5af | 2017-12-31 17:02:26 -0500 | [diff] [blame] | 272 | #endif |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 273 | |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 274 | #if defined(SK_XML) |
fmalita | bdf3e5c | 2016-09-17 07:26:26 -0700 | [diff] [blame] | 275 | } // namespace DM |
| 276 | |
| 277 | class SkSVGDOM; |
| 278 | |
| 279 | namespace DM { |
| 280 | |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 281 | class SVGSrc : public Src { |
| 282 | public: |
| 283 | explicit SVGSrc(Path path); |
| 284 | |
| 285 | Error draw(SkCanvas*) const override; |
| 286 | SkISize size() const override; |
| 287 | Name name() const override; |
fmalita | 179d885 | 2016-08-16 14:23:29 -0700 | [diff] [blame] | 288 | bool veto(SinkFlags) const override; |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 289 | |
| 290 | private: |
fmalita | acd2f5c | 2016-11-08 07:13:45 -0800 | [diff] [blame] | 291 | Name fName; |
| 292 | sk_sp<SkSVGDOM> fDom; |
| 293 | SkScalar fScale; |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 294 | |
| 295 | typedef Src INHERITED; |
| 296 | }; |
| 297 | #endif // SK_XML |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 298 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 299 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 300 | class MSKPSrc : public Src { |
| 301 | public: |
| 302 | explicit MSKPSrc(Path path); |
| 303 | |
| 304 | int pageCount() const override; |
| 305 | Error draw(SkCanvas* c) const override; |
| 306 | Error draw(int, SkCanvas*) const override; |
| 307 | SkISize size() const override; |
| 308 | SkISize size(int) const override; |
| 309 | Name name() const override; |
| 310 | |
| 311 | private: |
| 312 | Path fPath; |
Hal Canary | 45cde31 | 2017-04-03 16:06:42 -0400 | [diff] [blame] | 313 | mutable SkTArray<SkDocumentPage> fPages; |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 317 | |
mtklein | ad66f9b | 2015-02-13 15:11:10 -0800 | [diff] [blame] | 318 | class NullSink : public Sink { |
| 319 | public: |
| 320 | NullSink() {} |
| 321 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 322 | Error draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 323 | const char* fileExtension() const override { return ""; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 324 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kNull, SinkFlags::kDirect }; } |
mtklein | ad66f9b | 2015-02-13 15:11:10 -0800 | [diff] [blame] | 325 | }; |
| 326 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 327 | class GPUSink : public Sink { |
| 328 | public: |
bsalomon | 85b4b53 | 2016-04-05 11:06:27 -0700 | [diff] [blame] | 329 | GPUSink(sk_gpu_test::GrContextFactory::ContextType, |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 330 | sk_gpu_test::GrContextFactory::ContextOverrides, |
| 331 | SkCommandLineConfigGpu::SurfType surfType, int samples, bool diText, |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 332 | SkColorType colorType, SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace, |
Brian Osman | f21aa04 | 2017-08-21 16:48:46 -0400 | [diff] [blame] | 333 | bool threaded, const GrContextOptions& grCtxOptions); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 334 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 335 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 336 | Error onDraw(const Src&, SkBitmap*, SkWStream*, SkString*, |
| 337 | const GrContextOptions& baseOptions) const; |
| 338 | |
Brian Salomon | b07fd4d | 2018-03-09 13:17:30 -0500 | [diff] [blame] | 339 | sk_gpu_test::GrContextFactory::ContextType contextType() const { return fContextType; } |
| 340 | const sk_gpu_test::GrContextFactory::ContextOverrides& contextOverrides() { |
| 341 | return fContextOverrides; |
| 342 | } |
| 343 | SkCommandLineConfigGpu::SurfType surfType() const { return fSurfType; } |
| 344 | bool useDIText() const { return fUseDIText; } |
mtklein | 21eaf3b | 2016-02-08 12:39:59 -0800 | [diff] [blame] | 345 | bool serial() const override { return !fThreaded; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 346 | const char* fileExtension() const override { return "png"; } |
Brian Salomon | bd7c551 | 2017-03-07 09:08:36 -0500 | [diff] [blame] | 347 | SinkFlags flags() const override { |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 348 | SinkFlags::Multisampled ms = fSampleCount > 1 ? SinkFlags::kMultisampled |
Brian Salomon | fd171ed | 2017-03-08 11:38:45 -0500 | [diff] [blame] | 349 | : SinkFlags::kNotMultisampled; |
| 350 | return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect, ms }; |
Brian Salomon | bd7c551 | 2017-03-07 09:08:36 -0500 | [diff] [blame] | 351 | } |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 352 | const GrContextOptions& baseContextOptions() const { return fBaseContextOptions; } |
| 353 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 354 | private: |
csmartdalton | e812d49 | 2017-02-21 12:36:05 -0700 | [diff] [blame] | 355 | sk_gpu_test::GrContextFactory::ContextType fContextType; |
| 356 | sk_gpu_test::GrContextFactory::ContextOverrides fContextOverrides; |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 357 | SkCommandLineConfigGpu::SurfType fSurfType; |
csmartdalton | e812d49 | 2017-02-21 12:36:05 -0700 | [diff] [blame] | 358 | int fSampleCount; |
| 359 | bool fUseDIText; |
| 360 | SkColorType fColorType; |
Brian Salomon | ce5ee60 | 2017-07-17 11:31:31 -0400 | [diff] [blame] | 361 | SkAlphaType fAlphaType; |
csmartdalton | e812d49 | 2017-02-21 12:36:05 -0700 | [diff] [blame] | 362 | sk_sp<SkColorSpace> fColorSpace; |
| 363 | bool fThreaded; |
Brian Osman | f21aa04 | 2017-08-21 16:48:46 -0400 | [diff] [blame] | 364 | GrContextOptions fBaseContextOptions; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 365 | }; |
| 366 | |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 367 | class GPUThreadTestingSink : public GPUSink { |
| 368 | public: |
| 369 | GPUThreadTestingSink(sk_gpu_test::GrContextFactory::ContextType, |
Brian Salomon | f865b05 | 2018-03-09 09:01:53 -0500 | [diff] [blame] | 370 | sk_gpu_test::GrContextFactory::ContextOverrides, |
| 371 | SkCommandLineConfigGpu::SurfType surfType, int samples, bool diText, |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 372 | SkColorType colorType, SkAlphaType alphaType, |
| 373 | sk_sp<SkColorSpace> colorSpace, bool threaded, |
| 374 | const GrContextOptions& grCtxOptions); |
| 375 | |
| 376 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 377 | |
Brian Osman | f1942de | 2017-08-30 14:50:22 -0400 | [diff] [blame] | 378 | const char* fileExtension() const override { |
| 379 | // Suppress writing out results from this config - we just want to do our matching test |
| 380 | return nullptr; |
| 381 | } |
| 382 | |
Brian Osman | f981066 | 2017-08-30 10:02:10 -0400 | [diff] [blame] | 383 | private: |
| 384 | std::unique_ptr<SkExecutor> fExecutor; |
| 385 | |
| 386 | typedef GPUSink INHERITED; |
| 387 | }; |
| 388 | |
Brian Salomon | 00a5eb8 | 2018-07-11 15:32:05 -0400 | [diff] [blame] | 389 | class GPUPersistentCacheTestingSink : public GPUSink { |
| 390 | public: |
| 391 | GPUPersistentCacheTestingSink(sk_gpu_test::GrContextFactory::ContextType, |
| 392 | sk_gpu_test::GrContextFactory::ContextOverrides, |
| 393 | SkCommandLineConfigGpu::SurfType surfType, int samples, |
| 394 | bool diText, SkColorType colorType, SkAlphaType alphaType, |
| 395 | sk_sp<SkColorSpace> colorSpace, bool threaded, |
| 396 | const GrContextOptions& grCtxOptions); |
| 397 | |
| 398 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 399 | |
| 400 | const char* fileExtension() const override { |
| 401 | // Suppress writing out results from this config - we just want to do our matching test |
| 402 | return nullptr; |
| 403 | } |
| 404 | |
| 405 | private: |
| 406 | typedef GPUSink INHERITED; |
| 407 | }; |
| 408 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 409 | class PDFSink : public Sink { |
| 410 | public: |
Hal Canary | c7d295e | 2017-07-20 15:36:00 -0400 | [diff] [blame] | 411 | PDFSink(bool pdfa, SkScalar rasterDpi) : fPDFA(pdfa), fRasterDpi(rasterDpi) {} |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 412 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 413 | const char* fileExtension() const override { return "pdf"; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 414 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
halcanary | 4b65666 | 2016-04-27 07:45:18 -0700 | [diff] [blame] | 415 | bool fPDFA; |
Hal Canary | c7d295e | 2017-07-20 15:36:00 -0400 | [diff] [blame] | 416 | SkScalar fRasterDpi; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 417 | }; |
| 418 | |
halcanary | 47ef4d5 | 2015-03-03 09:13:09 -0800 | [diff] [blame] | 419 | class XPSSink : public Sink { |
| 420 | public: |
| 421 | XPSSink(); |
| 422 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 423 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 424 | const char* fileExtension() const override { return "xps"; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 425 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
halcanary | 47ef4d5 | 2015-03-03 09:13:09 -0800 | [diff] [blame] | 426 | }; |
| 427 | |
reed | 54dc487 | 2016-09-13 08:09:45 -0700 | [diff] [blame] | 428 | class PipeSink : public Sink { |
| 429 | public: |
| 430 | PipeSink(); |
Mike Klein | 841101d | 2017-03-10 09:55:51 -0500 | [diff] [blame] | 431 | |
reed | 54dc487 | 2016-09-13 08:09:45 -0700 | [diff] [blame] | 432 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 433 | const char* fileExtension() const override { return "skpipe"; } |
| 434 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
| 435 | }; |
| 436 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 437 | class RasterSink : public Sink { |
| 438 | public: |
brianosman | b109b8c | 2016-06-16 13:03:24 -0700 | [diff] [blame] | 439 | explicit RasterSink(SkColorType, sk_sp<SkColorSpace> = nullptr); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 440 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 441 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 442 | const char* fileExtension() const override { return "png"; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 443 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; } |
Yuqian Li | b8b6253 | 2018-02-23 14:13:36 +0800 | [diff] [blame] | 444 | protected: |
| 445 | void allocPixels(const Src& src, SkBitmap*) const; |
| 446 | |
brianosman | b109b8c | 2016-06-16 13:03:24 -0700 | [diff] [blame] | 447 | SkColorType fColorType; |
| 448 | sk_sp<SkColorSpace> fColorSpace; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 449 | }; |
| 450 | |
Yuqian Li | b8b6253 | 2018-02-23 14:13:36 +0800 | [diff] [blame] | 451 | class ThreadedSink : public RasterSink { |
| 452 | public: |
| 453 | explicit ThreadedSink(SkColorType, sk_sp<SkColorSpace> = nullptr); |
| 454 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
Yuqian Li | b8b6253 | 2018-02-23 14:13:36 +0800 | [diff] [blame] | 455 | }; |
| 456 | |
mtklein | 9c3f17d | 2015-01-28 11:35:18 -0800 | [diff] [blame] | 457 | class SKPSink : public Sink { |
| 458 | public: |
| 459 | SKPSink(); |
| 460 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 461 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 462 | const char* fileExtension() const override { return "skp"; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 463 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
mtklein | 9c3f17d | 2015-01-28 11:35:18 -0800 | [diff] [blame] | 464 | }; |
| 465 | |
Hal Canary | 85c7fe8 | 2016-10-25 10:33:27 -0400 | [diff] [blame] | 466 | class DebugSink : public Sink { |
| 467 | public: |
| 468 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 469 | const char* fileExtension() const override { return "json"; } |
| 470 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
| 471 | }; |
| 472 | |
mtklein | 8a4527e | 2015-01-31 20:00:58 -0800 | [diff] [blame] | 473 | class SVGSink : public Sink { |
| 474 | public: |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 475 | SVGSink(int pageIndex = 0); |
mtklein | 8a4527e | 2015-01-31 20:00:58 -0800 | [diff] [blame] | 476 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 477 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 478 | const char* fileExtension() const override { return "svg"; } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 479 | SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } |
Bryce Thomas | 95a7b76 | 2018-03-02 13:54:21 -0800 | [diff] [blame] | 480 | |
| 481 | private: |
| 482 | int fPageIndex; |
mtklein | 8a4527e | 2015-01-31 20:00:58 -0800 | [diff] [blame] | 483 | }; |
| 484 | |
| 485 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 486 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 487 | |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 488 | class Via : public Sink { |
| 489 | public: |
msarett | 62d3b10 | 2015-12-10 15:14:27 -0800 | [diff] [blame] | 490 | explicit Via(Sink* sink) : fSink(sink) {} |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 491 | const char* fileExtension() const override { return fSink->fileExtension(); } |
mtklein | 21eaf3b | 2016-02-08 12:39:59 -0800 | [diff] [blame] | 492 | bool serial() const override { return fSink->serial(); } |
mtklein | 99cab4e | 2015-07-31 06:43:04 -0700 | [diff] [blame] | 493 | SinkFlags flags() const override { |
| 494 | SinkFlags flags = fSink->flags(); |
| 495 | flags.approach = SinkFlags::kIndirect; |
| 496 | return flags; |
| 497 | } |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 498 | protected: |
Ben Wagner | 145dbcd | 2016-11-03 14:40:50 -0400 | [diff] [blame] | 499 | std::unique_ptr<Sink> fSink; |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 500 | }; |
| 501 | |
| 502 | class ViaMatrix : public Via { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 503 | public: |
msarett | 62d3b10 | 2015-12-10 15:14:27 -0800 | [diff] [blame] | 504 | ViaMatrix(SkMatrix, Sink*); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 505 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 506 | private: |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 507 | const SkMatrix fMatrix; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 508 | }; |
| 509 | |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 510 | class ViaUpright : public Via { |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 511 | public: |
msarett | 62d3b10 | 2015-12-10 15:14:27 -0800 | [diff] [blame] | 512 | ViaUpright(SkMatrix, Sink*); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 513 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 514 | private: |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 515 | const SkMatrix fMatrix; |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 516 | }; |
| 517 | |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 518 | class ViaSerialization : public Via { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 519 | public: |
msarett | 62d3b10 | 2015-12-10 15:14:27 -0800 | [diff] [blame] | 520 | explicit ViaSerialization(Sink* sink) : Via(sink) {} |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 521 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 522 | }; |
| 523 | |
mtklein | 4a34ecb | 2016-01-08 10:19:35 -0800 | [diff] [blame] | 524 | class ViaPicture : public Via { |
| 525 | public: |
| 526 | explicit ViaPicture(Sink* sink) : Via(sink) {} |
| 527 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 528 | }; |
| 529 | |
reed | 54dc487 | 2016-09-13 08:09:45 -0700 | [diff] [blame] | 530 | class ViaPipe : public Via { |
| 531 | public: |
| 532 | explicit ViaPipe(Sink* sink) : Via(sink) {} |
| 533 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 534 | }; |
| 535 | |
mtklein | 7882924 | 2015-05-06 07:54:07 -0700 | [diff] [blame] | 536 | class ViaTiles : public Via { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 537 | public: |
msarett | 62d3b10 | 2015-12-10 15:14:27 -0800 | [diff] [blame] | 538 | ViaTiles(int w, int h, SkBBHFactory*, Sink*); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 539 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 540 | private: |
| 541 | const int fW, fH; |
Ben Wagner | 145dbcd | 2016-11-03 14:40:50 -0400 | [diff] [blame] | 542 | std::unique_ptr<SkBBHFactory> fFactory; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 543 | }; |
| 544 | |
Robert Phillips | 33f02ed | 2018-03-27 08:06:57 -0400 | [diff] [blame] | 545 | class ViaDDL : public Via { |
| 546 | public: |
| 547 | ViaDDL(int numDivisions, Sink* sink); |
| 548 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 549 | private: |
Robert Phillips | 33f02ed | 2018-03-27 08:06:57 -0400 | [diff] [blame] | 550 | const int fNumDivisions; |
Robert Phillips | 33f02ed | 2018-03-27 08:06:57 -0400 | [diff] [blame] | 551 | }; |
| 552 | |
Mike Reed | f67c459 | 2017-02-17 17:06:11 -0500 | [diff] [blame] | 553 | class ViaSVG : public Via { |
| 554 | public: |
| 555 | explicit ViaSVG(Sink* sink) : Via(sink) {} |
| 556 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 557 | }; |
| 558 | |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 559 | class ViaLite : public Via { |
| 560 | public: |
| 561 | explicit ViaLite(Sink* sink) : Via(sink) {} |
| 562 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 563 | }; |
| 564 | |
Mike Klein | 841101d | 2017-03-10 09:55:51 -0500 | [diff] [blame] | 565 | class ViaCSXform : public Via { |
| 566 | public: |
Mike Klein | 919cc45 | 2017-03-18 15:36:52 +0000 | [diff] [blame] | 567 | explicit ViaCSXform(Sink*, sk_sp<SkColorSpace>, bool colorSpin); |
Mike Klein | 841101d | 2017-03-10 09:55:51 -0500 | [diff] [blame] | 568 | Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 569 | private: |
| 570 | sk_sp<SkColorSpace> fCS; |
Mike Klein | 919cc45 | 2017-03-18 15:36:52 +0000 | [diff] [blame] | 571 | bool fColorSpin; |
Mike Klein | 841101d | 2017-03-10 09:55:51 -0500 | [diff] [blame] | 572 | }; |
| 573 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 574 | } // namespace DM |
| 575 | |
| 576 | #endif//DMSrcSink_DEFINED |