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

Issue 166023002: fix the visual difference of raster vs gpu -- inverse_paths (Closed)

Created:
6 years, 10 months ago by yunchao
Modified:
6 years, 10 months ago
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

fix the visual difference of raster vs gpu -- inverse_paths If a path has no verbs, it is empty. If a path has verbs, but both the width and height of the bounds are zero. the path is empty too. This situation happens when you add an empty rect or circle... , say a rect{x, y, width, height} = {100, 100, 0, 0}, to a path. For 8888 config, drawPath() checked the bounds. For gpu config, it doesn't. BUG=skia:2176 Committed: http://code.google.com/p/skia/source/detail?r=13526

Patch Set 1 #

Patch Set 2 : update ignore-tests.txt #

Total comments: 2

Patch Set 3 : update code according to Brian's proposal #

Total comments: 2

Patch Set 4 : nits #

Patch Set 5 : rebase code #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -1 line) Patch
M expectations/gm/ignored-tests.txt View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 4 1 chunk +3 lines, -1 line 2 comments Download

Messages

Total messages: 14 (0 generated)
yunchao
PTAL
6 years, 10 months ago (2014-02-14 06:27:57 UTC) #1
bsalomon
https://codereview.chromium.org/166023002/diff/40001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/40001/src/core/SkCanvas.cpp#newcode1742 src/core/SkCanvas.cpp:1742: if (SkScalarNearlyZero(r.width()) && SkScalarNearlyZero(r.height())) { It's not obvious to ...
6 years, 10 months ago (2014-02-14 13:56:38 UTC) #2
yunchao
https://codereview.chromium.org/166023002/diff/40001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/40001/src/core/SkCanvas.cpp#newcode1742 src/core/SkCanvas.cpp:1742: if (SkScalarNearlyZero(r.width()) && SkScalarNearlyZero(r.height())) { On 2014/02/14 13:56:40, bsalomon ...
6 years, 10 months ago (2014-02-17 09:54:32 UTC) #3
bsalomon
I'm adding Stephen who may have an opinion on this, especially as it relates to ...
6 years, 10 months ago (2014-02-17 14:47:29 UTC) #4
yunchao
On 2014/02/17 14:47:29, bsalomon wrote: > I'm adding Stephen who may have an opinion on ...
6 years, 10 months ago (2014-02-18 06:15:16 UTC) #5
bsalomon
https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp#newcode1741 src/core/SkCanvas.cpp:1741: SkRect r = path.getBounds(); const SkRect& ?
6 years, 10 months ago (2014-02-18 17:58:10 UTC) #6
yunchao
https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp#newcode1741 src/core/SkCanvas.cpp:1741: SkRect r = path.getBounds(); On 2014/02/18 17:58:11, bsalomon wrote: ...
6 years, 10 months ago (2014-02-19 01:36:59 UTC) #7
bsalomon
On 2014/02/19 01:36:59, Richard He wrote: > https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp > File src/core/SkCanvas.cpp (right): > > https://codereview.chromium.org/166023002/diff/130001/src/core/SkCanvas.cpp#newcode1741 ...
6 years, 10 months ago (2014-02-20 19:44:18 UTC) #8
yunchao
The CQ bit was checked by yunchao.he@intel.com
6 years, 10 months ago (2014-02-21 02:38:13 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/yunchao.he@intel.com/166023002/260001
6 years, 10 months ago (2014-02-21 02:38:19 UTC) #10
commit-bot: I haz the power
Change committed as 13526
6 years, 10 months ago (2014-02-21 05:42:59 UTC) #11
reed2
https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp#newcode1751 src/core/SkCanvas.cpp:1751: if (r.width() <= 0 && r.height() <= 0) { ...
6 years, 10 months ago (2014-02-21 10:48:49 UTC) #12
yunchao
Please correct me if something is wrong. https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp#newcode1751 src/core/SkCanvas.cpp:1751: if (r.width() ...
6 years, 10 months ago (2014-02-24 03:07:20 UTC) #13
reed1
6 years, 10 months ago (2014-02-24 13:33:14 UTC) #14
Message was sent while issue was closed.
On 2014/02/24 03:07:20, Richard He wrote:
> Please correct me if something is wrong.
> 
> https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp
> File src/core/SkCanvas.cpp (right):
> 
>
https://codereview.chromium.org/166023002/diff/260001/src/core/SkCanvas.cpp#n...
> src/core/SkCanvas.cpp:1751: if (r.width() <= 0 && r.height() <= 0) {
> On 2014/02/21 10:48:49, reed2 wrote:
> > Do we have unit-tests added to exercise this?
> > Does this catch a width > 0 but height < 0 filled path (e.g. horizontal line
> as
> > a path)?
> > Do we perform the same checks on drawRect/drawOval?
> 
> Hi Mike,
> Do you think we need to add a unit-tests like tests/GpuDrawPathTest.cpp to
show
> that inverse-filling an empty path will not crash? The previous tests didn't
> test this in unit-tests too. If we want to test the images generated by
drawPath
> for inverse-filled empty path, gm/inversepaths have done this.
> 
> a width > 0 but height < 0 filled path is not included in this fix, I think.
> because It is not an empty path. It is a hairline, right? Skia can draw it
> correctly.
> 
> Rects and Ovals have no FillType if they are not added to a path, so they
didn't
> need to check this. If they are empty, just draw nothing. GM cases have tested
> empty rects/ovals too.

This is the only place in all of skia where we use the AND of width==0 and
height==0 to tell us something. I don't think it is wrong, but I think it (like
the version before perhaps) is a little misleading -- it could be read to say
"iff this condition, we should fill everything". 

For example, if only width==0 or only height==0, and the paint is FILL, then we
could also take the paint-everything path. Perhaps we can document that this is
just a quick test, but not exhaustive.

Any code/checks that we put in SkCanvas and *not* in the specific device
backends just has to be that much more clear/useful.

Powered by Google App Engine
This is Rietveld 408576698