minor docs example fix

minor docs example fix

TBR=reed@google.com
NOTRY=true

Bug: skia:8439
Change-Id: Id40358b8e06c508d777e016dc18a47299bd06e8d
Reviewed-on: https://skia-review.googlesource.com/c/177340
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2018-12-13 09:10:49 -05:00 committed by Skia Commit-Bot
parent ea908a1fbe
commit 14f49f0e66

View File

@ -312,6 +312,10 @@ x += 512;
#Populate
#Example
#Description
textureReleaseProc may be called at some later point in time. In this example,
textureReleaseProc has no effect on the drawing.
##
#Platform gpu
#Image 4
GrContext* context = canvas->getGrContext();
@ -319,15 +323,14 @@ if (!context) {
return;
}
auto debugster = [](SkImage::ReleaseContext releaseContext) -> void {
// broken
// *((int *) releaseContext) += 128;
*((int *) releaseContext) += 128;
};
int x = 0;
int x = 0, y = 0;
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {
sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backEndTexture,
origin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType, nullptr, debugster, &x);
canvas->drawImage(image, x, 0);
x += 128;
canvas->drawImage(image, x, y);
y += 128;
}
##