Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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.
4// HASH=275356b65d18c8868f4434137350cddc
5REG_FIDDLE(Image_RasterFromPixmap, 256, 256, true, 0) {
6 static void releaseProc(const void* pixels, SkImages::ReleaseContext context) {
7 int* countPtr = static_cast<int*>(context);
8 *countPtr += 1;
9 }
10
11void draw(SkCanvas* canvas) {
12 SkColor color = 0;
14 int releaseCount = 0;
16 SkDebugf("before reset: %d\n", releaseCount);
17 image.reset();
18 SkDebugf("after reset: %d\n", releaseCount);
19}
20} // END FIDDLE
SkColor4f color
@ 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
sk_sp< SkImage > image
Definition examples.cpp:29
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
SK_API sk_sp< SkImage > RasterFromPixmap(const SkPixmap &pixmap, RasterReleaseProc rasterReleaseProc, ReleaseContext releaseContext)
void * ReleaseContext
Definition SkImage.h:50
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)