Title: [227065] trunk/Source
Revision
227065
Author
[email protected]
Date
2018-01-17 05:06:01 -0800 (Wed, 17 Jan 2018)

Log Message

[Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
https://bugs.webkit.org/show_bug.cgi?id=181725

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Don't duplicate global alpha and image interpolation quality state
values on the PlatformContextCairo. Instead, retrieve them from
the managing GraphicsContextState when necessary.

For Cairo operations, the FillSource and StrokeSource containers now
store the global alpha value, using it during the operation executions.
For drawNativeImage(), the global alpha and interpolation quality values
are passed through arguments.

In PlatformContextCairo, the two values are no longer stored on the
internally-managed stack, and the getter-setter pairs for the two values
are removed. In drawSurfaceToContext(), the two values are now expected
to be passed through the method arguments.

No new tests -- no change in behavior.

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::prepareForFilling):
(WebCore::Cairo::prepareForStroking):
(WebCore::Cairo::drawPathShadow):
(WebCore::Cairo::fillCurrentCairoPath):
(WebCore::Cairo::FillSource::FillSource):
(WebCore::Cairo::StrokeSource::StrokeSource):
(WebCore::Cairo::strokeRect):
(WebCore::Cairo::strokePath):
(WebCore::Cairo::drawGlyphs):
(WebCore::Cairo::drawNativeImage):
(WebCore::Cairo::State::setGlobalAlpha): Deleted.
(WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::setPlatformAlpha):
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::save):
(WebCore::PlatformContextCairo::drawSurfaceToContext):
(WebCore::PlatformContextCairo::State::State): Deleted.
(WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
(WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
(WebCore::PlatformContextCairo::globalAlpha const): Deleted.
(WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
* platform/graphics/cairo/PlatformContextCairo.h:
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):

Source/WebKit:

* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::paint):
Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::convertCairoSurfaceToShareableBitmap): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227064 => 227065)


--- trunk/Source/WebCore/ChangeLog	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/ChangeLog	2018-01-17 13:06:01 UTC (rev 227065)
@@ -1,3 +1,56 @@
+2018-01-17  Zan Dobersek  <[email protected]>
+
+        [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
+        https://bugs.webkit.org/show_bug.cgi?id=181725
+
+        Reviewed by Carlos Garcia Campos.
+
+        Don't duplicate global alpha and image interpolation quality state
+        values on the PlatformContextCairo. Instead, retrieve them from
+        the managing GraphicsContextState when necessary.
+
+        For Cairo operations, the FillSource and StrokeSource containers now
+        store the global alpha value, using it during the operation executions.
+        For drawNativeImage(), the global alpha and interpolation quality values
+        are passed through arguments.
+
+        In PlatformContextCairo, the two values are no longer stored on the
+        internally-managed stack, and the getter-setter pairs for the two values
+        are removed. In drawSurfaceToContext(), the two values are now expected
+        to be passed through the method arguments.
+
+        No new tests -- no change in behavior.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::prepareForFilling):
+        (WebCore::Cairo::prepareForStroking):
+        (WebCore::Cairo::drawPathShadow):
+        (WebCore::Cairo::fillCurrentCairoPath):
+        (WebCore::Cairo::FillSource::FillSource):
+        (WebCore::Cairo::StrokeSource::StrokeSource):
+        (WebCore::Cairo::strokeRect):
+        (WebCore::Cairo::strokePath):
+        (WebCore::Cairo::drawGlyphs):
+        (WebCore::Cairo::drawNativeImage):
+        (WebCore::Cairo::State::setGlobalAlpha): Deleted.
+        (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
+        * platform/graphics/cairo/CairoOperations.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawNativeImage):
+        (WebCore::GraphicsContext::setPlatformAlpha):
+        (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+        * platform/graphics/cairo/PlatformContextCairo.cpp:
+        (WebCore::PlatformContextCairo::save):
+        (WebCore::PlatformContextCairo::drawSurfaceToContext):
+        (WebCore::PlatformContextCairo::State::State): Deleted.
+        (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
+        (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
+        (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
+        (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
+        * platform/graphics/cairo/PlatformContextCairo.h:
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
+
 2018-01-17  Philippe Normand  <[email protected]>
 
         REGRESSION(r226973/r226974): Four multimedia tests failing

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -113,7 +113,7 @@
     cairo_path_destroy(currentPath);
 }
 
-static void prepareForFilling(cairo_t* cr, const Cairo::FillSource& fillSource, float globalAlpha, PatternAdjustment patternAdjustment)
+static void prepareForFilling(cairo_t* cr, const Cairo::FillSource& fillSource, PatternAdjustment patternAdjustment)
 {
     cairo_set_fill_rule(cr, fillSource.fillRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
 
@@ -124,7 +124,7 @@
         gradient = fillSource.gradient.alphaAdjusted.get();
 
     prepareCairoContextSource(cr, fillSource.pattern.object.get(), gradient,
-        fillSource.color, adjustForAlpha ? globalAlpha : 1);
+        fillSource.color, adjustForAlpha ? fillSource.globalAlpha : 1);
 
     if (fillSource.pattern.object) {
         clipForPatternFilling(cr, fillSource.pattern.size, fillSource.pattern.transform,
@@ -132,7 +132,7 @@
     }
 }
 
-void prepareForStroking(cairo_t* cr, const Cairo::StrokeSource& strokeSource, float globalAlpha, AlphaPreservation alphaPreservation)
+void prepareForStroking(cairo_t* cr, const Cairo::StrokeSource& strokeSource, AlphaPreservation alphaPreservation)
 {
     bool preserveAlpha = alphaPreservation == PreserveAlpha;
 
@@ -141,7 +141,7 @@
         gradient = strokeSource.gradient.alphaAdjusted.get();
 
     prepareCairoContextSource(cr, strokeSource.pattern.get(), gradient,
-        strokeSource.color, preserveAlpha ? globalAlpha : 1);
+        strokeSource.color, preserveAlpha ? strokeSource.globalAlpha : 1);
 }
 
 static inline void fillRectWithColor(cairo_t* cr, const FloatRect& rect, const Color& color)
@@ -200,7 +200,7 @@
     if (drawingStyle & Fill) {
         cairo_save(cairoShadowContext);
         cairo_append_path(cairoShadowContext, path.get());
-        prepareForFilling(cairoShadowContext, fillSource, shadowContext->platformContext()->globalAlpha(), NoAdjustment);
+        prepareForFilling(cairoShadowContext, fillSource, NoAdjustment);
         cairo_fill(cairoShadowContext);
         cairo_restore(cairoShadowContext);
     }
@@ -207,7 +207,7 @@
 
     if (drawingStyle & Stroke) {
         cairo_append_path(cairoShadowContext, path.get());
-        prepareForStroking(cairoShadowContext, strokeSource, shadowContext->platformContext()->globalAlpha(), DoNotPreserveAlpha);
+        prepareForStroking(cairoShadowContext, strokeSource, DoNotPreserveAlpha);
         cairo_stroke(cairoShadowContext);
     }
 
@@ -225,7 +225,7 @@
     cairo_t* cr = platformContext.cr();
     cairo_save(cr);
 
-    prepareForFilling(cr, fillSource, platformContext.globalAlpha(), AdjustPatternForGlobalAlpha);
+    prepareForFilling(cr, fillSource, AdjustPatternForGlobalAlpha);
     cairo_fill(cr);
 
     cairo_restore(cr);
@@ -430,11 +430,6 @@
     }
 }
 
-void setGlobalAlpha(PlatformContextCairo& platformContext, float alpha)
-{
-    platformContext.setGlobalAlpha(alpha);
-}
-
 void setCompositeOperation(PlatformContextCairo& platformContext, CompositeOperator compositeOperation, BlendMode blendMode)
 {
     cairo_set_operator(platformContext.cr(), toCairoOperator(compositeOperation, blendMode));
@@ -448,11 +443,6 @@
     cairo_set_antialias(platformContext.cr(), enable ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
 }
 
-void setImageInterpolationQuality(PlatformContextCairo& platformContext, InterpolationQuality quality)
-{
-    platformContext.setImageInterpolationQuality(quality);
-}
-
 void setCTM(PlatformContextCairo& platformContext, const AffineTransform& transform)
 {
     const cairo_matrix_t matrix = toCairoMatrix(transform);
@@ -522,6 +512,8 @@
 } // namespace State
 
 FillSource::FillSource(const GraphicsContextState& state)
+    : globalAlpha(state.alpha)
+    , fillRule(state.fillRule)
 {
     if (state.fillPattern) {
         pattern.object = adoptRef(state.fillPattern->createPlatformPattern(AffineTransform()));
@@ -537,11 +529,10 @@
             gradient.alphaAdjusted = adoptRef(state.fillGradient->createPlatformGradient(state.alpha));
     } else
         color = state.fillColor;
-
-    fillRule = state.fillRule;
 }
 
 StrokeSource::StrokeSource(const GraphicsContextState& state)
+    : globalAlpha(state.alpha)
 {
     if (state.strokePattern)
         pattern = adoptRef(state.strokePattern->createPlatformPattern(AffineTransform()));
@@ -720,7 +711,7 @@
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
     cairo_set_line_width(cr, lineWidth);
     drawPathShadow(platformContext, { }, strokeSource, shadowState, targetContext, Stroke);
-    prepareForStroking(cr, strokeSource, platformContext.globalAlpha(), PreserveAlpha);
+    prepareForStroking(cr, strokeSource, PreserveAlpha);
     cairo_stroke(cr);
 
     cairo_restore(cr);
@@ -732,7 +723,7 @@
 
     setPathOnCairoContext(cr, path.platformPath()->context());
     drawPathShadow(platformContext, { }, strokeSource, shadowState, targetContext, Stroke);
-    prepareForStroking(cr, strokeSource, platformContext.globalAlpha(), PreserveAlpha);
+    prepareForStroking(cr, strokeSource, PreserveAlpha);
     cairo_stroke(cr);
 }
 
@@ -755,7 +746,7 @@
     cairo_save(cr);
 
     if (textDrawingMode & TextModeFill) {
-        prepareForFilling(cr, fillSource, platformContext.globalAlpha(), AdjustPatternForGlobalAlpha);
+        prepareForFilling(cr, fillSource, AdjustPatternForGlobalAlpha);
         drawGlyphsToContext(cr, scaledFont, syntheticBoldOffset, glyphs);
     }
 
@@ -764,7 +755,7 @@
     // the text as even one single stroke would cover the full wdth of the text.
     //  See https://bugs.webkit.org/show_bug.cgi?id=33759.
     if (textDrawingMode & TextModeStroke && strokeThickness < 2 * xOffset) {
-        prepareForStroking(cr, strokeSource, platformContext.globalAlpha(), PreserveAlpha);
+        prepareForStroking(cr, strokeSource, PreserveAlpha);
         cairo_set_line_width(cr, strokeThickness);
 
         // This may disturb the CTM, but we are going to call cairo_restore soon after.
@@ -776,7 +767,7 @@
     cairo_restore(cr);
 }
 
-void drawNativeImage(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOperator, BlendMode blendMode, ImageOrientation orientation, const ShadowState& shadowState, GraphicsContext& targetContext)
+void drawNativeImage(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOperator, BlendMode blendMode, ImageOrientation orientation, InterpolationQuality imageInterpolationQuality, float globalAlpha, const ShadowState& shadowState, GraphicsContext& targetContext)
 {
     platformContext.save();
 
@@ -799,7 +790,7 @@
         }
     }
 
-    platformContext.drawSurfaceToContext(surface, dst, srcRect, shadowState, targetContext);
+    platformContext.drawSurfaceToContext(surface, dst, srcRect, imageInterpolationQuality, globalAlpha, shadowState, targetContext);
     platformContext.restore();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-01-17 13:06:01 UTC (rev 227065)
@@ -59,10 +59,8 @@
 void setStrokeThickness(PlatformContextCairo&, float);
 void setStrokeStyle(PlatformContextCairo&, StrokeStyle);
 
-void setGlobalAlpha(PlatformContextCairo&, float);
 void setCompositeOperation(PlatformContextCairo&, CompositeOperator, BlendMode);
 void setShouldAntialias(PlatformContextCairo&, bool);
-void setImageInterpolationQuality(PlatformContextCairo&, InterpolationQuality);
 
 void setCTM(PlatformContextCairo&, const AffineTransform&);
 AffineTransform getCTM(PlatformContextCairo&);
@@ -78,6 +76,7 @@
     FillSource() = default;
     explicit FillSource(const GraphicsContextState&);
 
+    float globalAlpha { 0 };
     struct {
         RefPtr<cairo_pattern_t> object;
         FloatSize size;
@@ -98,6 +97,7 @@
     StrokeSource() = default;
     explicit StrokeSource(const GraphicsContextState&);
 
+    float globalAlpha { 0 };
     RefPtr<cairo_pattern_t> pattern;
     struct {
         RefPtr<cairo_pattern_t> base;
@@ -135,7 +135,7 @@
 
 void drawGlyphs(PlatformContextCairo&, const FillSource&, const StrokeSource&, const ShadowState&, const FloatPoint&, cairo_scaled_font_t*, double, const Vector<cairo_glyph_t>&, float, TextDrawingModeFlags, float, const FloatSize&, const Color&, GraphicsContext&);
 
-void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation, const ShadowState&, GraphicsContext&);
+void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation, InterpolationQuality, float, const ShadowState&, GraphicsContext&);
 void drawPattern(PlatformContextCairo&, cairo_surface_t*, const IntSize&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, CompositeOperator, BlendMode);
 
 void drawRect(PlatformContextCairo&, const FloatRect&, float, const Color&, StrokeStyle, const Color&);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -139,7 +139,8 @@
     }
 
     ASSERT(hasPlatformContext());
-    Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, Cairo::ShadowState(state()), *this);
+    auto& state = this->state();
+    Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), *this);
 }
 
 // This is only used to draw borders, so we should not draw shadows.
@@ -573,9 +574,8 @@
     Cairo::setMiterLimit(*platformContext(), miter);
 }
 
-void GraphicsContext::setPlatformAlpha(float alpha)
+void GraphicsContext::setPlatformAlpha(float)
 {
-    Cairo::State::setGlobalAlpha(*platformContext(), alpha);
 }
 
 void GraphicsContext::setPlatformCompositeOperation(CompositeOperator compositeOperator, BlendMode blendMode)
@@ -696,10 +696,8 @@
     Cairo::State::setShouldAntialias(*platformContext(), enable);
 }
 
-void GraphicsContext::setPlatformImageInterpolationQuality(InterpolationQuality quality)
+void GraphicsContext::setPlatformImageInterpolationQuality(InterpolationQuality)
 {
-    ASSERT(hasPlatformContext());
-    Cairo::State::setImageInterpolationQuality(*platformContext(), quality);
 }
 
 bool GraphicsContext::isAcceleratedContext() const

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -62,23 +62,9 @@
 // pushed graphics state.
 class PlatformContextCairo::State {
 public:
-    State()
-        : m_globalAlpha(1)
-        , m_imageInterpolationQuality(InterpolationDefault)
-    {
-    }
+    State() = default;
 
-    State(float globalAlpha, InterpolationQuality imageInterpolationQuality)
-        : m_globalAlpha(globalAlpha)
-        , m_imageInterpolationQuality(imageInterpolationQuality)
-    {
-        // We do not copy m_imageMaskInformation because otherwise it would be applied
-        // more than once during subsequent calls to restore().
-    }
-
     ImageMaskInformation m_imageMaskInformation;
-    float m_globalAlpha;
-    InterpolationQuality m_imageInterpolationQuality;
 };
 
 PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
@@ -108,7 +94,7 @@
 
 void PlatformContextCairo::save()
 {
-    m_stateStack.append(State(m_state->m_globalAlpha, m_state->m_imageInterpolationQuality));
+    m_stateStack.append(State());
     m_state = &m_stateStack.last();
 
     cairo_save(m_cr.get());
@@ -157,7 +143,7 @@
         cairo_fill(cr);
 }
 
-void PlatformContextCairo::drawSurfaceToContext(cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, const Cairo::ShadowState& shadowState, GraphicsContext& context)
+void PlatformContextCairo::drawSurfaceToContext(cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, InterpolationQuality imageInterpolationQuality, float globalAlpha, const Cairo::ShadowState& shadowState, GraphicsContext& context)
 {
     // Avoid invalid cairo matrix with small values.
     if (std::fabs(destRect.width()) < 0.5f || std::fabs(destRect.height()) < 0.5f)
@@ -194,7 +180,7 @@
     RefPtr<cairo_pattern_t> pattern = adoptRef(cairo_pattern_create_for_surface(patternSurface.get()));
 
     ASSERT(m_state);
-    switch (m_state->m_imageInterpolationQuality) {
+    switch (imageInterpolationQuality) {
     case InterpolationNone:
     case InterpolationLow:
         cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_FAST);
@@ -227,33 +213,10 @@
     }
 
     cairo_save(m_cr.get());
-    drawPatternToCairoContext(m_cr.get(), pattern.get(), destRect, globalAlpha());
+    drawPatternToCairoContext(m_cr.get(), pattern.get(), destRect, globalAlpha);
     cairo_restore(m_cr.get());
 }
 
-void PlatformContextCairo::setImageInterpolationQuality(InterpolationQuality quality)
-{
-    ASSERT(m_state);
-    m_state->m_imageInterpolationQuality = quality;
-}
-
-InterpolationQuality PlatformContextCairo::imageInterpolationQuality() const
-{
-    ASSERT(m_state);
-    return m_state->m_imageInterpolationQuality;
-}
-
-
-float PlatformContextCairo::globalAlpha() const
-{
-    return m_state->m_globalAlpha;
-}
-
-void PlatformContextCairo::setGlobalAlpha(float globalAlpha)
-{
-    m_state->m_globalAlpha = globalAlpha;
-}
-
 } // namespace WebCore
 
 #endif // USE(CAIRO)

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h	2018-01-17 13:06:01 UTC (rev 227065)
@@ -64,15 +64,10 @@
 
     void save();
     void restore();
-    void setGlobalAlpha(float);
-    float globalAlpha() const;
 
     void pushImageMask(cairo_surface_t*, const FloatRect&);
-    WEBCORE_EXPORT void drawSurfaceToContext(cairo_surface_t*, const FloatRect& destRect, const FloatRect& srcRect, const Cairo::ShadowState&, GraphicsContext&);
+    WEBCORE_EXPORT void drawSurfaceToContext(cairo_surface_t*, const FloatRect& destRect, const FloatRect& srcRect, InterpolationQuality, float globalAlpha, const Cairo::ShadowState&, GraphicsContext&);
 
-    void setImageInterpolationQuality(InterpolationQuality);
-    InterpolationQuality imageInterpolationQuality() const;
-
 private:
     RefPtr<cairo_t> m_cr;
 

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (227064 => 227065)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -2974,7 +2974,8 @@
         FloatRect srcRect(0, 0, width, height);
         if (image) {
             WebCore::PlatformContextCairo* ctxt = context.platformContext();
-            ctxt->drawSurfaceToContext(image, destRect, srcRect, Cairo::ShadowState(context.state()), context);
+            auto& state = context.state();
+            ctxt->drawSurfaceToContext(image, destRect, srcRect, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), context);
             cairo_surface_destroy(image);
         }
 #else

Modified: trunk/Source/WebKit/ChangeLog (227064 => 227065)


--- trunk/Source/WebKit/ChangeLog	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebKit/ChangeLog	2018-01-17 13:06:01 UTC (rev 227065)
@@ -1,3 +1,16 @@
+2018-01-17  Zan Dobersek  <[email protected]>
+
+        [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
+        https://bugs.webkit.org/show_bug.cgi?id=181725
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::paint):
+        Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
+        * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
+        (WebKit::convertCairoSurfaceToShareableBitmap): Ditto.
+
 2018-01-17  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.6 release.

Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (227064 => 227065)


--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -75,7 +75,8 @@
     FloatRect destRect(dstPoint, srcRect.size());
     FloatRect srcRectScaled(srcRect);
     srcRectScaled.scale(scaleFactor);
-    context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, Cairo::ShadowState(context.state()), context);
+    auto& state = context.state();
+    context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), context);
 }
 
 RefPtr<cairo_surface_t> ShareableBitmap::createCairoSurface()

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp (227064 => 227065)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2018-01-17 11:23:58 UTC (rev 227064)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2018-01-17 13:06:01 UTC (rev 227065)
@@ -54,7 +54,8 @@
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, { });
     auto graphicsContext = bitmap->createGraphicsContext();
 
-    graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), Cairo::ShadowState(graphicsContext->state()), *graphicsContext);
+    auto& state = graphicsContext->state();
+    graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), *graphicsContext);
     return bitmap;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to