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

#include <SkBitmapProcState.h>

Public Member Functions

 SkBitmapProcStateAutoMapper (const SkBitmapProcState &s, int x, int y, SkPoint *scalarPoint=nullptr)
 
SkFractionalInt fractionalIntX () const
 
SkFractionalInt fractionalIntY () const
 
SkFixed fixedX () const
 
SkFixed fixedY () const
 
int intX () const
 
int intY () const
 

Detailed Description

Definition at line 160 of file SkBitmapProcState.h.

Constructor & Destructor Documentation

◆ SkBitmapProcStateAutoMapper()

SkBitmapProcStateAutoMapper::SkBitmapProcStateAutoMapper ( const SkBitmapProcState s,
int  x,
int  y,
SkPoint scalarPoint = nullptr 
)
inline

Definition at line 162 of file SkBitmapProcState.h.

163 {
164 SkPoint pt;
165 s.fInvProc(s.fInvMatrix,
168
169 SkFixed biasX = 0, biasY = 0;
170 if (s.fBilerp) {
171 biasX = s.fFilterOneX >> 1;
172 biasY = s.fFilterOneY >> 1;
173 } else {
174 // Our rasterizer biases upward. That is a rect from 0.5...1.5 fills pixel 1 and not
175 // pixel 0. To make an image that is mapped 1:1 with device pixels but at a half pixel
176 // offset select every pixel from the src image once we make exact integer pixel sample
177 // values round down not up. Note that a mirror mapping will not have this property.
178 biasX = 1;
179 biasY = 1;
180 }
181
182 // punt to unsigned for defined underflow behavior
183 fX = (SkFractionalInt)((uint64_t)SkScalarToFractionalInt(pt.x()) -
184 (uint64_t)SkFixedToFractionalInt(biasX));
185 fY = (SkFractionalInt)((uint64_t)SkScalarToFractionalInt(pt.y()) -
186 (uint64_t)SkFixedToFractionalInt(biasY));
187
188 if (scalarPoint) {
189 scalarPoint->set(pt.x() - SkFixedToScalar(biasX),
190 pt.y() - SkFixedToScalar(biasY));
191 }
192 }
#define SkScalarToFractionalInt(x)
SkFixed3232 SkFractionalInt
#define SkFixedToFractionalInt(x)
int32_t SkFixed
Definition SkFixed.h:25
#define SkFixedToScalar(x)
Definition SkFixed.h:124
#define SK_ScalarHalf
Definition SkScalar.h:19
#define SkIntToScalar(x)
Definition SkScalar.h:57
struct MyStruct s
double y
double x
void set(float x, float y)
constexpr float y() const
constexpr float x() const

Member Function Documentation

◆ fixedX()

SkFixed SkBitmapProcStateAutoMapper::fixedX ( ) const
inline

Definition at line 197 of file SkBitmapProcState.h.

197{ return SkFractionalIntToFixed(fX); }
#define SkFractionalIntToFixed(x)

◆ fixedY()

SkFixed SkBitmapProcStateAutoMapper::fixedY ( ) const
inline

Definition at line 198 of file SkBitmapProcState.h.

198{ return SkFractionalIntToFixed(fY); }

◆ fractionalIntX()

SkFractionalInt SkBitmapProcStateAutoMapper::fractionalIntX ( ) const
inline

Definition at line 194 of file SkBitmapProcState.h.

194{ return fX; }

◆ fractionalIntY()

SkFractionalInt SkBitmapProcStateAutoMapper::fractionalIntY ( ) const
inline

Definition at line 195 of file SkBitmapProcState.h.

195{ return fY; }

◆ intX()

int SkBitmapProcStateAutoMapper::intX ( ) const
inline

Definition at line 200 of file SkBitmapProcState.h.

200{ return SkFractionalIntToInt(fX); }
#define SkFractionalIntToInt(x)

◆ intY()

int SkBitmapProcStateAutoMapper::intY ( ) const
inline

Definition at line 201 of file SkBitmapProcState.h.

201{ return SkFractionalIntToInt(fY); }

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