Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkKeyedImage.cpp File Reference
#include "src/pdf/SkKeyedImage.h"
#include "src/image/SkImage_Base.h"

Go to the source code of this file.

Functions

SkBitmapKey SkBitmapKeyFromImage (const SkImage *image)
 

Function Documentation

◆ SkBitmapKeyFromImage()

SkBitmapKey SkBitmapKeyFromImage ( const SkImage image)

Given an Image, return the Bitmap Key that corresponds to it. If the Image wraps a Bitmap, use that Bitmap's key.

Definition at line 12 of file SkKeyedImage.cpp.

12 {
13 if (!image) {
14 return {{0, 0, 0, 0}, 0};
15 }
16 if (const SkBitmap* bm = as_IB(image)->onPeekBitmap()) {
17 SkIPoint o = bm->pixelRefOrigin();
18 return {image->bounds().makeOffset(o), bm->getGenerationID()};
19 }
20 return {image->bounds(), image->uniqueID()};
21}
static SkImage_Base * as_IB(SkImage *image)
uint32_t uniqueID() const
Definition SkImage.h:311
SkIRect bounds() const
Definition SkImage.h:303
sk_sp< SkImage > image
Definition examples.cpp:29
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
Definition SkRect.h:300