Title: [87151] trunk/Source/WebCore
- Revision
- 87151
- Author
- commit-qu...@webkit.org
- Date
- 2011-05-24 08:13:17 -0700 (Tue, 24 May 2011)
Log Message
2011-05-24 Ryuan Choi <ryuan.c...@samsung.com>
Reviewed by Andreas Kling.
[GTK] Implement GraphicsContextCairo::imageInterpolationQuality().
https://bugs.webkit.org/show_bug.cgi?id=60827
Implement getter/setter of imageInterpolationQuality and logic to change
interpolation algorithm when drawing image.
Mac and Qt already implemented it.
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setImageInterpolationQuality):
(WebCore::GraphicsContext::imageInterpolationQuality):
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::drawSurfaceToContext):
* platform/graphics/cairo/PlatformContextCairo.h:
(WebCore::PlatformContextCairo::setImageInterpolationQuality): Added.
(WebCore::PlatformContextCairo::imageInterpolationQuality): Added.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (87150 => 87151)
--- trunk/Source/WebCore/ChangeLog 2011-05-24 15:11:48 UTC (rev 87150)
+++ trunk/Source/WebCore/ChangeLog 2011-05-24 15:13:17 UTC (rev 87151)
@@ -1,3 +1,24 @@
+2011-05-24 Ryuan Choi <ryuan.c...@samsung.com>
+
+ Reviewed by Andreas Kling.
+
+ [GTK] Implement GraphicsContextCairo::imageInterpolationQuality().
+ https://bugs.webkit.org/show_bug.cgi?id=60827
+
+ Implement getter/setter of imageInterpolationQuality and logic to change
+ interpolation algorithm when drawing image.
+ Mac and Qt already implemented it.
+
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::setImageInterpolationQuality):
+ (WebCore::GraphicsContext::imageInterpolationQuality):
+ * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
+ * platform/graphics/cairo/PlatformContextCairo.cpp:
+ (WebCore::PlatformContextCairo::drawSurfaceToContext):
+ * platform/graphics/cairo/PlatformContextCairo.h:
+ (WebCore::PlatformContextCairo::setImageInterpolationQuality): Added.
+ (WebCore::PlatformContextCairo::imageInterpolationQuality): Added.
+
2011-05-24 Leandro Gracia Gil <leandrogra...@chromium.org>
Reviewed by Tony Gentilcore.
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (87150 => 87151)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2011-05-24 15:11:48 UTC (rev 87150)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2011-05-24 15:13:17 UTC (rev 87151)
@@ -1154,13 +1154,14 @@
cairo_set_antialias(platformContext()->cr(), enable ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
}
-void GraphicsContext::setImageInterpolationQuality(InterpolationQuality)
+void GraphicsContext::setImageInterpolationQuality(InterpolationQuality quality)
{
+ platformContext()->setImageInterpolationQuality(quality);
}
InterpolationQuality GraphicsContext::imageInterpolationQuality() const
{
- return InterpolationDefault;
+ return platformContext()->imageInterpolationQuality();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h (87150 => 87151)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h 2011-05-24 15:11:48 UTC (rev 87150)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h 2011-05-24 15:13:17 UTC (rev 87151)
@@ -102,6 +102,7 @@
Vector<float> layers;
ContextShadow shadow;
Vector<ContextShadow> shadowStack;
+ InterpolationQuality imageInterpolationQuality;
#if PLATFORM(GTK)
GdkEventExpose* expose;
Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (87150 => 87151)
--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp 2011-05-24 15:11:48 UTC (rev 87150)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp 2011-05-24 15:13:17 UTC (rev 87151)
@@ -97,6 +97,20 @@
// a pattern transformation on the image and draw the transformed pattern.
// Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
RefPtr<cairo_pattern_t> pattern = adoptRef(cairo_pattern_create_for_surface(surface));
+
+ switch (m_imageInterpolationQuality) {
+ case InterpolationNone:
+ case InterpolationLow:
+ cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_FAST);
+ break;
+ case InterpolationMedium:
+ case InterpolationHigh:
+ cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_BILINEAR);
+ break;
+ case InterpolationDefault:
+ cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_BILINEAR);
+ break;
+ }
cairo_pattern_set_extend(pattern.get(), CAIRO_EXTEND_PAD);
float scaleX = srcRect.width() / destRect.width();
Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h (87150 => 87151)
--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h 2011-05-24 15:11:48 UTC (rev 87150)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h 2011-05-24 15:13:17 UTC (rev 87151)
@@ -27,6 +27,7 @@
#define PlatformContextCairo_h
#include "ContextShadow.h"
+#include "GraphicsContext.h"
#include "RefPtrCairo.h"
namespace WebCore {
@@ -68,9 +69,13 @@
void pushImageMask(cairo_surface_t*, const FloatRect&);
void drawSurfaceToContext(cairo_surface_t*, const FloatRect& destRect, const FloatRect& srcRect, GraphicsContext*);
+ void setImageInterpolationQuality(InterpolationQuality quality) { m_imageInterpolationQuality = quality; }
+ InterpolationQuality imageInterpolationQuality() const { return m_imageInterpolationQuality; }
+
private:
RefPtr<cairo_t> m_cr;
Vector<ImageMaskInformation> m_maskImageStack;
+ InterpolationQuality m_imageInterpolationQuality;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes