Title: [228821] trunk/Source
Revision
228821
Author
[email protected]
Date
2018-02-20 09:03:07 -0800 (Tue, 20 Feb 2018)

Log Message

[Cairo] Drop target GraphicsContext usage in Cairo operations
https://bugs.webkit.org/show_bug.cgi?id=182964

Reviewed by Carlos Garcia Campos.

The GraphicsContext parameters in various Cairo operations are not used
anymore, so they can be removed. Callsites are updated to reflect this.

Source/WebCore:

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawShadowLayerBuffer):
(WebCore::Cairo::fillShadowBuffer):
(WebCore::Cairo::drawPathShadow):
(WebCore::Cairo::drawGlyphsShadow):
(WebCore::Cairo::fillRect):
(WebCore::Cairo::fillRoundedRect):
(WebCore::Cairo::fillRectWithRoundedHole):
(WebCore::Cairo::fillPath):
(WebCore::Cairo::strokeRect):
(WebCore::Cairo::strokePath):
(WebCore::Cairo::drawGlyphs):
(WebCore::Cairo::drawNativeImage):
(WebCore::Cairo::drawSurface):
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::fillRect):
(WebCore::GraphicsContextImplCairo::fillRoundedRect):
(WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
(WebCore::GraphicsContextImplCairo::fillPath):
(WebCore::GraphicsContextImplCairo::strokeRect):
(WebCore::GraphicsContextImplCairo::strokePath):
(WebCore::GraphicsContextImplCairo::drawGlyphs):
(WebCore::GraphicsContextImplCairo::drawNativeImage):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):

Source/WebKit:

* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::paint):
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::convertCairoSurfaceToShareableBitmap):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228820 => 228821)


--- trunk/Source/WebCore/ChangeLog	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/ChangeLog	2018-02-20 17:03:07 UTC (rev 228821)
@@ -1,3 +1,50 @@
+2018-02-20  Zan Dobersek  <[email protected]>
+
+        [Cairo] Drop target GraphicsContext usage in Cairo operations
+        https://bugs.webkit.org/show_bug.cgi?id=182964
+
+        Reviewed by Carlos Garcia Campos.
+
+        The GraphicsContext parameters in various Cairo operations are not used
+        anymore, so they can be removed. Callsites are updated to reflect this.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::drawShadowLayerBuffer):
+        (WebCore::Cairo::fillShadowBuffer):
+        (WebCore::Cairo::drawPathShadow):
+        (WebCore::Cairo::drawGlyphsShadow):
+        (WebCore::Cairo::fillRect):
+        (WebCore::Cairo::fillRoundedRect):
+        (WebCore::Cairo::fillRectWithRoundedHole):
+        (WebCore::Cairo::fillPath):
+        (WebCore::Cairo::strokeRect):
+        (WebCore::Cairo::strokePath):
+        (WebCore::Cairo::drawGlyphs):
+        (WebCore::Cairo::drawNativeImage):
+        (WebCore::Cairo::drawSurface):
+        * platform/graphics/cairo/CairoOperations.h:
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawNativeImage):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::platformFillRoundedRect):
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
+        (WebCore::GraphicsContextImplCairo::fillRect):
+        (WebCore::GraphicsContextImplCairo::fillRoundedRect):
+        (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
+        (WebCore::GraphicsContextImplCairo::fillPath):
+        (WebCore::GraphicsContextImplCairo::strokeRect):
+        (WebCore::GraphicsContextImplCairo::strokePath):
+        (WebCore::GraphicsContextImplCairo::drawGlyphs):
+        (WebCore::GraphicsContextImplCairo::drawNativeImage):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
+
 2018-02-20  Sergio Villar Senin  <[email protected]>
 
         [WebVR][OpenVR] Retrieve eye parameters and field of view

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


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -175,7 +175,7 @@
     FillAndStroke = Fill + Stroke
 };
 
-static void drawShadowLayerBuffer(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const ShadowState& shadowState, GraphicsContext& targetContext)
+static void drawShadowLayerBuffer(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const ShadowState& shadowState)
 {
     RefPtr<Image> image = layerImage.copyImage(DontCopyBackingStore);
     if (!image)
@@ -184,11 +184,11 @@
     if (auto surface = image->nativeImageForCurrentFrame()) {
         drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize),
             shadowState.globalCompositeOperator, BlendModeNormal, ImageOrientation(),
-            InterpolationDefault, shadowState.globalAlpha, ShadowState(), targetContext);
+            InterpolationDefault, shadowState.globalAlpha, ShadowState());
     }
 }
 
-static void fillShadowBuffer(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect, const ShadowState& shadowState, GraphicsContext& targetContext)
+static void fillShadowBuffer(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect, const ShadowState& shadowState)
 {
     save(platformContext);
 
@@ -201,12 +201,12 @@
     FillSource fillSource;
     fillSource.globalAlpha = shadowState.globalAlpha;
     fillSource.color = shadowState.color;
-    fillRect(platformContext, FloatRect(layerOrigin, sourceRect.size()), fillSource, ShadowState(), targetContext);
+    fillRect(platformContext, FloatRect(layerOrigin, sourceRect.size()), fillSource, ShadowState());
 
     restore(platformContext);
 }
 
-static inline void drawPathShadow(PlatformContextCairo& platformContext, const FillSource& fillSource, const StrokeSource& strokeSource, const ShadowState& shadowState, GraphicsContext& targetContext, PathDrawingStyle drawingStyle)
+static inline void drawPathShadow(PlatformContextCairo& platformContext, const FillSource& fillSource, const StrokeSource& strokeSource, const ShadowState& shadowState, PathDrawingStyle drawingStyle)
 {
     ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
     if (shadow.type() == ShadowBlur::NoShadow)
@@ -256,7 +256,7 @@
                 cairo_stroke(cairoShadowContext);
             }
         },
-        [&platformContext, &shadowState, &cairoContext, &path, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
+        [&platformContext, &shadowState, &cairoContext, &path](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
         {
             // The original path may still be hanging around on the context and endShadowLayer
             // will take care of properly creating a path to draw the result shadow. We remove the path
@@ -264,7 +264,7 @@
             // See: https://bugs.webkit.org/show_bug.cgi?id=108897
             cairo_new_path(cairoContext);
 
-            drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState, targetContext);
+            drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState);
 
             cairo_append_path(cairoContext, path.get());
         });
@@ -326,7 +326,7 @@
     }
 }
 
-static void drawGlyphsShadow(PlatformContextCairo& platformContext, const ShadowState& shadowState, TextDrawingModeFlags textDrawingMode, const FloatSize& shadowOffset, const Color& shadowColor, const FloatPoint& point, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs, GraphicsContext& targetContext)
+static void drawGlyphsShadow(PlatformContextCairo& platformContext, const ShadowState& shadowState, TextDrawingModeFlags textDrawingMode, const FloatSize& shadowOffset, const Color& shadowColor, const FloatPoint& point, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs)
 {
     ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
     if (!(textDrawingMode & TextModeFill) || shadow.type() == ShadowBlur::NoShadow)
@@ -354,9 +354,9 @@
         {
             drawGlyphsToContext(shadowContext.platformContext()->cr(), scaledFont, syntheticBoldOffset, glyphs);
         },
-        [&platformContext, &shadowState, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
+        [&platformContext, &shadowState](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
         {
-            drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState, targetContext);
+            drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState);
         });
 }
 
@@ -680,23 +680,23 @@
     cairo_set_miter_limit(platformContext.cr(), miterLimit);
 }
 
-void fillRect(PlatformContextCairo& platformContext, const FloatRect& rect, const FillSource& fillSource, const ShadowState& shadowState, GraphicsContext& targetContext)
+void fillRect(PlatformContextCairo& platformContext, const FloatRect& rect, const FillSource& fillSource, const ShadowState& shadowState)
 {
     cairo_t* cr = platformContext.cr();
 
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
-    drawPathShadow(platformContext, fillSource, { }, shadowState, targetContext, Fill);
+    drawPathShadow(platformContext, fillSource, { }, shadowState, Fill);
     fillCurrentCairoPath(platformContext, fillSource);
 }
 
-void fillRect(PlatformContextCairo& platformContext, const FloatRect& rect, const Color& color, const ShadowState& shadowState, GraphicsContext& targetContext)
+void fillRect(PlatformContextCairo& platformContext, const FloatRect& rect, const Color& color, const ShadowState& shadowState)
 {
     if (shadowState.isVisible()) {
         ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
         shadow.drawRectShadow(State::getCTM(platformContext), State::getClipBounds(platformContext), FloatRoundedRect(rect),
-            [&platformContext, &shadowState, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
+            [&platformContext, &shadowState](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
             {
-                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState, targetContext);
+                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState);
             });
     }
 
@@ -712,14 +712,14 @@
     cairo_fill(cr);
 }
 
-void fillRoundedRect(PlatformContextCairo& platformContext, const FloatRoundedRect& rect, const Color& color, const ShadowState& shadowState, GraphicsContext& targetContext)
+void fillRoundedRect(PlatformContextCairo& platformContext, const FloatRoundedRect& rect, const Color& color, const ShadowState& shadowState)
 {
     if (shadowState.isVisible()) {
         ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
         shadow.drawRectShadow(State::getCTM(platformContext), State::getClipBounds(platformContext), rect,
-            [&platformContext, &shadowState, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
+            [&platformContext, &shadowState](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
             {
-                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState, targetContext);
+                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState);
             });
     }
 
@@ -735,7 +735,7 @@
     cairo_restore(cr);
 }
 
-void fillRectWithRoundedHole(PlatformContextCairo& platformContext, const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const FillSource& fillSource, const ShadowState& shadowState, GraphicsContext& targetContext)
+void fillRectWithRoundedHole(PlatformContextCairo& platformContext, const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const FillSource& fillSource, const ShadowState& shadowState)
 {
     // FIXME: this should leverage the specified color.
 
@@ -742,9 +742,9 @@
     if (shadowState.isRequired(platformContext)) {
         ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
         shadow.drawInsetShadow(State::getCTM(platformContext), State::getClipBounds(platformContext), rect, roundedHoleRect,
-            [&platformContext, &shadowState, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
+            [&platformContext, &shadowState](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect& sourceRect)
             {
-                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState, targetContext);
+                fillShadowBuffer(platformContext, layerImage, layerOrigin, layerSize, sourceRect, shadowState);
             });
     }
 
@@ -763,16 +763,16 @@
     cairo_restore(cr);
 }
 
-void fillPath(PlatformContextCairo& platformContext, const Path& path, const FillSource& fillSource, const ShadowState& shadowState, GraphicsContext& targetContext)
+void fillPath(PlatformContextCairo& platformContext, const Path& path, const FillSource& fillSource, const ShadowState& shadowState)
 {
     cairo_t* cr = platformContext.cr();
 
     setPathOnCairoContext(cr, path.platformPath()->context());
-    drawPathShadow(platformContext, fillSource, { }, shadowState, targetContext, Fill);
+    drawPathShadow(platformContext, fillSource, { }, shadowState, Fill);
     fillCurrentCairoPath(platformContext, fillSource);
 }
 
-void strokeRect(PlatformContextCairo& platformContext, const FloatRect& rect, float lineWidth, const StrokeSource& strokeSource, const ShadowState& shadowState, GraphicsContext& targetContext)
+void strokeRect(PlatformContextCairo& platformContext, const FloatRect& rect, float lineWidth, const StrokeSource& strokeSource, const ShadowState& shadowState)
 {
     cairo_t* cr = platformContext.cr();
     cairo_save(cr);
@@ -779,7 +779,7 @@
 
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
     cairo_set_line_width(cr, lineWidth);
-    drawPathShadow(platformContext, { }, strokeSource, shadowState, targetContext, Stroke);
+    drawPathShadow(platformContext, { }, strokeSource, shadowState, Stroke);
     prepareForStroking(cr, strokeSource, PreserveAlpha);
     cairo_stroke(cr);
 
@@ -786,12 +786,12 @@
     cairo_restore(cr);
 }
 
-void strokePath(PlatformContextCairo& platformContext, const Path& path, const StrokeSource& strokeSource, const ShadowState& shadowState, GraphicsContext& targetContext)
+void strokePath(PlatformContextCairo& platformContext, const Path& path, const StrokeSource& strokeSource, const ShadowState& shadowState)
 {
     cairo_t* cr = platformContext.cr();
 
     setPathOnCairoContext(cr, path.platformPath()->context());
-    drawPathShadow(platformContext, { }, strokeSource, shadowState, targetContext, Stroke);
+    drawPathShadow(platformContext, { }, strokeSource, shadowState, Stroke);
     prepareForStroking(cr, strokeSource, PreserveAlpha);
     cairo_stroke(cr);
 }
@@ -807,9 +807,9 @@
     cairo_restore(cr);
 }
 
-void drawGlyphs(PlatformContextCairo& platformContext, const FillSource& fillSource, const StrokeSource& strokeSource, const ShadowState& shadowState, const FloatPoint& point, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs, float xOffset, TextDrawingModeFlags textDrawingMode, float strokeThickness, const FloatSize& shadowOffset, const Color& shadowColor, GraphicsContext& targetContext)
+void drawGlyphs(PlatformContextCairo& platformContext, const FillSource& fillSource, const StrokeSource& strokeSource, const ShadowState& shadowState, const FloatPoint& point, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs, float xOffset, TextDrawingModeFlags textDrawingMode, float strokeThickness, const FloatSize& shadowOffset, const Color& shadowColor)
 {
-    drawGlyphsShadow(platformContext, shadowState, textDrawingMode, shadowOffset, shadowColor, point, scaledFont, syntheticBoldOffset, glyphs, targetContext);
+    drawGlyphsShadow(platformContext, shadowState, textDrawingMode, shadowOffset, shadowColor, point, scaledFont, syntheticBoldOffset, glyphs);
 
     cairo_t* cr = platformContext.cr();
     cairo_save(cr);
@@ -836,7 +836,7 @@
     cairo_restore(cr);
 }
 
-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)
+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)
 {
     platformContext.save();
 
@@ -859,7 +859,7 @@
         }
     }
 
-    drawSurface(platformContext, surface, dst, srcRect, imageInterpolationQuality, globalAlpha, shadowState, targetContext);
+    drawSurface(platformContext, surface, dst, srcRect, imageInterpolationQuality, globalAlpha, shadowState);
     platformContext.restore();
 }
 
@@ -869,7 +869,7 @@
     drawPatternToCairoContext(platformContext.cr(), surface, size, tileRect, patternTransform, phase, toCairoOperator(compositeOperator, blendMode), destRect);
 }
 
-void drawSurface(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, InterpolationQuality imageInterpolationQuality, float globalAlpha, const ShadowState& shadowState, GraphicsContext& targetContext)
+void drawSurface(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, InterpolationQuality imageInterpolationQuality, float globalAlpha, const ShadowState& shadowState)
 {
     // Avoid invalid cairo matrix with small values.
     if (std::fabs(destRect.width()) < 0.5f || std::fabs(destRect.height()) < 0.5f)
@@ -936,9 +936,9 @@
             {
                 drawPatternToCairoContext(shadowContext.platformContext()->cr(), pattern.get(), destRect, 1);
             },
-            [&platformContext, &shadowState, &targetContext](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
+            [&platformContext, &shadowState](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const FloatRect&)
             {
-                drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState, targetContext);
+                drawShadowLayerBuffer(platformContext, layerImage, layerOrigin, layerSize, shadowState);
             });
     }
 

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


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-02-20 17:03:07 UTC (rev 228821)
@@ -46,7 +46,6 @@
 class FloatRect;
 class FloatRoundedRect;
 class FloatSize;
-class GraphicsContext;
 class Path;
 class PlatformContextCairo;
 
@@ -127,21 +126,21 @@
 void setLineJoin(PlatformContextCairo&, LineJoin);
 void setMiterLimit(PlatformContextCairo&, float);
 
-void fillRect(PlatformContextCairo&, const FloatRect&, const FillSource&, const ShadowState&, GraphicsContext&);
-void fillRect(PlatformContextCairo&, const FloatRect&, const Color&, const ShadowState&, GraphicsContext&);
+void fillRect(PlatformContextCairo&, const FloatRect&, const FillSource&, const ShadowState&);
+void fillRect(PlatformContextCairo&, const FloatRect&, const Color&, const ShadowState&);
 void fillRect(PlatformContextCairo&, const FloatRect&, cairo_pattern_t*);
-void fillRoundedRect(PlatformContextCairo&, const FloatRoundedRect&, const Color&, const ShadowState&, GraphicsContext&);
-void fillRectWithRoundedHole(PlatformContextCairo&, const FloatRect&, const FloatRoundedRect&, const FillSource&, const ShadowState&, GraphicsContext&);
-void fillPath(PlatformContextCairo&, const Path&, const FillSource&, const ShadowState&, GraphicsContext&);
-void strokeRect(PlatformContextCairo&, const FloatRect&, float, const StrokeSource&, const ShadowState&, GraphicsContext&);
-void strokePath(PlatformContextCairo&, const Path&, const StrokeSource&, const ShadowState&, GraphicsContext&);
+void fillRoundedRect(PlatformContextCairo&, const FloatRoundedRect&, const Color&, const ShadowState&);
+void fillRectWithRoundedHole(PlatformContextCairo&, const FloatRect&, const FloatRoundedRect&, const FillSource&, const ShadowState&);
+void fillPath(PlatformContextCairo&, const Path&, const FillSource&, const ShadowState&);
+void strokeRect(PlatformContextCairo&, const FloatRect&, float, const StrokeSource&, const ShadowState&);
+void strokePath(PlatformContextCairo&, const Path&, const StrokeSource&, const ShadowState&);
 void clearRect(PlatformContextCairo&, const FloatRect&);
 
-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 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&);
 
-void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation, InterpolationQuality, float, const ShadowState&, GraphicsContext&);
+void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation, InterpolationQuality, float, const ShadowState&);
 void drawPattern(PlatformContextCairo&, cairo_surface_t*, const IntSize&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, CompositeOperator, BlendMode);
-void drawSurface(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, InterpolationQuality, float, const ShadowState&, GraphicsContext&);
+void drawSurface(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, InterpolationQuality, float, const ShadowState&);
 
 void drawRect(PlatformContextCairo&, const FloatRect&, float, const Color&, StrokeStyle, const Color&);
 void drawLine(PlatformContextCairo&, const FloatPoint&, const FloatPoint&, StrokeStyle, const Color&, float, bool);

Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp (228820 => 228821)


--- trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -74,7 +74,7 @@
     auto& state = context.state();
     Cairo::drawGlyphs(*context.platformContext(), Cairo::FillSource(state), Cairo::StrokeSource(state),
         Cairo::ShadowState(state), point, scaledFont, syntheticBoldOffset, glyphs, xOffset,
-        state.textDrawingMode, state.strokeThickness, state.shadowOffset, state.shadowColor, context);
+        state.textDrawingMode, state.strokeThickness, state.shadowOffset, state.shadowColor);
 }
 
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)

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


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -131,7 +131,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), *this);
+    Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
 }
 
 // This is only used to draw borders, so we should not draw shadows.
@@ -181,7 +181,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::fillPath(*platformContext(), path, Cairo::FillSource(state), Cairo::ShadowState(state), *this);
+    Cairo::fillPath(*platformContext(), path, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContext::strokePath(const Path& path)
@@ -196,7 +196,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::strokePath(*platformContext(), path, Cairo::StrokeSource(state), Cairo::ShadowState(state), *this);
+    Cairo::strokePath(*platformContext(), path, Cairo::StrokeSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect)
@@ -211,7 +211,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::fillRect(*platformContext(), rect, Cairo::FillSource(state), Cairo::ShadowState(state), *this);
+    Cairo::fillRect(*platformContext(), rect, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color)
@@ -225,7 +225,7 @@
     }
 
     ASSERT(hasPlatformContext());
-    Cairo::fillRect(*platformContext(), rect, color, Cairo::ShadowState(state()), *this);
+    Cairo::fillRect(*platformContext(), rect, color, Cairo::ShadowState(state()));
 }
 
 void GraphicsContext::clip(const FloatRect& rect)
@@ -501,7 +501,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::strokeRect(*platformContext(), rect, lineWidth, Cairo::StrokeSource(state), Cairo::ShadowState(state), *this);
+    Cairo::strokeRect(*platformContext(), rect, lineWidth, Cairo::StrokeSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContext::setLineCap(LineCap lineCap)
@@ -641,7 +641,7 @@
         return;
 
     ASSERT(hasPlatformContext());
-    Cairo::fillRoundedRect(*platformContext(), rect, color, Cairo::ShadowState(state()), *this);
+    Cairo::fillRoundedRect(*platformContext(), rect, color, Cairo::ShadowState(state()));
 }
 
 void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
@@ -656,7 +656,7 @@
 
     ASSERT(hasPlatformContext());
     auto& state = this->state();
-    Cairo::fillRectWithRoundedHole(*platformContext(), rect, roundedHoleRect, Cairo::FillSource(state), Cairo::ShadowState(state), *this);
+    Cairo::fillRectWithRoundedHole(*platformContext(), rect, roundedHoleRect, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator compositeOperator, BlendMode blendMode)

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp (228820 => 228821)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -139,15 +139,13 @@
 
 void GraphicsContextImplCairo::fillRect(const FloatRect& rect)
 {
-    auto& context = graphicsContext();
-    auto& state = context.state();
-    Cairo::fillRect(m_platformContext, rect, Cairo::FillSource(state), Cairo::ShadowState(state), context);
+    auto& state = graphicsContext().state();
+    Cairo::fillRect(m_platformContext, rect, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContextImplCairo::fillRect(const FloatRect& rect, const Color& color)
 {
-    auto& context = graphicsContext();
-    Cairo::fillRect(m_platformContext, rect, color, Cairo::ShadowState(context.state()), context);
+    Cairo::fillRect(m_platformContext, rect, color, Cairo::ShadowState(graphicsContext().state()));
 }
 
 void GraphicsContextImplCairo::fillRect(const FloatRect& rect, Gradient& gradient)
@@ -161,27 +159,26 @@
 
 void GraphicsContextImplCairo::fillRect(const FloatRect& rect, const Color& color, CompositeOperator compositeOperator, BlendMode blendMode)
 {
-    auto& context = graphicsContext();
-    CompositeOperator previousOperator = context.state().compositeOperator;
+    auto& state = graphicsContext().state();
+    CompositeOperator previousOperator = state.compositeOperator;
 
     Cairo::State::setCompositeOperation(m_platformContext, compositeOperator, blendMode);
-    Cairo::fillRect(m_platformContext, rect, color, Cairo::ShadowState(context.state()), context);
+    Cairo::fillRect(m_platformContext, rect, color, Cairo::ShadowState(state));
     Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendModeNormal);
 }
 
 void GraphicsContextImplCairo::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
 {
-    auto& context = graphicsContext();
+    auto& state = graphicsContext().state();
 
-    CompositeOperator previousOperator = context.compositeOperation();
+    CompositeOperator previousOperator = state.compositeOperator;
     Cairo::State::setCompositeOperation(m_platformContext, previousOperator, blendMode);
 
-    Cairo::ShadowState shadowState(context.state());
-
+    Cairo::ShadowState shadowState(state);
     if (rect.isRounded())
-        Cairo::fillRoundedRect(m_platformContext, rect, color, shadowState, context);
+        Cairo::fillRoundedRect(m_platformContext, rect, color, shadowState);
     else
-        Cairo::fillRect(m_platformContext, rect.rect(), color, shadowState, context);
+        Cairo::fillRect(m_platformContext, rect.rect(), color, shadowState);
 
     Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendModeNormal);
 }
@@ -188,15 +185,13 @@
 
 void GraphicsContextImplCairo::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color&)
 {
-    auto& context = graphicsContext();
-    Cairo::fillRectWithRoundedHole(m_platformContext, rect, roundedHoleRect, { }, Cairo::ShadowState(context.state()), context);
+    Cairo::fillRectWithRoundedHole(m_platformContext, rect, roundedHoleRect, { }, Cairo::ShadowState(graphicsContext().state()));
 }
 
 void GraphicsContextImplCairo::fillPath(const Path& path)
 {
-    auto& context = graphicsContext();
-    auto& state = context.state();
-    Cairo::fillPath(m_platformContext, path, Cairo::FillSource(state), Cairo::ShadowState(state), context);
+    auto& state = graphicsContext().state();
+    Cairo::fillPath(m_platformContext, path, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContextImplCairo::fillEllipse(const FloatRect& rect)
@@ -208,16 +203,14 @@
 
 void GraphicsContextImplCairo::strokeRect(const FloatRect& rect, float lineWidth)
 {
-    auto& context = graphicsContext();
-    auto& state = context.state();
-    Cairo::strokeRect(m_platformContext, rect, lineWidth, Cairo::StrokeSource(state), Cairo::ShadowState(state), context);
+    auto& state = graphicsContext().state();
+    Cairo::strokeRect(m_platformContext, rect, lineWidth, Cairo::StrokeSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContextImplCairo::strokePath(const Path& path)
 {
-    auto& context = graphicsContext();
-    auto& state = context.state();
-    Cairo::strokePath(m_platformContext, path, Cairo::StrokeSource(state), Cairo::ShadowState(state), context);
+    auto& state = graphicsContext().state();
+    Cairo::strokePath(m_platformContext, path, Cairo::StrokeSource(state), Cairo::ShadowState(state));
 }
 
 void GraphicsContextImplCairo::strokeEllipse(const FloatRect& rect)
@@ -255,11 +248,10 @@
     cairo_scaled_font_t* scaledFont = font.platformData().scaledFont();
     double syntheticBoldOffset = font.syntheticBoldOffset();
 
-    auto& context = graphicsContext();
-    auto& state = context.state();
+    auto& state = graphicsContext().state();
     Cairo::drawGlyphs(m_platformContext, Cairo::FillSource(state), Cairo::StrokeSource(state),
         Cairo::ShadowState(state), point, scaledFont, syntheticBoldOffset, glyphs, xOffset,
-        state.textDrawingMode, state.strokeThickness, state.shadowOffset, state.shadowColor, context);
+        state.textDrawingMode, state.strokeThickness, state.shadowOffset, state.shadowColor);
 }
 
 ImageDrawResult GraphicsContextImplCairo::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
@@ -280,9 +272,8 @@
 void GraphicsContextImplCairo::drawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOperator, BlendMode blendMode, ImageOrientation orientation)
 {
     UNUSED_PARAM(imageSize);
-    auto& context = graphicsContext();
-    auto& state = context.state();
-    Cairo::drawNativeImage(m_platformContext, image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), graphicsContext());
+    auto& state = graphicsContext().state();
+    Cairo::drawNativeImage(m_platformContext, image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
 }
 
 void GraphicsContextImplCairo::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize&, CompositeOperator compositeOperator, BlendMode blendMode)

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


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -2975,7 +2975,7 @@
         if (image) {
             ASSERT(context.hasPlatformContext());
             auto& state = context.state();
-            Cairo::drawSurface(*context.platformContext(), image, destRect, srcRect, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), context);
+            Cairo::drawSurface(*context.platformContext(), image, destRect, srcRect, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
             cairo_surface_destroy(image);
         }
 #else

Modified: trunk/Source/WebKit/ChangeLog (228820 => 228821)


--- trunk/Source/WebKit/ChangeLog	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebKit/ChangeLog	2018-02-20 17:03:07 UTC (rev 228821)
@@ -1,3 +1,18 @@
+2018-02-20  Zan Dobersek  <[email protected]>
+
+        [Cairo] Drop target GraphicsContext usage in Cairo operations
+        https://bugs.webkit.org/show_bug.cgi?id=182964
+
+        Reviewed by Carlos Garcia Campos.
+
+        The GraphicsContext parameters in various Cairo operations are not used
+        anymore, so they can be removed. Callsites are updated to reflect this.
+
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::paint):
+        * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
+        (WebKit::convertCairoSurfaceToShareableBitmap):
+
 2018-02-20  Philippe Normand  <[email protected]>
 
         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser

Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (228820 => 228821)


--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -77,7 +77,7 @@
 
     ASSERT(context.hasPlatformContext());
     auto& state = context.state();
-    Cairo::drawSurface(*context.platformContext(), surface.get(), destRect, srcRectScaled, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), context);
+    Cairo::drawSurface(*context.platformContext(), surface.get(), destRect, srcRectScaled, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
 }
 
 RefPtr<cairo_surface_t> ShareableBitmap::createCairoSurface()

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


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2018-02-20 16:37:21 UTC (rev 228820)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2018-02-20 17:03:07 UTC (rev 228821)
@@ -55,7 +55,7 @@
 
     ASSERT(graphicsContext->hasPlatformContext());
     auto& state = graphicsContext->state();
-    Cairo::drawSurface(*graphicsContext->platformContext(), surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state), *graphicsContext);
+    Cairo::drawSurface(*graphicsContext->platformContext(), surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
     return bitmap;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to