Title: [117187] trunk
Revision
117187
Author
[email protected]
Date
2012-05-15 16:52:58 -0700 (Tue, 15 May 2012)

Log Message

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

Patch by Keyar Hood <[email protected]> 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117186 => 117187)


--- trunk/LayoutTests/ChangeLog	2012-05-15 23:51:13 UTC (rev 117186)
+++ trunk/LayoutTests/ChangeLog	2012-05-15 23:52:58 UTC (rev 117187)
@@ -1,3 +1,15 @@
+2012-05-15  Keyar Hood  <[email protected]>
+
+        Skia does not respect a specified InterpolationQuality
+        https://bugs.webkit.org/show_bug.cgi?id=86249
+
+        Reviewed by Stephen White.
+
+        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:
+
 2012-05-15  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK gardening.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (117186 => 117187)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-05-15 23:51:13 UTC (rev 117186)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-05-15 23:52:58 UTC (rev 117187)
@@ -1293,6 +1293,12 @@
 
 BUGWK85107 : svg/as-image/svg-as-relative-image-with-explicit-size.html = PASS IMAGE
 
+// Tests need rebaseling.
+// Failed due to changes used to fix bug 82804 while maintaining test
+// consistency.
+BUGWK86486 : svg/custom/pointer-events-image-css-transform.svg = IMAGE
+BUGWK86486 : svg/custom/pointer-events-image.svg = IMAGE
+
 // -----------------------------------------------------------------
 // End SVG TESTS
 // -----------------------------------------------------------------

Modified: trunk/Source/WebCore/ChangeLog (117186 => 117187)


--- trunk/Source/WebCore/ChangeLog	2012-05-15 23:51:13 UTC (rev 117186)
+++ trunk/Source/WebCore/ChangeLog	2012-05-15 23:52:58 UTC (rev 117187)
@@ -1,3 +1,35 @@
+2012-05-15  Keyar Hood  <[email protected]>
+
+        Skia does not respect a specified InterpolationQuality
+        https://bugs.webkit.org/show_bug.cgi?id=86249
+
+        Reviewed by Stephen White.
+
+        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.
+
+
 2012-05-15  Jeffrey Pfau  <[email protected]>
 
         ImageDocuments erroneously trigger beforeload events for the main resource

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (117186 => 117187)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-05-15 23:51:13 UTC (rev 117186)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-05-15 23:52:58 UTC (rev 117187)
@@ -482,8 +482,12 @@
 
     if (useLowQualityScale) {
         previousInterpolationQuality = imageInterpolationQuality();
+#if PLATFORM(CHROMIUM)
+        setImageInterpolationQuality(InterpolationLow);
+#else
         // FIXME (49002): Should be InterpolationLow
         setImageInterpolationQuality(InterpolationNone);
+#endif
     }
 
     if (image->isBitmapImage())
@@ -572,8 +576,12 @@
 
     if (useLowQualityScale) {
         InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
+#if PLATFORM(CHROMIUM)
+        setImageInterpolationQuality(InterpolationLow);
+#else
         // FIXME (49002): Should be InterpolationLow
         setImageInterpolationQuality(InterpolationNone);
+#endif
         image->draw(this, styleColorSpace, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op, useLowQualityScale);
         setImageInterpolationQuality(previousInterpolationQuality);
     } else

Modified: trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp (117186 => 117187)


--- trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp	2012-05-15 23:51:13 UTC (rev 117186)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp	2012-05-15 23:52:58 UTC (rev 117187)
@@ -146,15 +146,32 @@
         return RESAMPLE_LINEAR;
 
     // Everything else gets resampled.
-    // If the platform context permits high quality interpolation, use it.
     // High quality interpolation only enabled for scaling and translation.
-    if (platformContext->interpolationQuality() == InterpolationHigh
-        && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
+    if (!(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
         return RESAMPLE_AWESOME;
     
     return RESAMPLE_LINEAR;
 }
 
+static ResamplingMode limitResamplingMode(PlatformContextSkia* platformContext, ResamplingMode resampling)
+{
+    switch (platformContext->interpolationQuality()) {
+    case InterpolationNone:
+        return RESAMPLE_NONE;
+    case InterpolationMedium:
+        // For now we treat InterpolationMedium and InterpolationLow the same.
+    case InterpolationLow:
+        if (resampling == RESAMPLE_AWESOME)
+            return RESAMPLE_LINEAR;
+        break;
+    case InterpolationHigh:
+    case InterpolationDefault:
+        break;
+    }
+
+    return resampling;
+}
+
 // Draws the given bitmap to the given canvas. The subset of the source bitmap
 // identified by src_rect is drawn to the given destination rect. The bitmap
 // will be resampled to resample_width * resample_height (this is the size of
@@ -224,7 +241,6 @@
 #endif
     SkPaint paint;
     paint.setXfermodeMode(compOp);
-    paint.setFilterBitmap(true);
     paint.setAlpha(platformContext->getNormalizedAlpha());
     paint.setLooper(platformContext->getDrawLooper());
     // only antialias if we're rotated or skewed
@@ -238,9 +254,17 @@
     else
         resampling = platformContext->printing() ? RESAMPLE_NONE :
             computeResamplingMode(platformContext, bitmap, srcRect.width(), srcRect.height(), SkScalarToFloat(destRect.width()), SkScalarToFloat(destRect.height()));
-    if (resampling == RESAMPLE_AWESOME) {
+    if (resampling == RESAMPLE_NONE) {
+      // FIXME: This is to not break tests (it results in the filter bitmap flag
+      // being set to true). We need to decide if we respect RESAMPLE_NONE
+      // being returned from computeResamplingMode.
+        resampling = RESAMPLE_LINEAR;
+    }
+    resampling = limitResamplingMode(platformContext, resampling);
+    paint.setFilterBitmap(resampling == RESAMPLE_LINEAR);
+    if (resampling == RESAMPLE_AWESOME)
         drawResampledBitmap(*canvas, paint, bitmap, srcRect, destRect);
-    } else {
+    else {
         // No resampling necessary, we can just draw the bitmap. We want to
         // filter it if we decided to do linear interpolation above, or if there
         // is something interesting going on with the matrix (like a rotation).
@@ -334,6 +358,7 @@
         resampling = RESAMPLE_LINEAR;
     else
         resampling = computeResamplingMode(context->platformContext(), *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight);
+    resampling = limitResamplingMode(context->platformContext(), resampling);
 
     // Load the transform WebKit requested.
     SkMatrix matrix(patternTransform);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to