diff options
author | 2011-10-05 19:57:55 +0000 | |
---|---|---|
committer | 2011-10-05 19:57:55 +0000 | |
commit | fa6ac938e64fe11b442d05fe8a90ddac2d1951f9 (patch) | |
tree | 09e1bfdb59c0549a9cff72d1551376a25e262ce7 /gpu/src | |
parent | 322878907f6c5c5fb8abdbce7d348a3cd66ff2fa (diff) |
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
Diffstat (limited to 'gpu/src')
-rw-r--r-- | gpu/src/GrContext.cpp | 12 | ||||
-rw-r--r-- | gpu/src/GrGpu.cpp | 4 | ||||
-rw-r--r-- | gpu/src/GrTesselatedPathRenderer.cpp | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp index e0c7b5559f..d9fb9e85c8 100644 --- a/gpu/src/GrContext.cpp +++ b/gpu/src/GrContext.cpp @@ -1445,6 +1445,16 @@ void GrContext::drawVertices(const GrPaint& paint, 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 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path, } } 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) { diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp index 7b98ffa0b0..850fa60c4e 100644 --- a/gpu/src/GrGpu.cpp +++ b/gpu/src/GrGpu.cpp @@ -596,8 +596,8 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { fillInverted = false; } else { fill = clip.getPathFill(c); - fillInverted = IsFillInverted(fill); - fill = NonInvertedFill(fill); + fillInverted = GrIsFillInverted(fill); + fill = GrNonInvertedFill(fill); clipPath = &clip.getPath(c); pr = this->getClipPathRenderer(*clipPath, fill); if (NULL == pr) { diff --git a/gpu/src/GrTesselatedPathRenderer.cpp b/gpu/src/GrTesselatedPathRenderer.cpp index 5d544f2912..3c4bb0100c 100644 --- a/gpu/src/GrTesselatedPathRenderer.cpp +++ b/gpu/src/GrTesselatedPathRenderer.cpp @@ -366,7 +366,7 @@ void GrTesselatedPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) { } } - bool inverted = IsFillInverted(fFill); + bool inverted = GrIsFillInverted(fFill); if (inverted) { maxPts += 4; subpathCnt++; |