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

Unified Diff: src/gpu/GrContext.cpp

Issue 22173002: Fix a crash on stroking empty paths with nv_path_rendering enabled (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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/GrClipMaskManager.cpp ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 0d98ecd3204639a26a1a977f18dbe2998d8221f0..20c633dc67878d09bc9cff88e82cb04a2f72da1c 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -25,6 +25,7 @@
#include "GrStencilBuffer.h"
#include "GrTextStrike.h"
#include "SkRTConf.h"
+#include "SkRRect.h"
#include "SkStrokeRec.h"
#include "SkTLazy.h"
#include "SkTLS.h"
@@ -952,6 +953,9 @@ void GrContext::drawVertices(const GrPaint& paint,
void GrContext::drawRRect(const GrPaint& paint,
const SkRRect& rect,
const SkStrokeRec& stroke) {
+ if (rect.isEmpty()) {
+ return;
+ }
AutoRestoreEffects are;
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are);
@@ -972,6 +976,9 @@ void GrContext::drawRRect(const GrPaint& paint,
void GrContext::drawOval(const GrPaint& paint,
const SkRect& oval,
const SkStrokeRec& stroke) {
+ if (oval.isEmpty()) {
+ return;
+ }
AutoRestoreEffects are;
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are);
@@ -1082,6 +1089,7 @@ void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrok
void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
const SkStrokeRec& stroke) {
+ SkASSERT(!path.isEmpty());
// An Assumption here is that path renderer would use some form of tweaking
// the src color (either the input alpha or in the frag shader) to implement
@@ -1112,6 +1120,10 @@ void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
strokeRec.setFillStyle();
}
}
+ if (pathPtr->isEmpty()) {
+ return;
+ }
+
// This time, allow SW renderer
pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type);
}
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698