Changeset 68574 in webkit


Ignore:
Timestamp:
Sep 28, 2010 3:26:00 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-28 W. James MacLean <wjmaclean@chromium.org>

Reviewed by James Robinson.

Scaled Resized images are blurred when sent to Skia
https://bugs.webkit.org/show_bug.cgi?id=42370

  • platform/chromium-linux/svg/custom/image-rescale-expected.checksum: Added.
  • platform/chromium-linux/svg/custom/image-rescale-expected.png: Added.
  • platform/chromium-linux/svg/custom/image-rescale-expected.txt: Added.
  • platform/chromium/test_expectations.txt:
  • platform/mac/svg/custom/image-rescale-expected.checksum: Added.
  • platform/mac/svg/custom/image-rescale-expected.png: Added.
  • platform/mac/svg/custom/image-rescale-expected.txt: Added.
  • svg/custom/image-rescale.svg: Added.
  • svg/custom/resources/image-rescale.jpg: Added.

2010-09-28 W. James MacLean <wjmaclean@chromium.org>

Reviewed by James Robinson.

Scaled Resized images are blurred when sent to Skia
https://bugs.webkit.org/show_bug.cgi?id=42370

This patch modifies ImageSkia.cpp to fix the calculation of resampled
bitmap sizes so as to include the transform matrix of the canvas.

Test: svg/custom/image-rescale.svg

  • platform/graphics/skia/ImageSkia.cpp: (WebCore::computeResamplingMode): (WebCore::drawResampledBitmap):
Location:
trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68568 r68574  
     12010-09-28  W. James MacLean  <wjmaclean@chromium.org>
     2
     3        Reviewed by James Robinson.
     4
     5        Scaled Resized images are blurred when sent to Skia
     6        https://bugs.webkit.org/show_bug.cgi?id=42370
     7
     8        * platform/chromium-linux/svg/custom/image-rescale-expected.checksum: Added.
     9        * platform/chromium-linux/svg/custom/image-rescale-expected.png: Added.
     10        * platform/chromium-linux/svg/custom/image-rescale-expected.txt: Added.
     11        * platform/chromium/test_expectations.txt:
     12        * platform/mac/svg/custom/image-rescale-expected.checksum: Added.
     13        * platform/mac/svg/custom/image-rescale-expected.png: Added.
     14        * platform/mac/svg/custom/image-rescale-expected.txt: Added.
     15        * svg/custom/image-rescale.svg: Added.
     16        * svg/custom/resources/image-rescale.jpg: Added.
     17
    1182010-09-28  Matthew Delaney  <mdelaney@apple.com>
    219
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r68543 r68574  
    836836BUGWK44514 MAC : fast/backgrounds/svg-as-background-6.html = IMAGE
    837837BUGWK44514 MAC : svg/zoom/page/zoom-mask-with-percentages.svg = IMAGE
     838
     839// Will require rebaseline.
     840BUGWK42370 WIN MAC : svg/custom/image-rescale.svg = FAIL
    838841
    839842// -----------------------------------------------------------------
  • trunk/WebCore/ChangeLog

    r68571 r68574  
     12010-09-28  W. James MacLean  <wjmaclean@chromium.org>
     2
     3        Reviewed by James Robinson.
     4
     5        Scaled Resized images are blurred when sent to Skia
     6        https://bugs.webkit.org/show_bug.cgi?id=42370
     7
     8        This patch modifies ImageSkia.cpp to fix the calculation of resampled
     9        bitmap sizes so as to include the transform matrix of the canvas.
     10
     11        Test: svg/custom/image-rescale.svg
     12
     13        * platform/graphics/skia/ImageSkia.cpp:
     14        (WebCore::computeResamplingMode):
     15        (WebCore::drawResampledBitmap):
     16
    1172010-09-28  James Robinson  <jamesr@chromium.org>
    218
  • trunk/WebCore/platform/graphics/skia/ImageSkia.cpp

    r68000 r68574  
    144144    // Everything else gets resampled.
    145145    // If the platform context permits high quality interpolation, use it.
    146     if (platformContext->interpolationQuality() == InterpolationHigh)
     146    // High quality interpolation only enabled for scaling and translation.
     147    if (platformContext->interpolationQuality() == InterpolationHigh
     148        && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
    147149        return RESAMPLE_AWESOME;
    148150   
     
    174176
    175177    // We will always draw in integer sizes, so round the destination rect.
     178    // First we need to apply canvas transformation matrix to get desired size of
     179    // resampled image.
     180    SkRect destRectTransformed;
     181    canvas.getTotalMatrix().mapRect(&destRectTransformed, destRect);
    176182    SkIRect destRectRounded;
    177     destRect.round(&destRectRounded);
     183    destRectTransformed.round(&destRectRounded);
    178184    SkIRect resizedImageRect =  // Represents the size of the resized image.
    179185        { 0, 0, destRectRounded.width(), destRectRounded.height() };
     
    189195    SkRect destBitmapSubsetSk;
    190196    ClipRectToCanvas(canvas, destRect, &destBitmapSubsetSk);
    191     destBitmapSubsetSk.offset(-destRect.fLeft, -destRect.fTop);
     197    // Determine size of resampled image based on clipped destination rect.
     198    SkRect destBitmapSubsetSkTransformed;
     199    canvas.getTotalMatrix().mapRect(&destBitmapSubsetSkTransformed, destBitmapSubsetSk);
     200    destBitmapSubsetSkTransformed.offset(-destBitmapSubsetSkTransformed.fLeft, -destBitmapSubsetSkTransformed.fTop);
    192201
    193202    // The matrix inverting, etc. could have introduced rounding error which
     
    197206    // data.
    198207    SkIRect destBitmapSubsetSkI;
    199     destBitmapSubsetSk.roundOut(&destBitmapSubsetSkI);
     208    destBitmapSubsetSkTransformed.roundOut(&destBitmapSubsetSkI);
    200209    if (!destBitmapSubsetSkI.intersect(resizedImageRect))
    201210        return;  // Resized image does not intersect.
Note: See TracChangeset for help on using the changeset viewer.