Flutter Engine
The Flutter Engine
Functions
Image_BorrowTextureFrom_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Image_BorrowTextureFrom_2, 256, 256, false, 4)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Image_BorrowTextureFrom_2  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Image_BorrowTextureFrom_2.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 auto dContext = GrAsDirectContext(canvas->recordingContext());
7 if (!dContext) {
8 return;
9 }
10
11 auto releaseCallback = [](SkImages::ReleaseContext releaseContext) -> void {
12 *((int*)releaseContext) += 128;
13 };
14 int x = 0, y = 0;
18 origin,
21 nullptr,
22 releaseCallback,
23 &x);
24 canvas->drawImage(image, x, y);
25 y += 128;
26 }
27}
28} // END FIDDLE
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kBottomLeft_GrSurfaceOrigin
Definition: GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
GrBackendTexture backEndTexture
Definition: examples.cpp:25
double y
double x
void * ReleaseContext
Definition: SkImage.h:50
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
sk_sp< const SkImage > image
Definition: SkRecords.h:269