Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkBitmap::HeapAllocator Class Reference

#include <SkBitmap.h>

Inheritance diagram for SkBitmap::HeapAllocator:
Allocator

Public Member Functions

bool allocPixelRef (SkBitmap *bitmap) override
 

Detailed Description

Subclass of SkBitmap::Allocator that returns a SkPixelRef that allocates its pixel memory from the heap. This is the default SkBitmap::Allocator invoked by allocPixels().

Definition at line 1233 of file SkBitmap.h.

Member Function Documentation

◆ allocPixelRef()

bool SkBitmap::HeapAllocator::allocPixelRef ( SkBitmap dst)
override

Allocates the pixel memory for the bitmap, given its dimensions and SkColorType. Returns true on success, where success means either setPixels() or setPixelRef() was called.

Parameters
bitmapSkBitmap containing SkImageInfo as input, and SkPixelRef as output
Returns
true if pixels are allocated

example: https://fiddle.skia.org/c/@Bitmap_HeapAllocator_allocPixelRef

We explicitly use the same allocator for our pixels that SkMask does, so that we can freely assign memory allocated by one class to the other.

Definition at line 377 of file SkBitmap.cpp.

377 {
378 const SkImageInfo& info = dst->info();
380// SkDebugf("unsupported config for info %d\n", dst->config());
381 return false;
382 }
383
385 if (!pr) {
386 return false;
387 }
388
389 dst->setPixelRef(std::move(pr), 0, 0);
390 SkDEBUGCODE(dst->validate();)
391 return true;
392}
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
const SkImageInfo & info() const
Definition SkBitmap.h:139
SK_API sk_sp< SkPixelRef > MakeAllocate(const SkImageInfo &, size_t rowBytes)
dst
Definition cp.py:12
SkColorType colorType() const

The documentation for this class was generated from the following files: