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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 145023006: Revert of Add factory class for generating various flavors of GrTextContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 0e91182f9d3f5fabbb0f26a44b00a0a10c27c948..5ba174cafcc53e9f483b7844c1f1d98b173629ac 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -200,12 +200,6 @@
fContext = context;
fContext->ref();
-#if SK_DISTANCEFIELD_FONTS
- fTextContextManager = SkNEW(GrTTextContextManager<GrDistanceFieldTextContext>);
-#else
- fTextContextManager = SkNEW(GrTTextContextManager<GrBitmapTextContext>);
-#endif
-
fRenderTarget = NULL;
fNeedClear = false;
@@ -241,12 +235,6 @@
fContext = context;
fContext->ref();
-#if SK_DISTANCEFIELD_FONTS
- fTextContextManager = SkNEW(GrTTextContextManager<GrDistanceFieldTextContext>);
-#else
- fTextContextManager = SkNEW(GrTTextContextManager<GrBitmapTextContext>);
-#endif
-
fRenderTarget = NULL;
fNeedClear = false;
@@ -291,8 +279,6 @@
if (fDrawProcs) {
delete fDrawProcs;
}
-
- delete fTextContextManager;
// The GrContext takes a ref on the target. We don't want to cause the render
// target to be unnecessarily kept alive.
@@ -1834,15 +1820,13 @@
SkDEBUGCODE(this->validate();)
- SkAutoTDelete<GrTextContext> context(fTextContextManager->create(fContext, grPaint, paint));
- GrDistanceFieldTextContext* dfContext =
- static_cast<GrDistanceFieldTextContext*>(context.get());
-
- SkAutoGlyphCache autoCache(dfContext->getSkPaint(), &this->fLeakyProperties, NULL);
+ GrDistanceFieldTextContext context(fContext, grPaint, paint);
+
+ SkAutoGlyphCache autoCache(context.getSkPaint(), &this->fLeakyProperties, NULL);
SkGlyphCache* cache = autoCache.getCache();
GrFontScaler* fontScaler = get_gr_font_scaler(cache);
- dfContext->drawText((const char *)text, byteLength, x, y, cache, fontScaler);
+ context.drawText((const char *)text, byteLength, x, y, cache, fontScaler);
#endif
} else {
SkDraw myDraw(draw);
@@ -1852,8 +1836,8 @@
return;
}
- SkAutoTDelete<GrTextContext> context(fTextContextManager->create(fContext, grPaint, paint));
- myDraw.fProcs = this->initDrawForText(context.get());
+ GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ myDraw.fProcs = this->initDrawForText(&context);
this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
}
}
@@ -1877,15 +1861,13 @@
SkDEBUGCODE(this->validate();)
- SkAutoTDelete<GrTextContext> context(fTextContextManager->create(fContext, grPaint, paint));
- GrDistanceFieldTextContext* dfContext =
- static_cast<GrDistanceFieldTextContext*>(context.get());
-
- SkAutoGlyphCache autoCache(dfContext->getSkPaint(), &this->fLeakyProperties, NULL);
+ GrDistanceFieldTextContext context(fContext, grPaint, paint);
+
+ SkAutoGlyphCache autoCache(context.getSkPaint(), &this->fLeakyProperties, NULL);
SkGlyphCache* cache = autoCache.getCache();
GrFontScaler* fontScaler = get_gr_font_scaler(cache);
-
- dfContext->drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos,
+
+ context.drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos,
cache, fontScaler);
#endif
} else {
@@ -1895,9 +1877,8 @@
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return;
}
-
- SkAutoTDelete<GrTextContext> context(fTextContextManager->create(fContext, grPaint, paint));
- myDraw.fProcs = this->initDrawForText(context.get());
+ GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ myDraw.fProcs = this->initDrawForText(&context);
this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
scalarsPerPos, paint);
}
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698