Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Image_CrossContextTextureFromPixmap.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=45bca8747b8f49b5be34b520897ef048
5REG_FIDDLE(Image_CrossContextTextureFromPixmap, 256, 64, false, 4) {
6 void draw(SkCanvas * canvas) {
7 auto dContext = GrAsDirectContext(canvas->recordingContext());
8 if (!dContext) {
9 return;
10 }
11
12 SkPixmap pixmap;
13 if (source.peekPixels(&pixmap)) {
15 canvas->drawImage(image, 0, 0);
16 }
17 }
18} // END FIDDLE
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
bool peekPixels(SkPixmap *pixmap) const
Definition SkBitmap.cpp:635
virtual GrRecordingContext * recordingContext() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
sk_sp< SkImage > image
Definition examples.cpp:29
SkBitmap source
Definition examples.cpp:28
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
SK_API sk_sp< SkImage > CrossContextTextureFromPixmap(GrDirectContext *context, const SkPixmap &pixmap, bool buildMips, bool limitToMaxTextureSize=false)