Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Enumerations | Functions
BitmapRegionDecoderPriv.h File Reference
#include "include/core/SkRect.h"

Go to the source code of this file.

Enumerations

enum  SubsetType { kFullyInside_SubsetType , kPartiallyInside_SubsetType , kOutside_SubsetType }
 

Functions

SubsetType adjust_subset_rect (const SkISize &imageDims, SkIRect *subset, int *outX, int *outY)
 

Enumeration Type Documentation

◆ SubsetType

enum SubsetType
Enumerator
kFullyInside_SubsetType 
kPartiallyInside_SubsetType 
kOutside_SubsetType 

Definition at line 13 of file BitmapRegionDecoderPriv.h.

Function Documentation

◆ adjust_subset_rect()

SubsetType adjust_subset_rect ( const SkISize imageDims,
SkIRect subset,
int outX,
int outY 
)
inline

Definition at line 35 of file BitmapRegionDecoderPriv.h.

36 {
37 // These must be at least zero, we can't start decoding the image at a negative coordinate.
38 int left = std::max(0, subset->fLeft);
39 int top = std::max(0, subset->fTop);
40
41 // If input offsets are less than zero, we decode to an offset location in the output bitmap.
42 *outX = left - subset->fLeft;
43 *outY = top - subset->fTop;
44
45 // Make sure we don't decode pixels past the edge of the image or past the edge of the subset.
46 int width = std::min(imageDims.width() - left, subset->width() - *outX);
47 int height = std::min(imageDims.height() - top, subset->height() - *outY);
48 if (width <= 0 || height <= 0) {
50 }
51
52 subset->setXYWH(left, top, width, height);
53 if ((*outX != 0) || (*outY != 0) || (width != subset->width()) ||
54 (height != subset->height())) {
56 }
57
59}
static bool left(const SkPoint &p0, const SkPoint &p1)
int32_t height
int32_t width
constexpr int32_t height() const
Definition SkRect.h:165
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
constexpr int32_t width() const
Definition SkRect.h:158
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
Definition SkRect.h:268
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37