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=ecdbaff44a02c310ef672b7d393c6dea 6 REG_FIDDLE(Image_makeNonTextureImage, 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 sk_sp<SkImage> nonTexture(image->makeNonTextureImage()); 15 canvas->drawImage(nonTexture, 0, 0); 16 canvas->drawString(label, 20, nonTexture->height() / 4, paint); 17 }; 18 sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(source)); 19 sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture, 20 kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, 21 kOpaque_SkAlphaType, nullptr)); 22 drawImage(image, "image"); 23 canvas->translate(image->width(), 0); 24 drawImage(bitmapImage, "source"); 25 canvas->translate(-image->width(), image->height()); 26 drawImage(textureImage, "backEndTexture"); 27 } 28 } // END FIDDLE 29 #endif // Disabled until updated to use current API. 30