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

Unified Diff: src/core/SkCanvas.cpp

Issue 517663003: Expose drawTextBlob to devices. (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 | « include/core/SkTextBlob.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index af25b46f3f808f386a04387a14eb78a36fe418bd..16459b0a0378c965dd39d6ec43e6bac245b4c048 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -22,7 +22,6 @@
#include "SkSmallAllocator.h"
#include "SkSurface_Base.h"
#include "SkTemplates.h"
-#include "SkTextBlob.h"
#include "SkTextFormatParams.h"
#include "SkTLazy.h"
#include "SkUtils.h"
@@ -2218,43 +2217,14 @@ void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPat
void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
- SkASSERT(blob);
-
- // FIXME: dispatch to the device instead
-
- if (x || y) {
- this->translate(x, y);
- }
-
- SkPaint runPaint = paint;
- SkTextBlob::RunIterator it(blob);
- while (!it.done()) {
- size_t textLen = it.glyphCount() * sizeof(uint16_t);
- const SkPoint& offset = it.offset();
- // applyFontToPaint() always overwrites the exact same attributes,
- // so it is safe to not re-seed the paint.
- it.applyFontToPaint(&runPaint);
-
- switch (it.positioning()) {
- case SkTextBlob::kDefault_Positioning:
- this->drawText(it.glyphs(), textLen, offset.x(), offset.y(), runPaint);
- break;
- case SkTextBlob::kHorizontal_Positioning:
- this->drawPosTextH(it.glyphs(), textLen, it.pos(), offset.y(), runPaint);
- break;
- case SkTextBlob::kFull_Positioning:
- this->drawPosText(it.glyphs(), textLen, (const SkPoint*)it.pos(), runPaint);
- break;
- default:
- SkFAIL("unhandled positioning mode");
- }
+ LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
- it.next();
+ while (iter.next()) {
+ SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
+ iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint());
}
- if (x || y) {
- this->translate(-x, -y);
- }
+ LOOPER_END
}
// These will become non-virtual, so they always call the (virtual) onDraw... method
« no previous file with comments | « include/core/SkTextBlob.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698