Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
| 9 | #include "include/codec/SkCodec.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 10 | #include "include/core/SkBitmap.h" |
| 11 | #include "include/core/SkCanvas.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/core/SkColorSpace.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 13 | #include "include/core/SkData.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "include/core/SkImage.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 15 | #include "include/core/SkImageInfo.h" |
| 16 | #include "include/core/SkPaint.h" |
| 17 | #include "include/core/SkPicture.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 18 | #include "include/core/SkPictureRecorder.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 19 | #include "include/core/SkRect.h" |
| 20 | #include "include/core/SkRefCnt.h" |
| 21 | #include "include/core/SkSize.h" |
| 22 | #include "include/core/SkStream.h" |
| 23 | #include "include/core/SkString.h" |
| 24 | #include "include/core/SkTypes.h" |
Adlai Holler | 4caa935 | 2020-07-16 10:58:58 -0400 | [diff] [blame] | 25 | #include "include/gpu/GrDirectContext.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 26 | #include "include/third_party/skcms/skcms.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 27 | #include "tools/Resources.h" |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 28 | |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 29 | #include <string.h> |
| 30 | #include <memory> |
| 31 | #include <utility> |
| 32 | |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 33 | static const int kWidth = 64; |
| 34 | static const int kHeight = 64; |
| 35 | |
Brian Osman | b1168a7 | 2017-03-20 14:21:18 -0400 | [diff] [blame] | 36 | static sk_sp<SkImage> make_raster_image(SkColorType colorType) { |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 37 | std::unique_ptr<SkStream> stream(GetResourceAsStream("images/google_chrome.ico")); |
Mike Reed | ede7bac | 2017-07-23 15:30:02 -0400 | [diff] [blame] | 38 | std::unique_ptr<SkCodec> codec = SkCodec::MakeFromStream(std::move(stream)); |
Hal Canary | baa2a28 | 2018-11-26 15:34:12 -0500 | [diff] [blame] | 39 | if (!codec) { |
| 40 | return nullptr; |
| 41 | } |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 42 | |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 43 | SkImageInfo info = codec->getInfo().makeWH(kWidth, kHeight) |
| 44 | .makeColorType(colorType) |
Brian Osman | 6b62296 | 2018-08-27 19:16:02 +0000 | [diff] [blame] | 45 | .makeAlphaType(kPremul_SkAlphaType); |
Mike Reed | 844beb5 | 2021-01-25 15:36:09 -0500 | [diff] [blame] | 46 | return std::get<0>(codec->getImage(info)); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 47 | } |
| 48 | |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 49 | static sk_sp<SkImage> make_codec_image() { |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 50 | sk_sp<SkData> encoded = GetResourceAsData("images/randPixels.png"); |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 51 | return SkImage::MakeFromEncoded(encoded); |
| 52 | } |
| 53 | |
| 54 | static void draw_contents(SkCanvas* canvas) { |
| 55 | SkPaint paint; |
| 56 | paint.setStyle(SkPaint::kStroke_Style); |
| 57 | paint.setStrokeWidth(20); |
| 58 | paint.setColor(0xFF800000); |
| 59 | canvas->drawCircle(40, 40, 35, paint); |
| 60 | paint.setColor(0xFF008000); |
| 61 | canvas->drawCircle(50, 50, 35, paint); |
| 62 | paint.setColor(0xFF000080); |
| 63 | canvas->drawCircle(60, 60, 35, paint); |
| 64 | } |
| 65 | |
Matt Sarett | 9df70bb | 2017-02-14 13:50:43 -0500 | [diff] [blame] | 66 | static sk_sp<SkImage> make_picture_image() { |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 67 | SkPictureRecorder recorder; |
| 68 | draw_contents(recorder.beginRecording(SkRect::MakeIWH(kWidth, kHeight))); |
| 69 | return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(), |
| 70 | SkISize::Make(kWidth, kHeight), nullptr, nullptr, |
| 71 | SkImage::BitDepth::kU8, |
Matt Sarett | 77a7a1b | 2017-02-07 13:56:11 -0500 | [diff] [blame] | 72 | SkColorSpace::MakeSRGB()); |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 73 | } |
| 74 | |
Matt Sarett | 733340a | 2017-05-02 16:19:51 -0400 | [diff] [blame] | 75 | static sk_sp<SkColorSpace> make_parametric_transfer_fn(const SkColorSpacePrimaries& primaries) { |
Brian Osman | 82ebe04 | 2019-01-04 17:03:00 -0500 | [diff] [blame] | 76 | skcms_Matrix3x3 toXYZD50; |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 77 | SkAssertResult(primaries.toXYZD50(&toXYZD50)); |
Brian Osman | 82ebe04 | 2019-01-04 17:03:00 -0500 | [diff] [blame] | 78 | skcms_TransferFunction fn = { 1.8f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f }; |
Matt Sarett | 733340a | 2017-05-02 16:19:51 -0400 | [diff] [blame] | 79 | return SkColorSpace::MakeRGB(fn, toXYZD50); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | static sk_sp<SkColorSpace> make_wide_gamut() { |
| 83 | // ProPhoto |
| 84 | SkColorSpacePrimaries primaries; |
| 85 | primaries.fRX = 0.7347f; |
| 86 | primaries.fRY = 0.2653f; |
| 87 | primaries.fGX = 0.1596f; |
| 88 | primaries.fGY = 0.8404f; |
| 89 | primaries.fBX = 0.0366f; |
| 90 | primaries.fBY = 0.0001f; |
| 91 | primaries.fWX = 0.34567f; |
| 92 | primaries.fWY = 0.35850f; |
Matt Sarett | 733340a | 2017-05-02 16:19:51 -0400 | [diff] [blame] | 93 | return make_parametric_transfer_fn(primaries); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | static sk_sp<SkColorSpace> make_small_gamut() { |
| 97 | SkColorSpacePrimaries primaries; |
| 98 | primaries.fRX = 0.50f; |
| 99 | primaries.fRY = 0.33f; |
| 100 | primaries.fGX = 0.30f; |
| 101 | primaries.fGY = 0.50f; |
| 102 | primaries.fBX = 0.25f; |
| 103 | primaries.fBY = 0.16f; |
| 104 | primaries.fWX = 0.3127f; |
| 105 | primaries.fWY = 0.3290f; |
Matt Sarett | 733340a | 2017-05-02 16:19:51 -0400 | [diff] [blame] | 106 | return make_parametric_transfer_fn(primaries); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 107 | } |
| 108 | |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 109 | static void draw_image(GrDirectContext* dContext, SkCanvas* canvas, SkImage* image, |
| 110 | SkColorType dstColorType, SkAlphaType dstAlphaType, |
| 111 | sk_sp<SkColorSpace> dstColorSpace, SkImage::CachingHint hint) { |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 112 | size_t rowBytes = image->width() * SkColorTypeBytesPerPixel(dstColorType); |
| 113 | sk_sp<SkData> data = SkData::MakeUninitialized(rowBytes * image->height()); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 114 | SkImageInfo dstInfo = SkImageInfo::Make(image->width(), image->height(), dstColorType, |
| 115 | dstAlphaType, dstColorSpace); |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 116 | if (!image->readPixels(dContext, dstInfo, data->writable_data(), rowBytes, 0, 0, hint)) { |
Brian Osman | 8915058 | 2017-03-20 16:54:28 -0400 | [diff] [blame] | 117 | memset(data->writable_data(), 0, rowBytes * image->height()); |
| 118 | } |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 119 | |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 120 | // Now that we have called readPixels(), dump the raw pixels into an srgb image. |
Brian Osman | 6b62296 | 2018-08-27 19:16:02 +0000 | [diff] [blame] | 121 | sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB(); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 122 | sk_sp<SkImage> raw = SkImage::MakeRasterData(dstInfo.makeColorSpace(srgb), data, rowBytes); |
Mike Reed | 8d29ab6 | 2021-01-23 18:10:39 -0500 | [diff] [blame] | 123 | canvas->drawImage(raw.get(), 0.0f, 0.0f); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | class ReadPixelsGM : public skiagm::GM { |
| 127 | public: |
| 128 | ReadPixelsGM() {} |
| 129 | |
| 130 | protected: |
| 131 | SkString onShortName() override { |
| 132 | return SkString("readpixels"); |
| 133 | } |
| 134 | |
| 135 | SkISize onISize() override { |
Brian Osman | b1168a7 | 2017-03-20 14:21:18 -0400 | [diff] [blame] | 136 | return SkISize::Make(6 * kWidth, 9 * kHeight); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | void onDraw(SkCanvas* canvas) override { |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 140 | const SkAlphaType alphaTypes[] = { |
| 141 | kUnpremul_SkAlphaType, |
| 142 | kPremul_SkAlphaType, |
| 143 | }; |
| 144 | const SkColorType colorTypes[] = { |
| 145 | kRGBA_8888_SkColorType, |
| 146 | kBGRA_8888_SkColorType, |
| 147 | kRGBA_F16_SkColorType, |
| 148 | }; |
| 149 | const sk_sp<SkColorSpace> colorSpaces[] = { |
| 150 | make_wide_gamut(), |
Matt Sarett | 77a7a1b | 2017-02-07 13:56:11 -0500 | [diff] [blame] | 151 | SkColorSpace::MakeSRGB(), |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 152 | make_small_gamut(), |
| 153 | }; |
| 154 | |
John Stiles | bd3ffa4 | 2020-07-30 20:24:57 -0400 | [diff] [blame] | 155 | for (const sk_sp<SkColorSpace>& dstColorSpace : colorSpaces) { |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 156 | for (SkColorType srcColorType : colorTypes) { |
Brian Osman | b1168a7 | 2017-03-20 14:21:18 -0400 | [diff] [blame] | 157 | canvas->save(); |
| 158 | sk_sp<SkImage> image = make_raster_image(srcColorType); |
Hal Canary | baa2a28 | 2018-11-26 15:34:12 -0500 | [diff] [blame] | 159 | if (!image) { |
| 160 | continue; |
| 161 | } |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 162 | auto dContext = GrAsDirectContext(canvas->recordingContext()); |
| 163 | if (dContext) { |
| 164 | image = image->makeTextureImage(dContext); |
Brian Osman | 8915058 | 2017-03-20 16:54:28 -0400 | [diff] [blame] | 165 | } |
| 166 | if (image) { |
| 167 | for (SkColorType dstColorType : colorTypes) { |
| 168 | for (SkAlphaType dstAlphaType : alphaTypes) { |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 169 | draw_image(dContext, canvas, image.get(), dstColorType, dstAlphaType, |
Brian Osman | 8915058 | 2017-03-20 16:54:28 -0400 | [diff] [blame] | 170 | dstColorSpace, SkImage::kAllow_CachingHint); |
| 171 | canvas->translate((float)kWidth, 0.0f); |
| 172 | } |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 173 | } |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 174 | } |
Brian Osman | b1168a7 | 2017-03-20 14:21:18 -0400 | [diff] [blame] | 175 | canvas->restore(); |
| 176 | canvas->translate(0.0f, (float) kHeight); |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | private: |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 182 | using INHERITED = skiagm::GM; |
Matt Sarett | 909d379 | 2016-12-22 10:52:25 -0500 | [diff] [blame] | 183 | }; |
| 184 | DEF_GM( return new ReadPixelsGM; ) |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 185 | |
| 186 | class ReadPixelsCodecGM : public skiagm::GM { |
| 187 | public: |
| 188 | ReadPixelsCodecGM() {} |
| 189 | |
| 190 | protected: |
| 191 | SkString onShortName() override { |
| 192 | return SkString("readpixelscodec"); |
| 193 | } |
| 194 | |
| 195 | SkISize onISize() override { |
| 196 | return SkISize::Make(3 * (kEncodedWidth + 1), 12 * (kEncodedHeight + 1)); |
| 197 | } |
| 198 | |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 199 | DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override { |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 200 | if (!canvas->imageInfo().colorSpace()) { |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 201 | *errorMsg = "This gm is only interesting in color correct modes."; |
| 202 | return DrawResult::kSkip; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | const SkAlphaType alphaTypes[] = { |
| 206 | kUnpremul_SkAlphaType, |
| 207 | kPremul_SkAlphaType, |
| 208 | }; |
| 209 | const SkColorType colorTypes[] = { |
| 210 | kRGBA_8888_SkColorType, |
| 211 | kBGRA_8888_SkColorType, |
| 212 | kRGBA_F16_SkColorType, |
| 213 | }; |
| 214 | const sk_sp<SkColorSpace> colorSpaces[] = { |
| 215 | make_wide_gamut(), |
Matt Sarett | 77a7a1b | 2017-02-07 13:56:11 -0500 | [diff] [blame] | 216 | SkColorSpace::MakeSRGB(), |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 217 | make_small_gamut(), |
| 218 | }; |
| 219 | const SkImage::CachingHint hints[] = { |
| 220 | SkImage::kAllow_CachingHint, |
| 221 | SkImage::kDisallow_CachingHint, |
| 222 | }; |
| 223 | |
| 224 | sk_sp<SkImage> image = make_codec_image(); |
John Stiles | bd3ffa4 | 2020-07-30 20:24:57 -0400 | [diff] [blame] | 225 | for (const sk_sp<SkColorSpace>& dstColorSpace : colorSpaces) { |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 226 | canvas->save(); |
| 227 | for (SkColorType dstColorType : colorTypes) { |
| 228 | for (SkAlphaType dstAlphaType : alphaTypes) { |
| 229 | for (SkImage::CachingHint hint : hints) { |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 230 | draw_image(nullptr, canvas, image.get(), dstColorType, dstAlphaType, |
| 231 | dstColorSpace, hint); |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 232 | canvas->translate(0.0f, (float) kEncodedHeight + 1); |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | canvas->restore(); |
| 237 | canvas->translate((float) kEncodedWidth + 1, 0.0f); |
| 238 | } |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 239 | return DrawResult::kOk; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | private: |
| 243 | static const int kEncodedWidth = 8; |
| 244 | static const int kEncodedHeight = 8; |
| 245 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 246 | using INHERITED = skiagm::GM; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 247 | }; |
| 248 | DEF_GM( return new ReadPixelsCodecGM; ) |
| 249 | |
| 250 | class ReadPixelsPictureGM : public skiagm::GM { |
| 251 | public: |
| 252 | ReadPixelsPictureGM() {} |
| 253 | |
| 254 | protected: |
| 255 | SkString onShortName() override { |
| 256 | return SkString("readpixelspicture"); |
| 257 | } |
| 258 | |
| 259 | SkISize onISize() override { |
| 260 | return SkISize::Make(3 * kWidth, 12 * kHeight); |
| 261 | } |
| 262 | |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 263 | DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override { |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 264 | if (!canvas->imageInfo().colorSpace()) { |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 265 | *errorMsg = "This gm is only interesting in color correct modes."; |
| 266 | return DrawResult::kSkip; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | const sk_sp<SkImage> images[] = { |
Matt Sarett | 9df70bb | 2017-02-14 13:50:43 -0500 | [diff] [blame] | 270 | make_picture_image(), |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 271 | }; |
| 272 | const SkAlphaType alphaTypes[] = { |
| 273 | kUnpremul_SkAlphaType, |
| 274 | kPremul_SkAlphaType, |
| 275 | }; |
| 276 | const SkColorType colorTypes[] = { |
| 277 | kRGBA_8888_SkColorType, |
| 278 | kBGRA_8888_SkColorType, |
| 279 | kRGBA_F16_SkColorType, |
| 280 | }; |
| 281 | const sk_sp<SkColorSpace> colorSpaces[] = { |
| 282 | make_wide_gamut(), |
Matt Sarett | 77a7a1b | 2017-02-07 13:56:11 -0500 | [diff] [blame] | 283 | SkColorSpace::MakeSRGB(), |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 284 | make_small_gamut(), |
| 285 | }; |
| 286 | const SkImage::CachingHint hints[] = { |
| 287 | SkImage::kAllow_CachingHint, |
| 288 | SkImage::kDisallow_CachingHint, |
| 289 | }; |
| 290 | |
John Stiles | bd3ffa4 | 2020-07-30 20:24:57 -0400 | [diff] [blame] | 291 | for (const sk_sp<SkImage>& image : images) { |
| 292 | for (const sk_sp<SkColorSpace>& dstColorSpace : colorSpaces) { |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 293 | canvas->save(); |
| 294 | for (SkColorType dstColorType : colorTypes) { |
| 295 | for (SkAlphaType dstAlphaType : alphaTypes) { |
| 296 | for (SkImage::CachingHint hint : hints) { |
Adlai Holler | bcfc554 | 2020-08-27 12:44:07 -0400 | [diff] [blame] | 297 | draw_image(nullptr, canvas, image.get(), dstColorType, dstAlphaType, |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 298 | dstColorSpace, hint); |
| 299 | canvas->translate(0.0f, (float) kHeight); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | canvas->restore(); |
| 304 | canvas->translate((float) kWidth, 0.0f); |
| 305 | } |
| 306 | } |
Chris Dalton | 50e24d7 | 2019-02-07 16:20:09 -0700 | [diff] [blame] | 307 | return DrawResult::kOk; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | private: |
| 311 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 312 | using INHERITED = skiagm::GM; |
Matt Sarett | 34855f9 | 2017-01-10 17:41:53 -0500 | [diff] [blame] | 313 | }; |
| 314 | DEF_GM( return new ReadPixelsPictureGM; ) |