Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Image_BorrowTextureFrom.cpp
Go to the documentation of this file.
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.
4// HASH=94e9296c53bad074bf2a48ff885dac13
5REG_FIDDLE(Image_BorrowTextureFrom, 256, 128, false, 3) {
6void draw(SkCanvas* canvas) {
7 auto dContext = GrAsDirectContext(canvas->recordingContext());
8 if (!dContext) {
9 return;
10 }
11
12 canvas->scale(.25f, .25f);
13 int x = 0;
17 origin,
20 nullptr);
21 canvas->drawImage(image, x, 0);
22 x += 512;
23 }
24}
25} // 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
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
sk_sp< SkImage > image
Definition examples.cpp:29
GrBackendTexture backEndTexture
Definition examples.cpp:25
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
double x
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)