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

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

Issue 1760163002: Avoid drawing NVPR DIF text when text size is 0 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comment Created 4 years, 10 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/gl/GrGLPathRendering.cpp ('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 12b3f2f877a635b7635400c6c34d921a6b1b5973..ab9025d31695dc3930f30212c51aab16216edbcb 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -80,11 +80,13 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d
if (context->abandoned()) {
return;
} else if (this->canDraw(skPaint, viewMatrix)) {
- TextRun run(skPaint);
- GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
- run.setText(text, byteLength, x, y);
- run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
- clipBounds, fFallbackTextContext, skPaint);
+ if (skPaint.getTextSize() > 0) {
+ TextRun run(skPaint);
+ GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
+ run.setText(text, byteLength, x, y);
+ run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
+ clipBounds, fFallbackTextContext, skPaint);
+ }
return;
} else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props,
*context->caps()->shaderCaps())) {
@@ -113,11 +115,13 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext
if (context->abandoned()) {
return;
} else if (this->canDraw(skPaint, viewMatrix)) {
- TextRun run(skPaint);
- GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
- run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
- run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
- clipBounds, fFallbackTextContext, skPaint);
+ if (skPaint.getTextSize() > 0) {
+ TextRun run(skPaint);
+ GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
+ run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
+ run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
+ clipBounds, fFallbackTextContext, skPaint);
+ }
return;
} else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props,
*context->caps()->shaderCaps())) {
@@ -294,6 +298,9 @@ void GrStencilAndCoverTextContext::TextBlob::init(const SkTextBlob* skBlob,
SkPaint runPaint(skPaint);
for (SkTextBlobRunIterator iter(skBlob); !iter.done(); iter.next()) {
iter.applyFontToPaint(&runPaint); // No need to re-seed the paint.
+ if (runPaint.getTextSize() <= 0) {
+ continue;
+ }
TextRun* run = this->addToTail(runPaint);
const char* text = reinterpret_cast<const char*>(iter.glyphs());
@@ -352,6 +359,7 @@ GrStencilAndCoverTextContext::TextRun::TextRun(const SkPaint& fontAndStroke)
fFallbackGlyphCount(0),
fDetachedGlyphCache(nullptr),
fLastDrawnGlyphsID(SK_InvalidUniqueID) {
+ SkASSERT(fFont.getTextSize() > 0);
SkASSERT(!fStroke.isHairlineStyle()); // Hairlines are not supported.
// Setting to "fill" ensures that no strokes get baked into font outlines. (We use the GPU path
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698