]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxGraphicsContext::SetInterpolationQuality() for wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Mar 2012 18:24:15 +0000 (18:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Mar 2012 18:24:15 +0000 (18:24 +0000)
Provide implementation of the previously stubbed out method.

Closes #14134.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
interface/wx/graphics.h
src/msw/graphics.cpp

index cebec5ae5b7cc5320c65d64ac487f9b9afb265d0..9b39bfaa0ead583729716ca97c8ba24d77a23344 100644 (file)
@@ -514,6 +514,7 @@ MSW:
   wxWebViewIE to improve the default behaviour (Allonii).
 - Update stretchable spaces in wxToolBar after tool removal (Catalin Raceanu).
 - Add support for horizontal mouse wheel events (Lauri Nurmi).
+- Implement wxGraphicsContext::SetInterpolationQuality() (Eric Jarvi).
 
 OSX:
 
index 6431067da99b100a324db42ad0df0531ab6a9311..d2104f4425e6345fd7c5d63981289bc41a66f6e0 100644 (file)
@@ -787,15 +787,17 @@ public:
     virtual wxAntialiasMode GetAntialiasMode() const ;
 
     /**
-        Sets the interpolation quality, returns true if it supported
+        Sets the interpolation quality, returns true if it is supported.
+
+        Not implemented in Cairo backend currently.
      */
     virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0;
-    
+
     /**
-        Returns the current interpolation quality
+        Returns the current interpolation quality.
      */
     virtual wxInterpolationQuality GetInterpolationQuality() const;
-    
+
     /**
         Sets the compositing operator, returns true if it supported
     */
index e5161c5d5bca3ca33d22dbc1e465b6d5a74e987d..af177f3365ef576bb5dae0c84c103c56fa1e303f 100644 (file)
@@ -1390,6 +1390,7 @@ void wxGDIPlusContext::Init(Graphics* graphics, int width, int height)
     m_context->SetTextRenderingHint(TextRenderingHintSystemDefault);
     m_context->SetPixelOffsetMode(PixelOffsetModeHalf);
     m_context->SetSmoothingMode(SmoothingModeHighQuality);
+    m_context->SetInterpolationMode(InterpolationModeHighQuality);
     m_state1 = m_context->Save();
     m_state2 = m_context->Save();
 }
@@ -1535,10 +1536,41 @@ bool wxGDIPlusContext::SetAntialiasMode(wxAntialiasMode antialias)
     return true;
 }
 
-bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality WXUNUSED(interpolation))
+bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolation)
 {
-    // placeholder
-    return false;
+    if (m_interpolation == interpolation)
+        return true;
+
+    m_interpolation = interpolation;
+
+    InterpolationMode interpolationMode = InterpolationModeDefault;
+    switch (interpolation)
+    {
+        case wxINTERPOLATION_DEFAULT:
+            interpolationMode = InterpolationModeDefault;
+            break;
+
+        case wxINTERPOLATION_NONE:
+            interpolationMode = InterpolationModeNearestNeighbor;
+            break;
+
+        case wxINTERPOLATION_FAST:
+            interpolationMode = InterpolationModeLowQuality;
+            break;
+
+        case wxINTERPOLATION_GOOD:
+            interpolationMode = InterpolationModeHighQuality;
+            break;
+
+        case wxINTERPOLATION_BEST:
+            interpolationMode = InterpolationModeHighQualityBicubic;
+            break;
+
+        default:
+            return false;
+    }
+    m_context->SetInterpolationMode(interpolationMode);
+    return true;
 }
 
 bool wxGDIPlusContext::SetCompositionMode(wxCompositionMode op)