Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SmallPathShapeData.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
13
14#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
15
16namespace skgpu::ganesh {
17
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}
28
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}
55
56} // namespace skgpu::ganesh
57
58#endif // SK_ENABLE_OPTIMIZE_SIZE
#define SkASSERT(cond)
Definition SkAssert.h:116
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
bool isSimpleFill() const
Definition GrStyle.h:114
void writeUnstyledKey(uint32_t *key) const
int unstyledKeySize() const
bool hasUnstyledKey() const
const GrStyle & style() const
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
SmallPathShapeDataKey(const SmallPathShapeDataKey &that)
float SkScalar
Definition extension.cpp:12