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

Unified Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 1178383003: Revert of Make GrTextContext be owned by the GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStencilAndCoverTextContext.cpp
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index d1b6a846b0b5dccc14047aef759d149966be05d6..763863fe758915705df47180e3aa222e003ea514 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -22,21 +22,18 @@
#include "SkTextFormatParams.h"
GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context,
- GrDrawContext* drawContext,
const SkDeviceProperties& properties)
- : GrTextContext(context, drawContext, properties)
+ : GrTextContext(context, properties)
, fStroke(SkStrokeRec::kFill_InitStyle)
, fQueuedGlyphCount(0)
, fFallbackGlyphsIdx(kGlyphBufferSize) {
}
GrStencilAndCoverTextContext*
-GrStencilAndCoverTextContext::Create(GrContext* context, GrDrawContext* drawContext,
- const SkDeviceProperties& props, bool fallbackUsesDFT) {
+GrStencilAndCoverTextContext::Create(GrContext* context, const SkDeviceProperties& props) {
GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext,
- (context, drawContext, props));
- textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, drawContext,
- props, fallbackUsesDFT);
+ (context, props));
+ textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, props, false);
return textContext;
}
@@ -74,7 +71,7 @@
return rec.getFormat() != SkMask::kARGB32_Format;
}
-void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
+void GrStencilAndCoverTextContext::onDrawText(GrDrawContext* drawContext, GrRenderTarget* rt,
const GrClip& clip,
const GrPaint& paint,
const SkPaint& skPaint,
@@ -157,17 +154,19 @@
const SkGlyph& glyph = glyphCacheProc(fGlyphCache, &text, 0, 0);
fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio);
if (glyph.fWidth) {
- this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy)));
+ this->appendGlyph(drawContext, glyph,
+ SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy)));
}
fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio);
fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio);
}
- this->finish();
-}
-
-void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
+ this->finish(drawContext);
+}
+
+void GrStencilAndCoverTextContext::onDrawPosText(GrDrawContext* drawContext,
+ GrRenderTarget* rt,
const GrClip& clip,
const GrPaint& paint,
const SkPaint& skPaint,
@@ -211,12 +210,12 @@
SkPoint loc;
alignProc(tmsLoc, glyph, &loc);
- this->appendGlyph(glyph, loc);
+ this->appendGlyph(drawContext, glyph, loc);
}
pos += scalarsPerPosition;
}
- this->finish();
+ this->finish(drawContext);
}
static GrPathRange* get_gr_glyphs(GrContext* ctx,
@@ -411,10 +410,11 @@
return true;
}
-inline void GrStencilAndCoverTextContext::appendGlyph(const SkGlyph& glyph, const SkPoint& pos) {
+inline void GrStencilAndCoverTextContext::appendGlyph(GrDrawContext* drawContext,
+ const SkGlyph& glyph, const SkPoint& pos) {
if (fQueuedGlyphCount >= fFallbackGlyphsIdx) {
SkASSERT(fQueuedGlyphCount == fFallbackGlyphsIdx);
- this->flush();
+ this->flush(drawContext);
}
// Stick the glyphs we can't draw at the end of the buffer, growing backwards.
@@ -432,17 +432,17 @@
return &pointArray[0].fX;
}
-void GrStencilAndCoverTextContext::flush() {
+void GrStencilAndCoverTextContext::flush(GrDrawContext* drawContext) {
if (fQueuedGlyphCount > 0) {
SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor(),
fViewMatrix,
fLocalMatrix));
- fDrawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs,
- fGlyphIndices, GrPathRange::kU16_PathIndexType,
- get_xy_scalar_array(fGlyphPositions),
- GrPathRendering::kTranslate_PathTransformType,
- fQueuedGlyphCount, GrPathRendering::kWinding_FillType);
+ drawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs,
+ fGlyphIndices, GrPathRange::kU16_PathIndexType,
+ get_xy_scalar_array(fGlyphPositions),
+ GrPathRendering::kTranslate_PathTransformType,
+ fQueuedGlyphCount, GrPathRendering::kWinding_FillType);
fQueuedGlyphCount = 0;
}
@@ -474,8 +474,8 @@
}
}
-void GrStencilAndCoverTextContext::finish() {
- this->flush();
+void GrStencilAndCoverTextContext::finish(GrDrawContext* drawContext) {
+ this->flush(drawContext);
fGlyphs->unref();
fGlyphs = NULL;
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698