Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Image_AdoptTextureFrom.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=b034517e39394b7543f06ec885e36d7d
5REG_FIDDLE(Image_AdoptTextureFrom, 256, 256, false, 5) {
6void draw(SkCanvas* canvas) {
8 // Example does not support DDL.
9 if (!dContext) {
10 return;
11 }
12 canvas->scale(.5f, .5f);
13 canvas->clear(0x7f3f5f7f);
14 int x = 0, y = 0;
18 dContext, backEndTexture, origin, kRGBA_8888_SkColorType, alpha);
19 canvas->drawImage(image, x, y);
20 x += 160;
21 }
22 x -= 160 * 3;
23 y += 256;
24 }
25}
26} // END FIDDLE
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kBottomLeft_GrSurfaceOrigin
Definition GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
kUnpremul_SkAlphaType
@ kOpaque_SkAlphaType
pixel is opaque
Definition SkAlphaType.h:28
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
@ 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 clear(SkColor color)
Definition SkCanvas.h:1199
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 y
double x
SK_API sk_sp< SkImage > AdoptTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin textureOrigin, SkColorType colorType)