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

Issue 377303002: add readPixels() to SkBitmap (Closed)

Created:
6 years, 5 months ago by reed1
Modified:
6 years, 5 months ago
Reviewers:
scroggo, bsalomon
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 2

Patch Set 2 : implement #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 18

Patch Set 5 : update comments #

Patch Set 6 : add tests for subsetting, and then fix the bug it (and leon) found #

Total comments: 2

Patch Set 7 : fix spelling in comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+346 lines, -141 lines) Patch
M include/core/SkBitmap.h View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 3 4 1 chunk +11 lines, -10 lines 0 comments Download
M src/core/SkBitmap.cpp View 1 2 3 4 5 3 chunks +71 lines, -56 lines 0 comments Download
M src/core/SkBitmapDevice.cpp View 1 3 chunks +2 lines, -74 lines 0 comments Download
M src/core/SkConfig8888.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M src/core/SkConfig8888.cpp View 1 2 3 4 5 2 chunks +142 lines, -0 lines 0 comments Download
M tests/BitmapCopyTest.cpp View 1 2 3 4 5 6 2 chunks +94 lines, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
reed1
6 years, 5 months ago (2014-07-09 15:03:08 UTC) #1
scroggo
https://codereview.chromium.org/377303002/diff/1/include/core/SkBitmap.h File include/core/SkBitmap.h (right): https://codereview.chromium.org/377303002/diff/1/include/core/SkBitmap.h#newcode612 include/core/SkBitmap.h:612: bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, ...
6 years, 5 months ago (2014-07-09 15:22:02 UTC) #2
reed1
https://codereview.chromium.org/377303002/diff/1/include/core/SkBitmap.h File include/core/SkBitmap.h (right): https://codereview.chromium.org/377303002/diff/1/include/core/SkBitmap.h#newcode612 include/core/SkBitmap.h:612: bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, ...
6 years, 5 months ago (2014-07-10 14:10:40 UTC) #3
reed1
ptal
6 years, 5 months ago (2014-07-10 15:09:38 UTC) #4
scroggo
https://codereview.chromium.org/377303002/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/377303002/diff/60001/src/core/SkBitmap.cpp#newcode860 src/core/SkBitmap.cpp:860: if (0 == dstInfo.width() || 0 == dstInfo.height()) { ...
6 years, 5 months ago (2014-07-10 15:09:49 UTC) #5
reed1
https://codereview.chromium.org/377303002/diff/60001/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/377303002/diff/60001/src/core/SkBitmap.cpp#newcode860 src/core/SkBitmap.cpp:860: if (0 == dstInfo.width() || 0 == dstInfo.height()) { ...
6 years, 5 months ago (2014-07-10 15:32:16 UTC) #6
reed1
ptal
6 years, 5 months ago (2014-07-10 18:19:44 UTC) #7
scroggo
LGTM nit: Could you put BUG=chromium:390782 in the description? (I'd be fine without that since ...
6 years, 5 months ago (2014-07-10 20:01:40 UTC) #8
reed1
https://codereview.chromium.org/377303002/diff/100001/tests/BitmapCopyTest.cpp File tests/BitmapCopyTest.cpp (right): https://codereview.chromium.org/377303002/diff/100001/tests/BitmapCopyTest.cpp#newcode596 tests/BitmapCopyTest.cpp:596: // If fExpectedSucceds, check these, otherwise ignore On 2014/07/10 ...
6 years, 5 months ago (2014-07-10 20:06:09 UTC) #9
reed1
The CQ bit was checked by reed@google.com
6 years, 5 months ago (2014-07-10 20:06:26 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/reed@google.com/377303002/120001
6 years, 5 months ago (2014-07-10 20:07:16 UTC) #11
commit-bot: I haz the power
Change committed as c4f216151b6ade70c35fade09a353052f40236b1
6 years, 5 months ago (2014-07-10 21:16:02 UTC) #12
jcgregorio
On 2014/07/10 21:16:02, I haz the power (commit-bot) wrote: > Change committed as c4f216151b6ade70c35fade09a353052f40236b1 This ...
6 years, 5 months ago (2014-07-11 14:33:12 UTC) #13
jcgregorio
A revert of this CL has been created in https://codereview.chromium.org/382243003/ by jcgregorio@google.com. The reason for ...
6 years, 5 months ago (2014-07-11 14:47:58 UTC) #14
scroggo
6 years, 5 months ago (2014-07-11 15:40:15 UTC) #15
Message was sent while issue was closed.
On 2014/07/11 14:47:58, jcgregorio wrote:
> A revert of this CL has been created in
> https://codereview.chromium.org/382243003/ by mailto:jcgregorio@google.com.
> 
> The reason for reverting is: Maybe causing crashes in bench.
> 
>
http://108.170.220.120:10117/builders/Test-ChromeOS-Daisy-MaliT604-Arm7-Debug....

I find it weird that this doesn't seem to be happening consistently. I am unable
to reproduce locally. That said, it
looks like we always crash in the test premul_and_unpremul_alpha_BGRA_8888, with
the assertion:

  SkAssert(r <= a)

inside SkColorPriv.h's SkPMColorAssert. This would mean we're trying to use a
color that is not premultiplied. The only
place this function is called is in various SkBlitRow files, leading me to
believe we're attempting to draw with an
unpremultiplied color. Looking at the test a little bit, it appears we use
SkColorSetARGB to set colors in an SkBitmap.
This seems wrong, given that the function/macro returns an SkColor, whereas the
address it is assigned to expects an
SkPMColor. Unlike SkPackARGB32, this function does not assert that the color is
a valid premultiplied color (since
the expectation is that it will be converted from an SkColor later). I've made
some comments in the CL that
introduced that part of the test (see
https://codereview.chromium.org/199413013/#msg20). Brian pointed out that the
test actually wants unpremultiplied data, in which case I think we should be
setting the colortype properly. I'm
guessing that this CL resulted in attempting to draw that data. The fact that it
happens inconsistently is also
worrying though.

Powered by Google App Engine
This is Rietveld 408576698