Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: src/core/SkTextBlob.cpp

Issue 1447403003: SkTextBlob should store per-run text alignment (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/TextBlobTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTextBlob.cpp
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index ed26f43db8f68eb35e19aa894dd398c3b4079715..7f6536cc8adb8b48d0f7a204b52d4b1b0db116ff 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -21,6 +21,7 @@ public:
, fScaleX(paint.getTextScaleX())
, fTypeface(SkSafeRef(paint.getTypeface()))
, fSkewX(paint.getTextSkewX())
+ , fAlign(paint.getTextAlign())
, fHinting(paint.getHinting())
, fFlags(paint.getFlags() & kFlagsMask) { }
@@ -30,6 +31,7 @@ public:
paint->setTextSize(fSize);
paint->setTextScaleX(fScaleX);
paint->setTextSkewX(fSkewX);
+ paint->setTextAlign(static_cast<SkPaint::Align>(fAlign));
paint->setHinting(static_cast<SkPaint::Hinting>(fHinting));
paint->setFlags((paint->getFlags() & ~kFlagsMask) | fFlags);
@@ -40,6 +42,7 @@ public:
&& fSize == other.fSize
&& fScaleX == other.fScaleX
&& fSkewX == other.fSkewX
+ && fAlign == other.fAlign
&& fHinting == other.fHinting
&& fFlags == other.fFlags;
}
@@ -73,6 +76,8 @@ private:
SkAutoTUnref<SkTypeface> fTypeface;
SkScalar fSkewX;
+ static_assert(SkPaint::kAlignCount < 4, "insufficient_align_bits");
+ uint32_t fAlign : 2;
static_assert(SkPaint::kFull_Hinting < 4, "insufficient_hinting_bits");
uint32_t fHinting : 2;
static_assert((kFlagsMask & 0xffff) == kFlagsMask, "insufficient_flags_bits");
« no previous file with comments | « no previous file | tests/TextBlobTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698