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

Go to the source code of this file.

Functions

 REG_FIDDLE (Image_CrossContextTextureFromPixmap, 256, 64, false, 4)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Image_CrossContextTextureFromPixmap  ,
256  ,
64  ,
false  ,
 
)

Definition at line 4 of file Image_CrossContextTextureFromPixmap.cpp.

4 {
5 void draw(SkCanvas * canvas) {
6 auto dContext = GrAsDirectContext(canvas->recordingContext());
7 if (!dContext) {
8 return;
9 }
10
11 SkPixmap pixmap;
12 if (source.peekPixels(&pixmap)) {
14 canvas->drawImage(image, 0, 0);
15 }
16 }
17} // 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
Definition: SkCanvas.cpp:1637
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
SkBitmap source
Definition: examples.cpp:28
SK_API sk_sp< SkImage > CrossContextTextureFromPixmap(GrDirectContext *context, const SkPixmap &pixmap, bool buildMips, bool limitToMaxTextureSize=false)
sk_sp< const SkImage > image
Definition: SkRecords.h:269