Flutter Engine
The Flutter Engine
Functions
SkKeyedImage.cpp File Reference
#include "src/pdf/SkKeyedImage.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/private/base/SkAssert.h"
#include "src/image/SkImage_Base.h"
#include <utility>

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 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