Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c096654

Browse files
csmartdalton86Skia Commit-Bot
authored andcommitted
ccpr: Don't assign inverse fill types to fan tessellations
Bug: skia:9453 Change-Id: Iabbd1089975efff4e89687e990128c075bf0ab9d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243432 Commit-Queue: Chris Dalton <[email protected]> Reviewed-by: Florin Malita <[email protected]>
1 parent b4b1005 commit c096654

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

gm/inverseclip.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2019 Google LLC.
3+
*
4+
* Use of this source code is governed by a BSD-style license that can be
5+
* found in the LICENSE file.
6+
*/
7+
8+
#include "gm/gm.h"
9+
#include "include/core/SkCanvas.h"
10+
#include "include/core/SkPath.h"
11+
12+
// Repro case for http://skbug.com/9453
13+
DEF_SIMPLE_GM(inverseclip, canvas, 400, 400) {
14+
SkPath clip;
15+
clip.setFillType(SkPath::kInverseWinding_FillType);
16+
clip.moveTo(195.448f, 31);
17+
clip.cubicTo(97.9925f, 31, 18.99f, 105.23f, 18.99f, 196.797f);
18+
clip.cubicTo(18.99f, 288.365f, 97.9925f, 362.595f, 195.448f, 362.595f);
19+
clip.cubicTo(292.905f, 362.595f, 371.905f, 288.365f, 371.905f, 196.797f);
20+
clip.cubicTo(371.905f, 105.23f, 292.905f, 31, 195.448f, 31);
21+
clip.close();
22+
canvas->clipPath(clip, true);
23+
24+
SkPaint paint;
25+
paint.setColor(SK_ColorBLUE);
26+
canvas->drawRect(SkRect::MakeWH(400, 400), paint);
27+
}

gn/gm.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ gm_sources = [
217217
"$_gm/imagesource2.cpp",
218218
"$_gm/internal_links.cpp",
219219
"$_gm/inversepaths.cpp",
220+
"$_gm/inverseclip.cpp",
220221
"$_gm/jpg_color_cube.cpp",
221222
"$_gm/labyrinth.cpp",
222223
"$_gm/largeglyphblur.cpp",

src/gpu/ccpr/GrCCFiller.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ void GrCCFiller::PathInfo::tessellateFan(
137137
// count to the appropriate fill type later.
138138
fan.setFillType(SkPath::kWinding_FillType);
139139
} else {
140-
// When counting winding numbers in the stencil buffer, it works to just tessellate the
141-
// Redbook fan with the same fill type as the path.
142-
fan.setFillType(originalPath.getFillType());
140+
// When counting winding numbers in the stencil buffer, it works to use even/odd for the fan
141+
// tessellation (where applicable). But we need to strip out inverse fill info because
142+
// inverse-ness gets accounted for later on.
143+
fan.setFillType(SkPath::ConvertToNonInverseFillType(originalPath.getFillType()));
143144
}
144145
SkASSERT(Verb::kBeginPath == verbs[verbsIdx]);
145146
for (int i = verbsIdx + 1; i < verbs.count(); ++i) {
@@ -175,9 +176,10 @@ void GrCCFiller::PathInfo::tessellateFan(
175176
}
176177

177178
GrTessellator::WindingVertex* vertices = nullptr;
178-
fFanTessellationCount =
179-
GrTessellator::PathToVertices(fan, std::numeric_limits<float>::infinity(),
180-
SkRect::Make(clippedDevIBounds), &vertices);
179+
SkASSERT(!fan.isInverseFillType());
180+
fFanTessellationCount = GrTessellator::PathToVertices(
181+
fan, std::numeric_limits<float>::infinity(), SkRect::Make(clippedDevIBounds),
182+
&vertices);
181183
if (fFanTessellationCount <= 0) {
182184
SkASSERT(0 == fFanTessellationCount);
183185
SkASSERT(nullptr == vertices);

0 commit comments

Comments
 (0)