Debian Codegraph @

docs/examples/Bitmap_HeapAllocator_allocPixelRef.cpp

raw
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(Bitmap_HeapAllocator_allocPixelRef, 256, 256, true, 0) {
5 void draw(SkCanvas* canvas) {
6 SkBitmap bitmap;
7 bitmap.setInfo(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));
8 SkDebugf("pixel address = %p\n", bitmap.getPixels());
9 SkBitmap::HeapAllocator stdalloc;
10 if (!stdalloc.allocPixelRef(&bitmap)) {
11 SkDebugf("pixel allocation failed\n");
12 } else {
13 SkDebugf("pixel address = %p\n", bitmap.getPixels());
14 }
15 }
16 } // END FIDDLE