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

Unified Diff: src/core/SkTextBlob.cpp

Issue 496773002: [SkTextBlob] Merge run font data at draw time. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebased Created 6 years, 4 months 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 | « src/core/SkCanvas.cpp ('k') | no next file » | 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 551d98836a3e40ea172a07e573de30dde9966756..ded801aaa945312e9f329a823a636b9e887aa299 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -61,14 +61,37 @@ const SkPoint& SkTextBlob::RunIterator::offset() const {
return (*fBlob->fRuns)[fIndex].offset;
}
-const SkPaint& SkTextBlob::RunIterator::font() const {
+SkTextBlob::GlyphPositioning SkTextBlob::RunIterator::positioning() const {
SkASSERT(!this->done());
- return (*fBlob->fRuns)[fIndex].font;
+ return (*fBlob->fRuns)[fIndex].positioning;
}
-SkTextBlob::GlyphPositioning SkTextBlob::RunIterator::positioning() const {
+void SkTextBlob::RunIterator::applyFontToPaint(SkPaint* paint) const {
SkASSERT(!this->done());
- return (*fBlob->fRuns)[fIndex].positioning;
+
+ const SkPaint& font = (*fBlob->fRuns)[fIndex].font;
+
+ paint->setTypeface(font.getTypeface());
+ paint->setTextEncoding(font.getTextEncoding());
+ paint->setTextSize(font.getTextSize());
+ paint->setTextScaleX(font.getTextScaleX());
+ paint->setTextSkewX(font.getTextSkewX());
+ paint->setHinting(font.getHinting());
+
+ uint32_t flagsMask = SkPaint::kAntiAlias_Flag
+ | SkPaint::kUnderlineText_Flag
+ | SkPaint::kStrikeThruText_Flag
+ | SkPaint::kFakeBoldText_Flag
+ | SkPaint::kLinearText_Flag
+ | SkPaint::kSubpixelText_Flag
+ | SkPaint::kDevKernText_Flag
+ | SkPaint::kLCDRenderText_Flag
+ | SkPaint::kEmbeddedBitmapText_Flag
+ | SkPaint::kAutoHinting_Flag
+ | SkPaint::kVerticalText_Flag
+ | SkPaint::kGenA8FromLCD_Flag
+ | SkPaint::kDistanceFieldTextTEMP_Flag;
+ paint->setFlags((paint->getFlags() & ~flagsMask) | (font.getFlags() & flagsMask));
}
SkTextBlobBuilder::SkTextBlobBuilder(unsigned runs)
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698