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

Unified Diff: src/gpu/text/GrStencilAndCoverTextContext.cpp

Issue 2165673002: Minor cleanup of GrStencilAndCoverTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Surprise! Created 4 years, 5 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/text/GrStencilAndCoverTextContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/text/GrStencilAndCoverTextContext.cpp
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 632bdcdaf195b4affb6c7a5a0e95461386d05132..381aa302824c0897c2cd9764113ae1ab99e53044 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -83,7 +83,7 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d
if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setText(text, byteLength, x, y);
- run.draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, 0, 0,
+ run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
@@ -117,7 +117,7 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext
if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
- run.draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, 0, 0,
+ run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
@@ -226,7 +226,9 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex
TextBlob::Iter iter(blob);
for (TextRun* run = iter.get(); run; run = iter.next()) {
- run->draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, x, y,
+ // The run's "font" overrides the anti-aliasing of the passed in paint!
+ paint.setAntiAlias(run->isAntiAlias());
+ run->draw(context, dc, paint, clip, viewMatrix, props, x, y,
clipBounds, fFallbackTextContext, skPaint);
run->releaseGlyphCache();
}
@@ -362,12 +364,12 @@ private:
////////////////////////////////////////////////////////////////////////////////////////////////////
GrStencilAndCoverTextContext::TextRun::TextRun(const SkPaint& fontAndStroke)
- : fStyle(fontAndStroke),
- fFont(fontAndStroke),
- fTotalGlyphCount(0),
- fFallbackGlyphCount(0),
- fDetachedGlyphCache(nullptr),
- fLastDrawnGlyphsID(SK_InvalidUniqueID) {
+ : fStyle(fontAndStroke)
+ , fFont(fontAndStroke)
+ , fTotalGlyphCount(0)
+ , fFallbackGlyphCount(0)
+ , fDetachedGlyphCache(nullptr)
+ , fLastDrawnGlyphsID(SK_InvalidUniqueID) {
SkASSERT(fFont.getTextSize() > 0);
SkASSERT(!fStyle.hasNonDashPathEffect()); // Arbitrary path effects not supported.
SkASSERT(!fStyle.isSimpleHairline()); // Hairlines are not supported.
@@ -599,7 +601,6 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
GrDrawContext* drawContext,
const GrPaint& grPaint,
const GrClip& clip,
- GrColor color,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
SkScalar x, SkScalar y,
@@ -607,7 +608,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
GrAtlasTextContext* fallbackTextContext,
const SkPaint& originalSkPaint) const {
SkASSERT(fInstanceData);
- SkASSERT(drawContext->isStencilBufferMultisampled() || !fFont.isAntiAlias());
+ SkASSERT(drawContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias());
if (fInstanceData->count()) {
static constexpr GrUserStencilSettings kCoverPass(
@@ -636,12 +637,12 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
SkAutoTUnref<GrDrawBatch> batch(
GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x,
- fTextInverseRatio * y, color,
+ fTextInverseRatio * y, grPaint.getColor(),
GrPathRendering::kWinding_FillType, glyphs, fInstanceData,
bounds));
GrPipelineBuilder pipelineBuilder(grPaint);
- pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.isAntiAlias());
+ pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
drawContext->drawBatch(pipelineBuilder, clip, batch);
« no previous file with comments | « src/gpu/text/GrStencilAndCoverTextContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698