Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | #if 0 // Disabled until updated to use current API. |
| 2 | // Copyright 2019 Google LLC. |
| 3 | // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 5 | // HASH=80856fe921ce36f8d5a32d8672bccbfc |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 6 | REG_FIDDLE(Image_refEncodedData, 256, 256, false, 3) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 7 | void draw(SkCanvas* canvas) { |
| 8 | struct { |
| 9 | const char* name; |
| 10 | sk_sp<SkImage> image; |
| 11 | } tests[] = { { "image", image }, { "bitmap", SkImage::MakeFromBitmap(source) }, |
| 12 | { "texture", SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture, |
| 13 | kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, |
| 14 | kOpaque_SkAlphaType, nullptr) } }; |
| 15 | SkString string; |
| 16 | SkPaint paint; |
| 17 | for (const auto& test : tests ) { |
| 18 | if (!test.image) { |
| 19 | string.printf("no %s", test.name); |
| 20 | } else { |
| 21 | string.printf("%s" "encoded %s", test.image->refEncodedData() ? "" : "no ", test.name); |
| 22 | } |
| 23 | canvas->drawString(string, 10, 20, paint); |
| 24 | canvas->translate(0, 20); |
| 25 | } |
| 26 | } |
| 27 | } // END FIDDLE |
| 28 | #endif // Disabled until updated to use current API. |