Swap SkPackedGlyphID bitfields around

Change-Id: Ic286357dc637edf0c8df003422a43252590250f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251768
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2019-10-30 11:58:18 -04:00 committed by Skia Commit-Bot
parent 9fa8a909dd
commit c7a8df8b1c
2 changed files with 5 additions and 7 deletions

View File

@ -32,9 +32,9 @@ struct SkPackedGlyphID {
kSubPixelPosLen = 2u,
// Bit positions
kGlyphID = 0u,
kSubPixelY = kGlyphIDLen,
kSubPixelX = kGlyphIDLen + kSubPixelPosLen,
kSubPixelX = 0u,
kGlyphID = kSubPixelPosLen,
kSubPixelY = kGlyphIDLen + kSubPixelPosLen,
kEndData = kGlyphIDLen + 2 * kSubPixelPosLen,
// Masks
@ -51,9 +51,7 @@ struct SkPackedGlyphID {
: fID{(uint32_t)glyphID << kGlyphID} { }
constexpr SkPackedGlyphID(SkGlyphID glyphID, SkFixed x, SkFixed y)
: fID {PackIDXY(glyphID, x, y)} {
SkASSERT(fID != kImpossibleID);
}
: fID {PackIDXY(glyphID, x, y)} { }
constexpr SkPackedGlyphID(SkGlyphID glyphID, SkIPoint pt)
: SkPackedGlyphID(glyphID, pt.fX, pt.fY) { }

View File

@ -91,7 +91,7 @@ DEF_TEST(SkDrawableGlyphBufferBasic, reporter) {
for (auto t : SkMakeEnumerate(drawable.input())) {
size_t i; SkGlyphVariant packedID; SkPoint pos;
std::forward_as_tuple(i, std::tie(packedID, pos)) = t;
REPORTER_ASSERT(reporter, packedID.packedID().value() == glyphIDs[i]);
REPORTER_ASSERT(reporter, packedID.packedID().glyphID() == glyphIDs[i]);
REPORTER_ASSERT(reporter, pos == positions[i] + SkPoint::Make(100, 100));
}
}