Flutter Engine
The Flutter Engine
Image_RasterFromPixmap.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_RasterFromPixmap, 256, 256, true, 0) {
5 static void releaseProc(const void* pixels, SkImages::ReleaseContext context) {
6 int* countPtr = static_cast<int*>(context);
7 *countPtr += 1;
8 }
9
10void draw(SkCanvas* canvas) {
11 SkColor color = 0;
13 int releaseCount = 0;
15 SkDebugf("before reset: %d\n", releaseCount);
16 image.reset();
17 SkDebugf("after reset: %d\n", releaseCount);
18}
19} // END FIDDLE
REG_FIDDLE(Image_RasterFromPixmap, 256, 256, true, 0)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
uint32_t SkColor
Definition: SkColor.h:37
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void releaseProc(const void *ptr, void *context)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310
DlColor color
SK_API sk_sp< SkImage > RasterFromPixmap(const SkPixmap &pixmap, RasterReleaseProc rasterReleaseProc, ReleaseContext releaseContext)
void * ReleaseContext
Definition: SkImage.h:50
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)