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

Issue 12730010: Fix rounding rules for skia operations to work with non-integer scaling factors. (Closed)

Created:
7 years, 9 months ago by kevers
Modified:
7 years, 9 months ago
Reviewers:
pkotwicz, oshima, sky
CC:
chromium-reviews, rsesek+watch_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Fix rounding rules for skia operations to work with non-integer scaling factors. Previously, sizes were truncated on scale up. This works for integer scale factors, but fails when the scaled value is non-integer. Instead, sizes should round up to align with image assets provided for scaled sizes. For tiled operations where we wish to extract a subimage of a given size, the origin of the subregion should be rounded down and the size rounded up. This aligns Rect based size calculations with the expected image size for a scaled resource. BUG=179884 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=188434

Patch Set 1 #

Total comments: 6

Patch Set 2 : Apply consistent rounding rules for skia ops. #

Patch Set 3 : Revert changes to skbitmap. #

Patch Set 4 : Cosmetic tweaks. #

Patch Set 5 : Fix cropping. #

Patch Set 6 : Update sizes. #

Total comments: 8

Patch Set 7 : Fix nits. #

Total comments: 1

Patch Set 8 : Expand on comment. #

Patch Set 9 : Enforce consistent rounding. #

Patch Set 10 : Fix CRLF line ending. #

Patch Set 11 : Remvove extra blank line. #

Total comments: 8

Patch Set 12 : Revert change to ButtonImageSource since the image and mask can be different sizes. #

Patch Set 13 : Move CropImageSkiaRep functionality back into ExtractSubsetImageSource. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -7 lines) Patch
M ui/gfx/canvas.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/image/image_skia_operations.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +19 lines, -6 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
kevers
Hi Peter, Can you please take a look at this CL.
7 years, 9 months ago (2013-03-11 21:08:20 UTC) #1
pkotwicz
https://codereview.chromium.org/12730010/diff/1/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/1/ui/gfx/image/image_skia_operations.cc#newcode226 ui/gfx/image/image_skia_operations.cc:226: gfx::Point point = gfx::ToFlooredPoint(gfx::ScalePoint( You should create a generic ...
7 years, 9 months ago (2013-03-12 15:54:37 UTC) #2
kevers
https://chromiumcodereview.appspot.com/12730010/diff/1/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://chromiumcodereview.appspot.com/12730010/diff/1/ui/gfx/image/image_skia_operations.cc#newcode226 ui/gfx/image/image_skia_operations.cc:226: gfx::Point point = gfx::ToFlooredPoint(gfx::ScalePoint( On 2013/03/12 15:54:37, pkotwicz wrote: ...
7 years, 9 months ago (2013-03-12 22:02:25 UTC) #3
pkotwicz
LGTM with Nits However, please explain as to why you are using ToEnclosingRect(). https://codereview.chromium.org/12730010/diff/7003/ui/gfx/image/image_skia_operations.cc File ...
7 years, 9 months ago (2013-03-13 04:03:48 UTC) #4
kevers
+sky for OWNERS https://codereview.chromium.org/12730010/diff/7003/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/7003/ui/gfx/image/image_skia_operations.cc#newcode37 ui/gfx/image/image_skia_operations.cc:37: ImageSkiaRep CropBitmap(ImageSkiaRep& source, gfx::Rect& bounds) { ...
7 years, 9 months ago (2013-03-13 14:36:59 UTC) #5
oshima
https://codereview.chromium.org/12730010/diff/16001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/16001/ui/gfx/image/image_skia_operations.cc#newcode79 ui/gfx/image/image_skia_operations.cc:79: int dh = first_rep.pixel_height() - second_rep.pixel_height(); drive-by question: where ...
7 years, 9 months ago (2013-03-13 14:47:52 UTC) #6
kevers
On 2013/03/13 14:47:52, oshima wrote: > https://codereview.chromium.org/12730010/diff/16001/ui/gfx/image/image_skia_operations.cc > File ui/gfx/image/image_skia_operations.cc (right): > > https://codereview.chromium.org/12730010/diff/16001/ui/gfx/image/image_skia_operations.cc#newcode79 > ...
7 years, 9 months ago (2013-03-13 15:02:57 UTC) #7
oshima
On Wed, Mar 13, 2013 at 8:02 AM, <kevers@chromium.org> wrote: > On 2013/03/13 14:47:52, oshima ...
7 years, 9 months ago (2013-03-13 15:24:43 UTC) #8
kevers
Updated comment explaining source of potential size mismatch.
7 years, 9 months ago (2013-03-13 15:26:11 UTC) #9
kevers
Added comments inline... On 2013/03/13 15:24:43, oshima wrote: > On Wed, Mar 13, 2013 at ...
7 years, 9 months ago (2013-03-13 15:37:08 UTC) #10
oshima
On 2013/03/13 15:37:08, kevers wrote: > Added comments inline... > > > On 2013/03/13 15:24:43, ...
7 years, 9 months ago (2013-03-13 16:13:59 UTC) #11
kevers
Imposed consistent rounding rules to avoid size mismatches.
7 years, 9 months ago (2013-03-13 18:18:31 UTC) #12
oshima
https://chromiumcodereview.appspot.com/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://chromiumcodereview.appspot.com/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode285 ui/gfx/image/image_skia_operations.cc:285: class ButtonImageSource: public BinaryImageSource { I vaguely remember that ...
7 years, 9 months ago (2013-03-13 22:08:53 UTC) #13
kevers
https://chromiumcodereview.appspot.com/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://chromiumcodereview.appspot.com/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode285 ui/gfx/image/image_skia_operations.cc:285: class ButtonImageSource: public BinaryImageSource { On 2013/03/13 22:08:53, oshima ...
7 years, 9 months ago (2013-03-14 15:49:46 UTC) #14
oshima
https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode39 ui/gfx/image/image_skia_operations.cc:39: gfx::Rect& bounds_in_pixel) { Did you define this intentionally? Or ...
7 years, 9 months ago (2013-03-14 18:12:20 UTC) #15
kevers
https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode285 ui/gfx/image/image_skia_operations.cc:285: class ButtonImageSource: public BinaryImageSource { On 2013/03/14 18:12:20, oshima ...
7 years, 9 months ago (2013-03-14 19:31:39 UTC) #16
oshima
https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode39 ui/gfx/image/image_skia_operations.cc:39: gfx::Rect& bounds_in_pixel) { On 2013/03/14 18:12:20, oshima wrote: > ...
7 years, 9 months ago (2013-03-14 19:51:16 UTC) #17
kevers
https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode39 ui/gfx/image/image_skia_operations.cc:39: gfx::Rect& bounds_in_pixel) { On 2013/03/14 19:51:17, oshima wrote: > ...
7 years, 9 months ago (2013-03-14 20:18:28 UTC) #18
oshima
On Thu, Mar 14, 2013 at 1:18 PM, <kevers@chromium.org> wrote: > > https://codereview.chromium.**org/12730010/diff/32001/ui/** > gfx/image/image_skia_**operations.cc<https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc> ...
7 years, 9 months ago (2013-03-14 20:30:22 UTC) #19
kevers
https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc File ui/gfx/image/image_skia_operations.cc (right): https://codereview.chromium.org/12730010/diff/32001/ui/gfx/image/image_skia_operations.cc#newcode39 ui/gfx/image/image_skia_operations.cc:39: gfx::Rect& bounds_in_pixel) { On 2013/03/14 18:12:20, oshima wrote: > ...
7 years, 9 months ago (2013-03-14 20:41:42 UTC) #20
oshima
LGTM
7 years, 9 months ago (2013-03-14 20:52:26 UTC) #21
sky
LGTM
7 years, 9 months ago (2013-03-15 15:34:05 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kevers@chromium.org/12730010/42001
7 years, 9 months ago (2013-03-15 15:36:25 UTC) #23
commit-bot: I haz the power
7 years, 9 months ago (2013-03-15 17:53:06 UTC) #24
Message was sent while issue was closed.
Change committed as 188434

Powered by Google App Engine
This is Rietveld 408576698