Fixup rendering of empty paths (including inverted fills)
Add GM and Sample that draw empty paths with various styles and fills
Review URL: http://codereview.appspot.com/5185047/
git-svn-id: http://skia.googlecode.com/svn/trunk@2414 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index e0c7b55..d9fb9e8 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -1445,6 +1445,16 @@
void GrContext::drawPath(const GrPaint& paint, const GrPath& path,
GrPathFill fill, const GrPoint* translate) {
+ if (path.isEmpty()) {
+#if GR_DEBUG
+ GrPrintf("Empty path should have been caught by canvas.\n");
+#endif
+ if (GrIsFillInverted(fill)) {
+ this->drawPaint(paint);
+ }
+ return;
+ }
+
GrDrawTarget* target = this->prepareToDraw(paint, kUnbuffered_DrawCategory);
// An Assumption here is that path renderer would use some form of tweaking
@@ -1503,7 +1513,7 @@
}
}
this->cleanupOffscreenAA(target, pr, &record);
- if (IsFillInverted(fill) && bound != clipIBounds) {
+ if (GrIsFillInverted(fill) && bound != clipIBounds) {
GrDrawTarget::AutoDeviceCoordDraw adcd(target, stageMask);
GrRect rect;
if (clipIBounds.fTop < bound.fTop) {