77 return packedID.
hash();
91 : fID{PackIDSkPoint(
glyphID, pt, mask)} { }
97 return fID == that.fID;
100 return !(*
this == that);
103 return this->fID < that.fID;
167 using namespace skvx;
173 XY
pos{pt.
x(), pt.
y()};
175 SubXY sub = cast<int>(subPos * magic) & SubXY{mask.
x(), mask.
y()};
182 x = (
x - floorf(
x)) + 1.0f;
183 y = (
y - floorf(
y)) + 1.0f;
185 (
int)(
x * magicX) & mask.
x(),
186 (
int)(
y * magicY) & mask.
y(),
196 return PackIDSubXSubY(
glyphID, FixedToSub(
x), FixedToSub(
y));
199 static constexpr uint32_t FixedToSub(
SkFixed n) {
203 constexpr uint32_t subPixelField(uint32_t subPixelPosBit)
const {
207 constexpr SkFixed subToFixed(uint32_t subPixelPosBit)
const {
208 uint32_t subPixelPosition = this->subPixelField(subPixelPosBit);
257 return -fRect[0] >= fRect[2] || -fRect[1] >= fRect[3];
266 return this->
offset(pt.
x(), pt.
y());
273 return fRect -
Storage{dx, dy, dx, dy};
282 SkPoint negLeftTop()
const {
return {fRect[0], fRect[1]}; }
290 constexpr SkScalar max = std::numeric_limits<SkScalar>::max();
294 constexpr SkScalar max = std::numeric_limits<SkScalar>::max();
304enum class GlyphAction {
343 skglyph::GlyphAction
actionFor(skglyph::ActionType actionType)
const {
344 return static_cast<skglyph::GlyphAction
>((
fActions >> actionType) & 0b11);
350 return std::max(fWidth, fHeight);
359 return this->
maxDimension() <= kSkSideTooBigForAtlas - 2;
373 return packedID.
hash();
377 void setAction(skglyph::ActionType actionType, skglyph::GlyphAction
action) {
381 const uint64_t mask = 0b11 << actionType;
388 static_assert(SkTo<int>(skglyph::GlyphAction::kSize) <= 4);
394 uint64_t
fActions : skglyph::ActionTypeSize::kTotalBits;
397 uint16_t fWidth, fHeight;
508 return SkGlyphRect(fLeft, fTop, fLeft + fWidth, fTop + fHeight);
510 int left()
const {
return fLeft; }
511 int top()
const {
return fTop; }
512 int width()
const {
return fWidth; }
515 return fWidth == 0 || fHeight == 0;
519 uint16_t
extraBits()
const {
return fScalerContextBits; }
563 inline static constexpr uint16_t kMaxGlyphWidth = 1u << 13u;
577 Intercept* fIntercept{
nullptr};
579 bool fHasPath{
false};
584 bool fHairline{
false};
587 struct DrawableData {
588 Intercept* fIntercept{
nullptr};
590 bool fHasDrawable{
false};
595 void installImage(
void* imageData) {
615 void* fImage =
nullptr;
620 PathData* fPathData =
nullptr;
621 DrawableData* fDrawableData =
nullptr;
631 uint16_t fScalerContextBits = 0;
635 SkDEBUGCODE(
bool fAdvancesBoundsFormatAndInitialPathDone{
false};)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
Type::kYUV Type::kRGBA() int(0.7 *637)
SkGlyphRect bounds() const
SkMask::Format maskFormat() const
static uint32_t Hash(SkPackedGlyphID packedID)
static bool FitsInAtlas(const SkGlyph &glyph)
uint16_t maxDimension() const
static constexpr uint16_t kSkSideTooBigForAtlas
bool fitsInAtlasInterpolated() const
void setActionFor(skglyph::ActionType, SkGlyph *, sktext::StrikeForGPU *)
static SkPackedGlyphID GetKey(SkGlyphDigest digest)
bool fitsInAtlasDirect() const
skglyph::GlyphAction actionFor(skglyph::ActionType actionType) const
SkPoint rightBottom() const
SkPoint widthHeight() const
SkGlyphRect scaleAndOffset(SkScalar scale, SkPoint offset) const
SkGlyphRect offset(SkPoint pt) const
SkGlyphRect offset(SkScalar x, SkScalar y) const
SkGlyphRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
SkGlyphRect inset(SkScalar dx, SkScalar dy) const
bool setPathHasBeenCalled() const
uint16_t extraBits() const
size_t addPathFromBuffer(SkReadBuffer &, SkArenaAlloc *)
bool imageTooLarge() const
SkGlyphID getGlyphID() const
size_t formatAlignment() const
void ensureIntercepts(const SkScalar bounds[2], SkScalar scale, SkScalar xPos, SkScalar *array, int *count, SkArenaAlloc *alloc)
void flattenMetrics(SkWriteBuffer &) const
bool setDrawableHasBeenCalled() const
bool setImageHasBeenCalled() const
size_t setMetricsAndImage(SkArenaAlloc *alloc, const SkGlyph &from)
const SkPath * path() const
SkMask::Format maskFormat() const
SkGlyph & operator=(const SkGlyph &)
bool setDrawable(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
bool setPath(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
constexpr SkGlyph(SkPackedGlyphID id)
bool pathIsHairline() const
void flattenPath(SkWriteBuffer &) const
size_t rowBytesUsingFormat(SkMask::Format format) const
bool setImage(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
SkGlyph & operator=(SkGlyph &&)
void flattenDrawable(SkWriteBuffer &) const
SkScalar advanceX() const
void setImage(void *image)
SkScalar advanceY() const
size_t addImageFromBuffer(SkReadBuffer &, SkArenaAlloc *)
SkFixed getSubYFixed() const
size_t addDrawableFromBuffer(SkReadBuffer &, SkArenaAlloc *)
SkFixed getSubXFixed() const
SkGlyphRect glyphRect() const
void flattenImage(SkWriteBuffer &) const
SkDrawable * drawable() const
SkPackedGlyphID getPackedID() const
SkVector advanceVector() const
const void * image() const
static std::optional< SkGlyph > MakeFromBuffer(SkReadBuffer &)
SkRect onGetBounds() override
void onDraw(SkCanvas *canvas) override
size_t onApproximateBytesUsed() override
static sk_sp< SkPictureBackedGlyphDrawable > MakeFromBuffer(SkReadBuffer &buffer)
static void FlattenDrawable(SkWriteBuffer &buffer, SkDrawable *drawable)
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
static const uint8_t buffer[]
uint32_t uint32_t * format
static float max(float r, float g, float b)
static uint32_t CheapMix(uint32_t hash)
SIT T max(const Vec< 1, T > &x)
SIT T min(const Vec< 1, T > &x)
SIN Vec< N, float > floor(const Vec< N, float > &x)
const SkVector halfAxisSampleFreq
const SkIPoint ignorePositionFieldMask
const SkIPoint ignorePositionMask
constexpr int32_t y() const
constexpr int32_t x() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
@ kARGB32_Format
SkPMColor.
@ kBW_Format
1bit per pixel mask (e.g. monochrome)
uint32_t operator()(SkPackedGlyphID packedID) const
SkString shortDump() const
constexpr SkPackedGlyphID(uint32_t v)
SkFixed getSubXFixed() const
constexpr SkPackedGlyphID(SkGlyphID glyphID, SkFixed x, SkFixed y)
bool operator<(SkPackedGlyphID that) const
bool operator!=(const SkPackedGlyphID &that) const
constexpr SkPackedGlyphID(SkGlyphID glyphID, uint32_t x, uint32_t y)
constexpr SkPackedGlyphID(SkGlyphID glyphID)
bool operator==(const SkPackedGlyphID &that) const
SkPackedGlyphID(SkGlyphID glyphID, SkPoint pt, SkIPoint mask)
static const constexpr SkScalar kSubpixelRound
static const constexpr SkIPoint kXYFieldMask
@ kFixedPointBinaryPointPos
@ kFixedPointSubPixelPosBits
static constexpr uint32_t kImpossibleID
constexpr SkPackedGlyphID()
SkFixed getSubYFixed() const
SkGlyphID glyphID() const
constexpr float y() const
constexpr float x() const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)