Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
// HASH=45bca8747b8f49b5be34b520897ef048
5
REG_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)) {
14
sk_sp<SkImage>
image
=
SkImages::CrossContextTextureFromPixmap
(dContext, pixmap,
false
);
15
canvas->
drawImage
(
image
, 0, 0);
16
}
17
}
18
}
// END FIDDLE
GrAsDirectContext
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
Definition
GrRecordingContext.h:281
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:1961
SkCanvas::drawImage
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition
SkCanvas.h:1528
SkPixmap
Definition
SkPixmap.h:40
sk_sp
Definition
SkRefCnt.h:220
image
sk_sp< SkImage > image
Definition
examples.cpp:29
source
SkBitmap source
Definition
examples.cpp:28
examples.h
REG_FIDDLE
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition
examples.h:60
SkImages::CrossContextTextureFromPixmap
SK_API sk_sp< SkImage > CrossContextTextureFromPixmap(GrDirectContext *context, const SkPixmap &pixmap, bool buildMips, bool limitToMaxTextureSize=false)
Definition
SkImage_GaneshFactories.cpp:373
Generated on Fri Apr 26 2024 06:15:38 for Flutter Engine by
1.9.8