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

Unified Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 1157773003: Move SkGpuDevice::internalDrawPath to GrBlurUtils::drawPathWithMaskFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 7 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 539d73174382432dfa5e76320791807d49a088a3..4d34cf47bab9046116a792d6afc5ec5c50c55257 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -22,21 +22,18 @@
#include "SkTextFormatParams.h"
GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context,
- SkGpuDevice* gpuDevice,
const SkDeviceProperties& properties)
- : GrTextContext(context, gpuDevice, properties)
+ : GrTextContext(context, properties)
, fStroke(SkStrokeRec::kFill_InitStyle)
, fQueuedGlyphCount(0)
, fFallbackGlyphsIdx(kGlyphBufferSize) {
}
GrStencilAndCoverTextContext*
-GrStencilAndCoverTextContext::Create(GrContext* context, SkGpuDevice* gpuDevice,
- const SkDeviceProperties& props) {
+GrStencilAndCoverTextContext::Create(GrContext* context, const SkDeviceProperties& props) {
GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext,
- (context, gpuDevice, props));
- textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, gpuDevice, props,
- false);
+ (context, props));
+ textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, props, false);
return textContext;
}
@@ -74,7 +71,7 @@ bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
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 @@ void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
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();
+ this->finish(drawContext);
}
-void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
+void GrStencilAndCoverTextContext::onDrawPosText(GrDrawContext* drawContext,
+ GrRenderTarget* rt,
const GrClip& clip,
const GrPaint& paint,
const SkPaint& skPaint,
@@ -211,12 +210,12 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
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,
@@ -409,10 +408,11 @@ bool GrStencilAndCoverTextContext::mapToFallbackContext(SkMatrix* inverse) {
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.
@@ -430,17 +430,12 @@ static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) {
return &pointArray[0].fX;
}
-void GrStencilAndCoverTextContext::flush() {
+void GrStencilAndCoverTextContext::flush(GrDrawContext* drawContext) {
if (fQueuedGlyphCount > 0) {
SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor(),
fViewMatrix,
fLocalMatrix));
- GrDrawContext* drawContext = fContext->drawContext();
- if (!drawContext) {
- return;
- }
-
drawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs,
fGlyphIndices, GrPathRange::kU16_PathIndexType,
get_xy_scalar_array(fGlyphPositions),
@@ -477,8 +472,8 @@ void GrStencilAndCoverTextContext::flush() {
}
}
-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