Flutter Engine
The Flutter Engine
third_party
skia
docs
examples
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.
3
#include "
tools/fiddle/examples.h
"
4
REG_FIDDLE
(Image_CrossContextTextureFromPixmap, 256, 64,
false
, 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)) {
13
sk_sp<SkImage>
image
=
SkImages::CrossContextTextureFromPixmap
(dContext, pixmap,
false
);
14
canvas->
drawImage
(
image
, 0, 0);
15
}
16
}
17
}
// END FIDDLE
GrAsDirectContext
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
Definition:
GrRecordingContext.h:281
REG_FIDDLE
REG_FIDDLE(Image_CrossContextTextureFromPixmap, 256, 64, false, 4)
Definition:
Image_CrossContextTextureFromPixmap.cpp:4
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition:
aaclip.cpp:27
SkBitmap::peekPixels
bool peekPixels(SkPixmap *pixmap) const
Definition:
SkBitmap.cpp:635
SkCanvas
Definition:
SkCanvas.h:106
SkCanvas::recordingContext
virtual GrRecordingContext * recordingContext() const
Definition:
SkCanvas.cpp:1637
SkCanvas::drawImage
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition:
SkCanvas.h:1528
SkPixmap
Definition:
SkPixmap.h:40
sk_sp< SkImage >
source
SkBitmap source
Definition:
examples.cpp:28
examples.h
SkImages::CrossContextTextureFromPixmap
SK_API sk_sp< SkImage > CrossContextTextureFromPixmap(GrDirectContext *context, const SkPixmap &pixmap, bool buildMips, bool limitToMaxTextureSize=false)
Definition:
SkImage_GaneshFactories.cpp:373
SkRecords::image
sk_sp< const SkImage > image
Definition:
SkRecords.h:269
Generated on Sun Jun 23 2024 21:55:55 for Flutter Engine by
1.9.4