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

Unified Diff: src/gpu/batches/GrAAStrokeRectBatch.cpp

Issue 1936073003: When filling nested rect path check for empty inner and empty outer rects (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rm skpath.h include Created 4 years, 8 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/batches/GrAAStrokeRectBatch.h ('k') | src/gpu/batches/GrRectBatchFactory.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAAStrokeRectBatch.cpp
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp
index e4c40624cf18fdf7e894a942ae71304a175b88ec..cc5440871fbead19c04b231d5a29168dd07890c8 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp
@@ -580,15 +580,14 @@ static void compute_rects(SkRect* devOutside, SkRect* devOutsideAssist, SkRect*
namespace GrAAStrokeRectBatch {
-GrDrawBatch* Create(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& devOutside,
- const SkRect& devOutsideAssist,
- const SkRect& devInside,
- bool miterStroke,
- bool degenerate) {
- AAStrokeRectBatch* batch = AAStrokeRectBatch::Create(viewMatrix, miterStroke);
- batch->append(color, devOutside, devOutsideAssist, devInside, degenerate);
+GrDrawBatch* CreateFillBetweenRects(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& devOutside,
+ const SkRect& devInside) {
+ SkASSERT(!devOutside.isEmpty())
+ SkASSERT(!devInside.isEmpty())
+ AAStrokeRectBatch* batch = AAStrokeRectBatch::Create(viewMatrix, true);
+ batch->append(color, devOutside, devOutside, devInside, false);
batch->init();
return batch;
}
@@ -643,19 +642,21 @@ bool Append(GrBatch* origBatch,
DRAW_BATCH_TEST_DEFINE(AAStrokeRectBatch) {
bool miterStroke = random->nextBool();
- // Create mock stroke rect
- SkRect outside = GrTest::TestRect(random);
- SkScalar minDim = SkMinScalar(outside.width(), outside.height());
- SkScalar strokeWidth = minDim * 0.1f;
- SkRect outsideAssist = outside;
- outsideAssist.outset(strokeWidth, strokeWidth);
- SkRect inside = outside;
- inside.inset(strokeWidth, strokeWidth);
+ // Create either a empty rect or a non-empty rect.
+ SkRect rect = random->nextBool() ? SkRect::MakeXYWH(10, 10, 50, 40) :
+ SkRect::MakeXYWH(6, 7, 0, 0);
+ SkScalar minDim = SkMinScalar(rect.width(), rect.height());
+ SkScalar strokeWidth = random->nextUScalar1() * minDim;
GrColor color = GrRandomColor(random);
- return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outside, outsideAssist,
- inside, miterStroke, inside.isFinite() && inside.isEmpty());
+ SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
+ rec.setStrokeStyle(strokeWidth);
+ rec.setStrokeParams(SkPaint::kButt_Cap,
+ miterStroke ? SkPaint::kMiter_Join : SkPaint::kBevel_Join,
+ 1.f);
+ SkMatrix matrix = GrTest::TestMatrixRectStaysRect(random);
+ return GrAAStrokeRectBatch::Create(color, matrix, rect, rec);
}
#endif
« no previous file with comments | « src/gpu/batches/GrAAStrokeRectBatch.h ('k') | src/gpu/batches/GrRectBatchFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698