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

Unified Diff: src/gpu/GrTextContext.cpp

Issue 650273003: Change GrTextContext fallbacks to be a linked list chain. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix include Created 6 years, 2 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/gpu/GrTextContext.h ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextContext.cpp
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index d281173dca5d95d12a870e77784471b1220afb89..94c05a712439a8c8498c899a0059574df4c9e187 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -13,9 +13,14 @@
#include "GrFontScaler.h"
GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& properties) :
+ fFallbackTextContext(NULL),
fContext(context), fDeviceProperties(properties), fDrawTarget(NULL) {
}
+GrTextContext::~GrTextContext() {
+ SkDELETE(fFallbackTextContext);
+}
+
void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) {
const GrClipData* clipData = fContext->getClip();
@@ -35,6 +40,41 @@ void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) {
fSkPaint = skPaint;
}
+bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint,
+ const char text[], size_t byteLength,
+ SkScalar x, SkScalar y) {
+
+ GrTextContext* textContext = this;
+ do {
+ if (textContext->canDraw(skPaint)) {
+ textContext->onDrawText(paint, skPaint, text, byteLength, x, y);
+ return true;
+ }
+ textContext = textContext->fFallbackTextContext;
+ } while (textContext);
+
+ return false;
+}
+
+bool GrTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset) {
+
+ GrTextContext* textContext = this;
+ do {
+ if (textContext->canDraw(skPaint)) {
+ textContext->onDrawPosText(paint, skPaint, text, byteLength, pos, scalarsPerPosition,
+ offset);
+ return true;
+ }
+ textContext = textContext->fFallbackTextContext;
+ } while (textContext);
+
+ return false;
+}
+
+
//*** change to output positions?
void GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
const char text[], size_t byteLength, SkVector* stopVector) {
« no previous file with comments | « src/gpu/GrTextContext.h ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698