Flutter Engine
The Flutter Engine
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.
4REG_FIDDLE(Image_AdoptTextureFrom, 256, 256, false, 5) {
5void draw(SkCanvas* canvas) {
7 // Example does not support DDL.
8 if (!dContext) {
9 return;
10 }
11 canvas->scale(.5f, .5f);
12 canvas->clear(0x7f3f5f7f);
13 int x = 0, y = 0;
17 dContext, backEndTexture, origin, kRGBA_8888_SkColorType, alpha);
18 canvas->drawImage(image, x, y);
19 x += 160;
20 }
21 x -= 160 * 3;
22 y += 256;
23 }
24}
25} // END FIDDLE
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kBottomLeft_GrSurfaceOrigin
Definition: GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
REG_FIDDLE(Image_AdoptTextureFrom, 256, 256, false, 5)
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
Definition: SkCanvas.cpp:1637
void clear(SkColor color)
Definition: SkCanvas.h:1199
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
GrBackendTexture backEndTexture
Definition: examples.cpp:25
double y
double x
SK_API sk_sp< SkImage > AdoptTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin textureOrigin, SkColorType colorType)
sk_sp< const SkImage > image
Definition: SkRecords.h:269