Flutter Engine
The Flutter Engine
Classes | Functions
SkKeyedImage.h File Reference
#include "include/core/SkImage.h"
#include "include/core/SkRefCnt.h"
#include "src/pdf/SkBitmapKey.h"

Go to the source code of this file.

Classes

class  SkKeyedImage
 

Functions

SkBitmapKey SkBitmapKeyFromImage (const SkImage *)
 

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 18 of file SkKeyedImage.cpp.

18 {
19 if (!image) {
20 return {{0, 0, 0, 0}, 0};
21 }
22 if (const SkBitmap* bm = as_IB(image)->onPeekBitmap()) {
23 SkIPoint o = bm->pixelRefOrigin();
24 return {image->bounds().makeOffset(o), bm->getGenerationID()};
25 }
26 return {image->bounds(), image->uniqueID()};
27}
static SkImage_Base * as_IB(SkImage *image)
Definition: SkImage_Base.h:201
uint32_t uniqueID() const
Definition: SkImage.h:311
SkIRect bounds() const
Definition: SkImage.h:303
sk_sp< const SkImage > image
Definition: SkRecords.h:269
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
Definition: SkRect.h:300