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=f031c2a53f6a57833dc0127e674553da 6 REG_FIDDLE(Image_isLazyGenerated_b, 256, 256, false, 5) { 7 void draw(SkCanvas* canvas) { 8 auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void { 9 if (nullptr == image) { 10 return; 11 } 12 SkPaint paint; 13 paint.setAntiAlias(true); 14 canvas->drawImage(image, 0, 0); 15 canvas->drawString(label, 30, image->height() / 4, paint); 16 canvas->drawString( 17 image->isLazyGenerated() ? "is lazily generated" : "not lazily generated", 18 20, image->height() * 3 / 4, paint); 19 }; 20 sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(source)); 21 sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture, 22 kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, 23 kOpaque_SkAlphaType, nullptr)); 24 drawImage(image, "image"); 25 canvas->translate(image->width(), 0); 26 drawImage(bitmapImage, "source"); 27 canvas->translate(-image->width(), image->height()); 28 drawImage(textureImage, "backEndTexture"); 29 } 30 } // END FIDDLE 31 #endif // Disabled until updated to use current API. 32