Flutter Engine
The Flutter Engine
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 161 of file SkBitmapProcState.h.

Constructor & Destructor Documentation

◆ SkBitmapProcStateAutoMapper()

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

Definition at line 163 of file SkBitmapProcState.h.

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

Member Function Documentation

◆ fixedX()

SkFixed SkBitmapProcStateAutoMapper::fixedX ( ) const
inline

Definition at line 198 of file SkBitmapProcState.h.

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

◆ fixedY()

SkFixed SkBitmapProcStateAutoMapper::fixedY ( ) const
inline

Definition at line 199 of file SkBitmapProcState.h.

199{ return SkFractionalIntToFixed(fY); }

◆ fractionalIntX()

SkFractionalInt SkBitmapProcStateAutoMapper::fractionalIntX ( ) const
inline

Definition at line 195 of file SkBitmapProcState.h.

195{ return fX; }

◆ fractionalIntY()

SkFractionalInt SkBitmapProcStateAutoMapper::fractionalIntY ( ) const
inline

Definition at line 196 of file SkBitmapProcState.h.

196{ return fY; }

◆ intX()

int SkBitmapProcStateAutoMapper::intX ( ) const
inline

Definition at line 201 of file SkBitmapProcState.h.

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

◆ intY()

int SkBitmapProcStateAutoMapper::intY ( ) const
inline

Definition at line 202 of file SkBitmapProcState.h.

202{ return SkFractionalIntToInt(fY); }

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