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

Issue 317053003: Fixes for SkAlphaTypes. (Closed)

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

Description

Fixes for SkAlphaTypes. When using allocPixels to set the info and create a new pixelRef in one shot, create the pixelRef with the corrected info of the bitmap (i.e. alphatype). Simplify the check to determine whether to copy the genID in SkBitmap:: copyTo's same configs/same sizes case. The old logic (only checking the height and assuming the others must be the same) relied on a deep (mis?)understanding of the rest of the function, and I cannot convince myself that it has to be true, given that readPixels may have switched src to a different SkBitmap. Instead, just compare the SkImageInfos, which is much clearer. (This also caught a bug where a 565 bitmap had the wrong alphatype, leading to the allocPixels fixes.) If readPixels succeeds but the source is unpremultiplied, fail out of copyTo, since readPixels assumes premultiplied. When copying from 8888 to 4444 or in the fallback case of drawing, return false if the alphatype is unpremul, which would have failed anyway. BUG=skia:2012 Committed: https://skia.googlesource.com/skia/+/0187dc2155830c1ae3390d97463d5dd3971eca41

Patch Set 1 #

Total comments: 8

Patch Set 2 : Rename info parameter to requestedInfo. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -25 lines) Patch
M src/core/SkBitmap.cpp View 1 6 chunks +34 lines, -25 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
scroggo
https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp#newcode972 src/core/SkBitmap.cpp:972: if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { Brian, I've cc'ed you ...
6 years, 6 months ago (2014-06-04 20:28:26 UTC) #1
bsalomon
https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp#newcode972 src/core/SkBitmap.cpp:972: if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { On 2014/06/04 20:28:27, scroggo ...
6 years, 6 months ago (2014-06-04 20:39:31 UTC) #2
reed1
I like the renaming parts. Not sure about the unpremul part. https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): ...
6 years, 6 months ago (2014-06-05 12:38:45 UTC) #3
scroggo
https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp File src/core/SkBitmap.cpp (right): https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp#newcode416 src/core/SkBitmap.cpp:416: bool SkBitmap::allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, On 2014/06/05 12:38:45, ...
6 years, 6 months ago (2014-06-05 15:33:28 UTC) #4
reed1
On 2014/06/05 15:33:28, scroggo wrote: > https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp > File src/core/SkBitmap.cpp (right): > > https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp#newcode416 > ...
6 years, 6 months ago (2014-06-05 16:01:33 UTC) #5
scroggo
On 2014/06/05 16:01:33, reed1 wrote: > On 2014/06/05 15:33:28, scroggo wrote: > > https://codereview.chromium.org/317053003/diff/1/src/core/SkBitmap.cpp > ...
6 years, 6 months ago (2014-06-05 17:14:00 UTC) #6
reed1
On 2014/06/05 17:14:00, scroggo wrote: > On 2014/06/05 16:01:33, reed1 wrote: > > On 2014/06/05 ...
6 years, 6 months ago (2014-06-05 17:36:53 UTC) #7
scroggo
The CQ bit was checked by scroggo@google.com
6 years, 6 months ago (2014-06-05 17:59:24 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/317053003/20001
6 years, 6 months ago (2014-06-05 17:59:44 UTC) #9
commit-bot: I haz the power
6 years, 6 months ago (2014-06-05 18:18:09 UTC) #10
Message was sent while issue was closed.
Change committed as 0187dc2155830c1ae3390d97463d5dd3971eca41

Powered by Google App Engine
This is Rietveld 408576698