Bug 98630 - [CAIRO] Adjust the source rect size when IMAGE_DECODER_DOWN_SAMPLING is enabled
Summary: [CAIRO] Adjust the source rect size when IMAGE_DECODER_DOWN_SAMPLING is enabled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-07 22:37 PDT by Jaehun Lim
Modified: 2012-10-08 17:55 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.85 KB, patch)
2012-10-07 22:39 PDT, Jaehun Lim
mrobinson: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Testcase before patch (2.33 MB, image/png)
2012-10-07 22:40 PDT, Jaehun Lim
no flags Details
Testcase after patch (2.67 MB, image/png)
2012-10-07 22:40 PDT, Jaehun Lim
no flags Details
Fixed patch (1.88 KB, patch)
2012-10-08 16:06 PDT, Jaehun Lim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaehun Lim 2012-10-07 22:37:39 PDT
IMAGE_DECODER_DOWN_SAMPLING scales down the size of the big image.
CAIRO needs to adjust the source size to the scaled value.
Comment 1 Jaehun Lim 2012-10-07 22:39:00 PDT
Created attachment 167506 [details]
Patch
Comment 2 Jaehun Lim 2012-10-07 22:40:20 PDT
Created attachment 167507 [details]
Testcase before patch
Comment 3 Jaehun Lim 2012-10-07 22:40:55 PDT
Created attachment 167508 [details]
Testcase after patch
Comment 4 Martin Robinson 2012-10-08 11:46:20 PDT
Comment on attachment 167506 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=167506&action=review

> Source/WebCore/platform/graphics/cairo/BitmapImageCairo.cpp:109
> +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
> +    cairo_surface_t* surface = nativeImage->surface();
> +    IntSize scaledSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface));
> +    FloatRect adjustedSrcRect = adjustSourceRectForDownSampling(srcRect, scaledSize);
> +#else
> +    FloatRect adjustedSrcRect(srcRect);
> +#endif
> +
> +    context->platformContext()->drawSurfaceToContext(nativeImage->surface(), dstRect, adjustedSrcRect, context);

Okay.
Comment 5 WebKit Review Bot 2012-10-08 11:50:40 PDT
Comment on attachment 167506 [details]
Patch

Rejecting attachment 167506 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
ommit-queue/Source/WebKit/chromium/third_party/snappy/src --revision 63 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
49>At revision 63.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/14223318
Comment 6 Jaehun Lim 2012-10-08 16:06:15 PDT
Created attachment 167638 [details]
Fixed patch
Comment 7 noel gordon 2012-10-08 16:48:45 PDT
No tests.  How come?
Comment 8 Martin Robinson 2012-10-08 16:51:15 PDT
(In reply to comment #7)
> No tests.  How come?

Good question.  As far as I know this isn't turned on yet.
Comment 9 Jaehun Lim 2012-10-08 17:51:22 PDT
Yes, we need test cases. 

But I think there are 2 problems.
1. IMAGE_DECODER_DOWN_SAMPLING is a compile-time option. And there are no ports to turn it on. So we need to re-compile to test it.
2. It scales down a big image file. So it's possible to make some troubles in existing test cases using image files.

I think it's better to change IMAGE_DECODER_DOWN_SAMPLING as run-time option to turn it on/off dynamically, and then add some test cases.
Comment 10 WebKit Review Bot 2012-10-08 17:55:30 PDT
Comment on attachment 167638 [details]
Fixed patch

Clearing flags on attachment: 167638

Committed r130706: <http://trac.webkit.org/changeset/130706>
Comment 11 WebKit Review Bot 2012-10-08 17:55:34 PDT
All reviewed patches have been landed.  Closing bug.