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. 4 #include "tools/fiddle/examples.h" 5 // HASH=80856fe921ce36f8d5a32d8672bccbfc 6 REG_FIDDLE(Image_refEncodedData, 256, 256, false, 3) { 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. 29