Bug 134513 - [iOS] Subsampled JPEG images do not draw correctly via the canvas APIs
Summary: [iOS] Subsampled JPEG images do not draw correctly via the canvas APIs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-01 14:43 PDT by Dean Jackson
Modified: 2014-07-01 16:27 PDT (History)
7 users (show)

See Also:


Attachments
Patch (17.69 KB, patch)
2014-07-01 14:49 PDT, Dean Jackson
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2014-07-01 14:43:07 PDT
[iOS] Subsampled JPEG images do not draw correctly via the canvas APIs
Comment 1 Dean Jackson 2014-07-01 14:49:51 PDT
Created attachment 234200 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-07-01 14:58:24 PDT
Comment on attachment 234200 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp:206
> +    if (m_originalSize.width() && m_originalSize.height())
> +        scaledSrcRect.scale(m_size.width() / static_cast<float>(m_originalSize.width()), m_size.height() / static_cast<float>(m_originalSize.height()));

Don't we have a subsampling scale (m_scale) for each frame already?

> Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:340
> +                scaleHint = std::min<float>(1.0f, std::max(m_image->size().width() / originalSize.width(), m_image->size().width() / originalSize.height()));

Image knows the scale already?
Comment 3 Dean Jackson 2014-07-01 15:47:39 PDT
Comment on attachment 234200 [details]
Patch

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

>> Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp:206
>> +        scaledSrcRect.scale(m_size.width() / static_cast<float>(m_originalSize.width()), m_size.height() / static_cast<float>(m_originalSize.height()));
> 
> Don't we have a subsampling scale (m_scale) for each frame already?

No, we might not have any frames yet. Later in this method we call frameAtIndex to generate the frame for the subsample.

>> Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:340
>> +                scaleHint = std::min<float>(1.0f, std::max(m_image->size().width() / originalSize.width(), m_image->size().width() / originalSize.height()));
> 
> Image knows the scale already?

Same as above, and even if it did, I would have to make the frames public just for this.
Comment 4 Dean Jackson 2014-07-01 15:48:05 PDT
I changed FrameData::m_scale to m_subsamplingScale though.
Comment 5 Tim Horton 2014-07-01 15:55:32 PDT
Comment on attachment 234200 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp:202
> +    FloatRect scaledSrcRect = srcRect;

<channeling ben> scaled into what coordinate space
Comment 6 Dean Jackson 2014-07-01 16:25:27 PDT
        <rdar://problem/12078860>
        <rdar://problem/16745393>
Comment 7 Dean Jackson 2014-07-01 16:27:12 PDT
Committed r170675: <http://trac.webkit.org/changeset/170675>