1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 // HASH=2b1e46354d823dbb53fa6af570135329
5 REG_FIDDLE(Image_MakeFromTexture_2, 256, 256, false, 4) {
6 void draw(SkCanvas* canvas) {
7 auto dContext = GrAsDirectContext(canvas->recordingContext());
12 auto releaseCallback = [](SkImage::ReleaseContext releaseContext) -> void {
13 *((int *) releaseContext) += 128;
16 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {
17 sk_sp<SkImage> image = SkImage::MakeFromTexture(dContext, backEndTexture,
18 origin, kRGBA_8888_SkColorType,
19 kOpaque_SkAlphaType, nullptr,
21 canvas->drawImage(image, x, y);