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

Issue 112113005: Reland "Fix genID cloning bugs." (Closed)

Created:
7 years ago by scroggo
Modified:
6 years, 11 months ago
Reviewers:
mtklein, bsalomon, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Reland "Fix genID cloning bugs." SkBitmap.cpp: When copyTo calls readPixels, only clone the genID if the resulting SkPixelRef has the same dimensions as the original. This catches a bug where copying an SkBitmap representing the subset of an SkPixelRef (which implements onReadPixels) would result in the copy sharing the genID. (Thanks to r6710, this case can only happen using setPixelRef, so the updated GpuBitmapCopyTest checks for that.) Move some unnecessary NULL checks to asserts. When copyTo performs a memcpy, only clone the genID if the resulting SkPixelRef has the same dimensions as the original. This catches a bug where copying an extracted SkBitmap with the same width as its original SkPixelRef would incorrectly have the same genID. Add a comment and assert in deepCopyTo, when cloning the genID, since that case correctly clones it. BitmapCopyTest.cpp: Pull redundant work out of the inner loop (setting up the source bitmaps and testing extractSubset). Create a new inner loop for extractSubset, to test copying the result to each different config. Extract a subset that has the same width as the original, to catch the bug mentioned above. Remove the reporter assert which checks for the resulting rowbytes. Add checks to ensure that copying the extracted subset changes the genID. GpuBitmapCopyTest: Create an SkBitmap that shares an existing SkPixelRef, but only represents a subset. This is to test the first call to cloneGenID in SkBitmap::copyTo. In this case, the genID should NOT be copied, since only a portion of the SkPixelRef was copied. Also test deepCopy on this subset. TestIndividualCopy now takes a parameter stating whether the genID should change in the copy. It also does a read back using the appropriate subset. It no longer differentiates between copyTo and deepCopyTo, since that distinction was only necessary for copying from/to configs other than 8888 (which are no longer being tested), where copyTo did a read back in 8888 and then drew the result to the desired config (resulting in an imperfect copy). BUG=skia:1742 Committed: http://code.google.com/p/skia/source/detail?r=13021 R=mtklein@google.com Committed: https://code.google.com/p/skia/source/detail?r=13090

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Remove unnecessary include #

Total comments: 16

Patch Set 4 : Respond to comments #

Patch Set 5 : Extract extractSubset to its own test. #

Total comments: 2

Patch Set 6 : Remove braces #

Patch Set 7 : Rebase #

Patch Set 8 : Unrevert #

Patch Set 9 : Disable assert for now, from https://codereview.chromium.org/134493002/ #

Patch Set 10 : Add asserts for colortype and height #

Unified diffs Side-by-side diffs Delta from patch set Stats (+157 lines, -85 lines) Patch
M src/core/SkBitmap.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +27 lines, -5 lines 0 comments Download
M tests/BitmapCopyTest.cpp View 1 2 3 4 5 6 3 chunks +89 lines, -69 lines 0 comments Download
M tests/GpuBitmapCopyTest.cpp View 1 2 3 4 5 6 5 chunks +41 lines, -11 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
scroggo
https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp#newcode1104 src/core/SkBitmap.cpp:1104: // succeeded, the new pixel ref must be identical. ...
6 years, 11 months ago (2014-01-08 23:34:59 UTC) #1
reed1
https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp#newcode997 src/core/SkBitmap.cpp:997: if (dst->pixelRef() && this->config() == dstConfig do we need ...
6 years, 11 months ago (2014-01-09 13:04:50 UTC) #2
mtklein
https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp#newcode1045 src/core/SkBitmap.cpp:1045: SkASSERT(pixelRef != NULL); I might even move this to ...
6 years, 11 months ago (2014-01-09 15:58:06 UTC) #3
scroggo
https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp#newcode997 src/core/SkBitmap.cpp:997: if (dst->pixelRef() && this->config() == dstConfig On 2014/01/09 13:04:50, ...
6 years, 11 months ago (2014-01-09 20:45:23 UTC) #4
mtklein
https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/112113005/diff/60001/src/core/SkBitmap.cpp#newcode1048 src/core/SkBitmap.cpp:1048: if (pixelRef->info() == fPixelRef->info()) { On 2014/01/09 20:45:23, scroggo ...
6 years, 11 months ago (2014-01-09 21:29:18 UTC) #5
scroggo
https://codereview.chromium.org/112113005/diff/60001/tests/BitmapCopyTest.cpp File tests/BitmapCopyTest.cpp (right): https://codereview.chromium.org/112113005/diff/60001/tests/BitmapCopyTest.cpp#newcode244 tests/BitmapCopyTest.cpp:244: // test extractSubset On 2014/01/09 21:29:18, mtklein wrote: > ...
6 years, 11 months ago (2014-01-09 21:47:29 UTC) #6
mtklein
lgtm https://codereview.chromium.org/112113005/diff/200001/tests/BitmapCopyTest.cpp File tests/BitmapCopyTest.cpp (right): https://codereview.chromium.org/112113005/diff/200001/tests/BitmapCopyTest.cpp#newcode221 tests/BitmapCopyTest.cpp:221: { These braces probably aren't useful any more. ...
6 years, 11 months ago (2014-01-09 22:05:00 UTC) #7
scroggo
https://codereview.chromium.org/112113005/diff/200001/tests/BitmapCopyTest.cpp File tests/BitmapCopyTest.cpp (right): https://codereview.chromium.org/112113005/diff/200001/tests/BitmapCopyTest.cpp#newcode221 tests/BitmapCopyTest.cpp:221: { On 2014/01/09 22:05:00, mtklein wrote: > These braces ...
6 years, 11 months ago (2014-01-10 14:45:57 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/scroggo@google.com/112113005/250001
6 years, 11 months ago (2014-01-10 14:46:18 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/scroggo@google.com/112113005/320001
6 years, 11 months ago (2014-01-10 16:43:56 UTC) #10
commit-bot: I haz the power
Change committed as 13021
6 years, 11 months ago (2014-01-10 17:22:05 UTC) #11
caryclark
A revert of this CL has been created in https://codereview.chromium.org/134453002/ by caryclark@google.com. The reason for ...
6 years, 11 months ago (2014-01-10 18:28:05 UTC) #12
scroggo
PTAL. I have included Mike's change from https://codereview.chromium.org/134493002/
6 years, 11 months ago (2014-01-10 20:56:33 UTC) #13
scroggo
6 years, 11 months ago (2014-01-15 16:56:58 UTC) #14
Message was sent while issue was closed.
Committed patchset #10 manually as r13090 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698