Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::ganesh::SmallPathShapeDataKey Class Reference

#include <SmallPathShapeData.h>

Public Member Functions

 SmallPathShapeDataKey (const SmallPathShapeDataKey &that)
 
SmallPathShapeDataKeyoperator= (const SmallPathShapeDataKey &)=delete
 
 SmallPathShapeDataKey (const GrStyledShape &, uint32_t dim)
 
 SmallPathShapeDataKey (const GrStyledShape &, const SkMatrix &ctm)
 
bool operator== (const SmallPathShapeDataKey &that) const
 
int count32 () const
 
const uint32_t * data () const
 

Detailed Description

Definition at line 20 of file SmallPathShapeData.h.

Constructor & Destructor Documentation

◆ SmallPathShapeDataKey() [1/3]

skgpu::ganesh::SmallPathShapeDataKey::SmallPathShapeDataKey ( const SmallPathShapeDataKey that)
inline

Definition at line 23 of file SmallPathShapeData.h.

23 {
24 fKey.reset(that.fKey.count());
25 memcpy(fKey.get(), that.fKey.get(), fKey.count() * sizeof(uint32_t));
26 }

◆ SmallPathShapeDataKey() [2/3]

skgpu::ganesh::SmallPathShapeDataKey::SmallPathShapeDataKey ( const GrStyledShape shape,
uint32_t  dim 
)

Definition at line 18 of file SmallPathShapeData.cpp.

18 {
19 // Shapes' keys are for their pre-style geometry, but by now we shouldn't have any
20 // relevant styling information.
21 SkASSERT(shape.style().isSimpleFill());
22 SkASSERT(shape.hasUnstyledKey());
23 int shapeKeySize = shape.unstyledKeySize();
24 fKey.reset(1 + shapeKeySize);
25 fKey[0] = dim;
26 shape.writeUnstyledKey(&fKey[1]);
27}
#define SkASSERT(cond)
Definition SkAssert.h:116
bool isSimpleFill() const
Definition GrStyle.h:114
void writeUnstyledKey(uint32_t *key) const
int unstyledKeySize() const
bool hasUnstyledKey() const
const GrStyle & style() const

◆ SmallPathShapeDataKey() [3/3]

skgpu::ganesh::SmallPathShapeDataKey::SmallPathShapeDataKey ( const GrStyledShape shape,
const SkMatrix ctm 
)

Definition at line 29 of file SmallPathShapeData.cpp.

29 {
30 // Shapes' keys are for their pre-style geometry, but by now we shouldn't have any
31 // relevant styling information.
32 SkASSERT(shape.style().isSimpleFill());
33 SkASSERT(shape.hasUnstyledKey());
34 // We require the upper left 2x2 of the matrix to match exactly for a cache hit.
41 // Allow 8 bits each in x and y of subpixel positioning.
42 tx -= SkScalarFloorToScalar(tx);
43 ty -= SkScalarFloorToScalar(ty);
44 SkFixed fracX = SkScalarToFixed(tx) & 0x0000FF00;
45 SkFixed fracY = SkScalarToFixed(ty) & 0x0000FF00;
46 int shapeKeySize = shape.unstyledKeySize();
47 fKey.reset(5 + shapeKeySize);
48 fKey[0] = SkFloat2Bits(sx);
49 fKey[1] = SkFloat2Bits(sy);
50 fKey[2] = SkFloat2Bits(kx);
51 fKey[3] = SkFloat2Bits(ky);
52 fKey[4] = fracX | (fracY >> 8);
53 shape.writeUnstyledKey(&fKey[5]);
54}
int32_t SkFixed
Definition SkFixed.h:25
#define SkScalarToFixed(x)
Definition SkFixed.h:125
static uint32_t SkFloat2Bits(float value)
Definition SkFloatBits.h:41
#define SkScalarFloorToScalar(x)
Definition SkScalar.h:30
static constexpr int kMScaleX
horizontal scale factor
Definition SkMatrix.h:353
static constexpr int kMTransY
vertical translation
Definition SkMatrix.h:358
static constexpr int kMTransX
horizontal translation
Definition SkMatrix.h:355
static constexpr int kMSkewY
vertical skew factor
Definition SkMatrix.h:356
SkScalar get(int index) const
Definition SkMatrix.h:392
static constexpr int kMScaleY
vertical scale factor
Definition SkMatrix.h:357
static constexpr int kMSkewX
horizontal skew factor
Definition SkMatrix.h:354
float SkScalar
Definition extension.cpp:12

Member Function Documentation

◆ count32()

int skgpu::ganesh::SmallPathShapeDataKey::count32 ( ) const
inline

Definition at line 41 of file SmallPathShapeData.h.

41{ return fKey.count(); }

◆ data()

const uint32_t * skgpu::ganesh::SmallPathShapeDataKey::data ( ) const
inline

Definition at line 42 of file SmallPathShapeData.h.

42{ return fKey.get(); }

◆ operator=()

SmallPathShapeDataKey & skgpu::ganesh::SmallPathShapeDataKey::operator= ( const SmallPathShapeDataKey )
delete

◆ operator==()

bool skgpu::ganesh::SmallPathShapeDataKey::operator== ( const SmallPathShapeDataKey that) const
inline

Definition at line 36 of file SmallPathShapeData.h.

36 {
37 return fKey.count() == that.fKey.count() &&
38 0 == memcmp(fKey.get(), that.fKey.get(), sizeof(uint32_t) * fKey.count());
39 }

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