Changeset 117187 in webkit


Ignore:
Timestamp:
May 15, 2012 4:52:58 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Skia does not respect a specified InterpolationQuality
https://bugs.webkit.org/show_bug.cgi?id=86249

Patch by Keyar Hood <keyar@chromium.org> on 2012-05-15
Reviewed by Stephen White.

Source/WebCore:

The added functionality is not exposed to higher layers of webkit.
Tests will be added that will exercise these changes when bug 82804 is
fixed.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawImageBuffer):
Code to have the useLowQualityScale cause the InterpolationQuality be
be set to low for Chromium but remain as none for other platforms.

  • platform/graphics/skia/ImageSkia.cpp:

(WebCore::limitResamplingMode): Added
(WebCore):
(WebCore::paintSkBitmap):
(WebCore::Image::drawPattern):
We now limit the resampling choice based on what InterpolationQuality
is set as. InterpolationNone restricts resampling to RESAMPLE_NONE,
InterpolationLow and InterpolationMedium restricts resampling to
RESAMPLE_LINEAR. InterpolationHigh and InterpolationDefault do not
change the resampling.

Furthermore, the choice on how to set the filter bitmap flag in
paintSkBitmap was made to be consistent with that in
Image::drawPattern.

LayoutTests:

Now expecting the following to tests to have an IMAGE failure:
svg/custom/pointer-events-image-css-transform.svg
svg/custom/pointer-events-image.svg

  • platform/chromium/test_expectations.txt:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117175 r117187  
     12012-05-15  Keyar Hood  <keyar@chromium.org>
     2
     3        Skia does not respect a specified InterpolationQuality
     4        https://bugs.webkit.org/show_bug.cgi?id=86249
     5
     6        Reviewed by Stephen White.
     7
     8        Now expecting the following to tests to have an IMAGE failure:
     9        svg/custom/pointer-events-image-css-transform.svg
     10        svg/custom/pointer-events-image.svg
     11        * platform/chromium/test_expectations.txt:
     12
    1132012-05-15  Philippe Normand  <pnormand@igalia.com>
    214
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r117128 r117187  
    12941294BUGWK85107 : svg/as-image/svg-as-relative-image-with-explicit-size.html = PASS IMAGE
    12951295
     1296// Tests need rebaseling.
     1297// Failed due to changes used to fix bug 82804 while maintaining test
     1298// consistency.
     1299BUGWK86486 : svg/custom/pointer-events-image-css-transform.svg = IMAGE
     1300BUGWK86486 : svg/custom/pointer-events-image.svg = IMAGE
     1301
    12961302// -----------------------------------------------------------------
    12971303// End SVG TESTS
  • trunk/Source/WebCore/ChangeLog

    r117185 r117187  
     12012-05-15  Keyar Hood  <keyar@chromium.org>
     2
     3        Skia does not respect a specified InterpolationQuality
     4        https://bugs.webkit.org/show_bug.cgi?id=86249
     5
     6        Reviewed by Stephen White.
     7
     8        The added functionality is not exposed to higher layers of webkit.
     9        Tests will be added that will exercise these changes when bug 82804 is
     10        fixed.
     11
     12        * platform/graphics/GraphicsContext.cpp:
     13        (WebCore::GraphicsContext::drawImage):
     14        (WebCore::GraphicsContext::drawImageBuffer):
     15        Code to have the useLowQualityScale cause the InterpolationQuality be
     16        be set to low for Chromium but remain as none for other platforms.
     17        * platform/graphics/skia/ImageSkia.cpp:
     18        (WebCore::limitResamplingMode): Added
     19        (WebCore):
     20        (WebCore::paintSkBitmap):
     21        (WebCore::Image::drawPattern):
     22        We now limit the resampling choice based on what InterpolationQuality
     23        is set as. InterpolationNone restricts resampling to RESAMPLE_NONE,
     24        InterpolationLow and InterpolationMedium restricts resampling to
     25        RESAMPLE_LINEAR. InterpolationHigh and InterpolationDefault do not
     26        change the resampling.
     27       
     28        Furthermore, the choice on how to set the filter bitmap flag in
     29        paintSkBitmap was made to be consistent with that in
     30        Image::drawPattern.
     31
     32
    1332012-05-15  Jeffrey Pfau  <jpfau@apple.com>
    234
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r113486 r117187  
    483483    if (useLowQualityScale) {
    484484        previousInterpolationQuality = imageInterpolationQuality();
     485#if PLATFORM(CHROMIUM)
     486        setImageInterpolationQuality(InterpolationLow);
     487#else
    485488        // FIXME (49002): Should be InterpolationLow
    486489        setImageInterpolationQuality(InterpolationNone);
     490#endif
    487491    }
    488492
     
    573577    if (useLowQualityScale) {
    574578        InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
     579#if PLATFORM(CHROMIUM)
     580        setImageInterpolationQuality(InterpolationLow);
     581#else
    575582        // FIXME (49002): Should be InterpolationLow
    576583        setImageInterpolationQuality(InterpolationNone);
     584#endif
    577585        image->draw(this, styleColorSpace, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op, useLowQualityScale);
    578586        setImageInterpolationQuality(previousInterpolationQuality);
  • trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp

    r116907 r117187  
    147147
    148148    // Everything else gets resampled.
    149     // If the platform context permits high quality interpolation, use it.
    150149    // High quality interpolation only enabled for scaling and translation.
    151     if (platformContext->interpolationQuality() == InterpolationHigh
    152         && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
     150    if (!(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
    153151        return RESAMPLE_AWESOME;
    154152   
    155153    return RESAMPLE_LINEAR;
     154}
     155
     156static ResamplingMode limitResamplingMode(PlatformContextSkia* platformContext, ResamplingMode resampling)
     157{
     158    switch (platformContext->interpolationQuality()) {
     159    case InterpolationNone:
     160        return RESAMPLE_NONE;
     161    case InterpolationMedium:
     162        // For now we treat InterpolationMedium and InterpolationLow the same.
     163    case InterpolationLow:
     164        if (resampling == RESAMPLE_AWESOME)
     165            return RESAMPLE_LINEAR;
     166        break;
     167    case InterpolationHigh:
     168    case InterpolationDefault:
     169        break;
     170    }
     171
     172    return resampling;
    156173}
    157174
     
    225242    SkPaint paint;
    226243    paint.setXfermodeMode(compOp);
    227     paint.setFilterBitmap(true);
    228244    paint.setAlpha(platformContext->getNormalizedAlpha());
    229245    paint.setLooper(platformContext->getDrawLooper());
     
    239255        resampling = platformContext->printing() ? RESAMPLE_NONE :
    240256            computeResamplingMode(platformContext, bitmap, srcRect.width(), srcRect.height(), SkScalarToFloat(destRect.width()), SkScalarToFloat(destRect.height()));
    241     if (resampling == RESAMPLE_AWESOME) {
     257    if (resampling == RESAMPLE_NONE) {
     258      // FIXME: This is to not break tests (it results in the filter bitmap flag
     259      // being set to true). We need to decide if we respect RESAMPLE_NONE
     260      // being returned from computeResamplingMode.
     261        resampling = RESAMPLE_LINEAR;
     262    }
     263    resampling = limitResamplingMode(platformContext, resampling);
     264    paint.setFilterBitmap(resampling == RESAMPLE_LINEAR);
     265    if (resampling == RESAMPLE_AWESOME)
    242266        drawResampledBitmap(*canvas, paint, bitmap, srcRect, destRect);
    243     } else {
     267    else {
    244268        // No resampling necessary, we can just draw the bitmap. We want to
    245269        // filter it if we decided to do linear interpolation above, or if there
     
    335359    else
    336360        resampling = computeResamplingMode(context->platformContext(), *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight);
     361    resampling = limitResamplingMode(context->platformContext(), resampling);
    337362
    338363    // Load the transform WebKit requested.
Note: See TracChangeset for help on using the changeset viewer.