Title: [224870] trunk/Source/WebCore
Revision
224870
Author
zandober...@gmail.com
Date
2017-11-14 22:08:44 -0800 (Tue, 14 Nov 2017)

Log Message

[Cairo] Add GraphicsContextImplCairo stub
https://bugs.webkit.org/show_bug.cgi?id=179658

Reviewed by Carlos Garcia Campos.

Add the GraphicsContextImplCairo class, which at this point is still
an empty implementation of the GraphicsContextImpl interface. Plan for
the near future is to start mapping method invocations to CairoOperation
functions, essentially mirroring what the Cairo-specific GraphicsContext
methods do today.

In the future this implementation would hopefully allow us to apply a
recorded list of GraphicsContext commands against a PlatformContextCairo
instance.

* platform/SourcesCairo.txt:
* platform/graphics/cairo/GraphicsContextImplCairo.cpp: Added.
(WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
(WebCore::m_platformContext):
(WebCore::GraphicsContextImplCairo::updateState):
(WebCore::GraphicsContextImplCairo::clearShadow):
(WebCore::GraphicsContextImplCairo::setLineCap):
(WebCore::GraphicsContextImplCairo::setLineDash):
(WebCore::GraphicsContextImplCairo::setLineJoin):
(WebCore::GraphicsContextImplCairo::setMiterLimit):
(WebCore::GraphicsContextImplCairo::fillRect):
(WebCore::GraphicsContextImplCairo::fillRoundedRect):
(WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
(WebCore::GraphicsContextImplCairo::fillPath):
(WebCore::GraphicsContextImplCairo::fillEllipse):
(WebCore::GraphicsContextImplCairo::strokeRect):
(WebCore::GraphicsContextImplCairo::strokePath):
(WebCore::GraphicsContextImplCairo::strokeEllipse):
(WebCore::GraphicsContextImplCairo::clearRect):
(WebCore::GraphicsContextImplCairo::drawGlyphs):
(WebCore::GraphicsContextImplCairo::drawImage):
(WebCore::GraphicsContextImplCairo::drawTiledImage):
(WebCore::GraphicsContextImplCairo::drawNativeImage):
(WebCore::GraphicsContextImplCairo::drawPattern):
(WebCore::GraphicsContextImplCairo::drawRect):
(WebCore::GraphicsContextImplCairo::drawLine):
(WebCore::GraphicsContextImplCairo::drawLinesForText):
(WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
(WebCore::GraphicsContextImplCairo::drawEllipse):
(WebCore::GraphicsContextImplCairo::drawPath):
(WebCore::GraphicsContextImplCairo::drawFocusRing):
(WebCore::GraphicsContextImplCairo::save):
(WebCore::GraphicsContextImplCairo::restore):
(WebCore::GraphicsContextImplCairo::translate):
(WebCore::GraphicsContextImplCairo::rotate):
(WebCore::GraphicsContextImplCairo::scale):
(WebCore::GraphicsContextImplCairo::concatCTM):
(WebCore::GraphicsContextImplCairo::beginTransparencyLayer):
(WebCore::GraphicsContextImplCairo::endTransparencyLayer):
(WebCore::GraphicsContextImplCairo::clip):
(WebCore::GraphicsContextImplCairo::clipOut):
(WebCore::GraphicsContextImplCairo::clipPath):
(WebCore::GraphicsContextImplCairo::applyDeviceScaleFactor):
* platform/graphics/cairo/GraphicsContextImplCairo.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224869 => 224870)


--- trunk/Source/WebCore/ChangeLog	2017-11-15 06:05:11 UTC (rev 224869)
+++ trunk/Source/WebCore/ChangeLog	2017-11-15 06:08:44 UTC (rev 224870)
@@ -1,5 +1,67 @@
 2017-11-14  Zan Dobersek  <zdober...@igalia.com>
 
+        [Cairo] Add GraphicsContextImplCairo stub
+        https://bugs.webkit.org/show_bug.cgi?id=179658
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add the GraphicsContextImplCairo class, which at this point is still
+        an empty implementation of the GraphicsContextImpl interface. Plan for
+        the near future is to start mapping method invocations to CairoOperation
+        functions, essentially mirroring what the Cairo-specific GraphicsContext
+        methods do today.
+
+        In the future this implementation would hopefully allow us to apply a
+        recorded list of GraphicsContext commands against a PlatformContextCairo
+        instance.
+
+        * platform/SourcesCairo.txt:
+        * platform/graphics/cairo/GraphicsContextImplCairo.cpp: Added.
+        (WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
+        (WebCore::m_platformContext):
+        (WebCore::GraphicsContextImplCairo::updateState):
+        (WebCore::GraphicsContextImplCairo::clearShadow):
+        (WebCore::GraphicsContextImplCairo::setLineCap):
+        (WebCore::GraphicsContextImplCairo::setLineDash):
+        (WebCore::GraphicsContextImplCairo::setLineJoin):
+        (WebCore::GraphicsContextImplCairo::setMiterLimit):
+        (WebCore::GraphicsContextImplCairo::fillRect):
+        (WebCore::GraphicsContextImplCairo::fillRoundedRect):
+        (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
+        (WebCore::GraphicsContextImplCairo::fillPath):
+        (WebCore::GraphicsContextImplCairo::fillEllipse):
+        (WebCore::GraphicsContextImplCairo::strokeRect):
+        (WebCore::GraphicsContextImplCairo::strokePath):
+        (WebCore::GraphicsContextImplCairo::strokeEllipse):
+        (WebCore::GraphicsContextImplCairo::clearRect):
+        (WebCore::GraphicsContextImplCairo::drawGlyphs):
+        (WebCore::GraphicsContextImplCairo::drawImage):
+        (WebCore::GraphicsContextImplCairo::drawTiledImage):
+        (WebCore::GraphicsContextImplCairo::drawNativeImage):
+        (WebCore::GraphicsContextImplCairo::drawPattern):
+        (WebCore::GraphicsContextImplCairo::drawRect):
+        (WebCore::GraphicsContextImplCairo::drawLine):
+        (WebCore::GraphicsContextImplCairo::drawLinesForText):
+        (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
+        (WebCore::GraphicsContextImplCairo::drawEllipse):
+        (WebCore::GraphicsContextImplCairo::drawPath):
+        (WebCore::GraphicsContextImplCairo::drawFocusRing):
+        (WebCore::GraphicsContextImplCairo::save):
+        (WebCore::GraphicsContextImplCairo::restore):
+        (WebCore::GraphicsContextImplCairo::translate):
+        (WebCore::GraphicsContextImplCairo::rotate):
+        (WebCore::GraphicsContextImplCairo::scale):
+        (WebCore::GraphicsContextImplCairo::concatCTM):
+        (WebCore::GraphicsContextImplCairo::beginTransparencyLayer):
+        (WebCore::GraphicsContextImplCairo::endTransparencyLayer):
+        (WebCore::GraphicsContextImplCairo::clip):
+        (WebCore::GraphicsContextImplCairo::clipOut):
+        (WebCore::GraphicsContextImplCairo::clipPath):
+        (WebCore::GraphicsContextImplCairo::applyDeviceScaleFactor):
+        * platform/graphics/cairo/GraphicsContextImplCairo.h: Added.
+
+2017-11-14  Zan Dobersek  <zdober...@igalia.com>
+
         [Cairo] Clean up CairoOperations, GradientCairo, GraphicsContextCairo implementation files
         https://bugs.webkit.org/show_bug.cgi?id=179679
 

Modified: trunk/Source/WebCore/platform/SourcesCairo.txt (224869 => 224870)


--- trunk/Source/WebCore/platform/SourcesCairo.txt	2017-11-15 06:05:11 UTC (rev 224869)
+++ trunk/Source/WebCore/platform/SourcesCairo.txt	2017-11-15 06:08:44 UTC (rev 224870)
@@ -29,6 +29,7 @@
 platform/graphics/cairo/GradientCairo.cpp
 platform/graphics/cairo/GraphicsContext3DCairo.cpp
 platform/graphics/cairo/GraphicsContextCairo.cpp
+platform/graphics/cairo/GraphicsContextImplCairo.cpp
 platform/graphics/cairo/ImageBufferCairo.cpp
 platform/graphics/cairo/IntRectCairo.cpp
 platform/graphics/cairo/NativeImageCairo.cpp

Added: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp (0 => 224870)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2017-11-15 06:08:44 UTC (rev 224870)
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "GraphicsContextImplCairo.h"
+
+#if USE(CAIRO)
+
+namespace WebCore {
+
+GraphicsContextImplCairo::GraphicsContextImplCairo(GraphicsContext& context, PlatformContextCairo& platformContext)
+    : GraphicsContextImpl(context, FloatRect { }, AffineTransform { })
+    , m_platformContext(platformContext)
+{
+}
+
+GraphicsContextImplCairo::~GraphicsContextImplCairo() = default;
+
+void GraphicsContextImplCairo::updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags)
+{
+}
+
+void GraphicsContextImplCairo::clearShadow()
+{
+}
+
+void GraphicsContextImplCairo::setLineCap(LineCap)
+{
+}
+
+void GraphicsContextImplCairo::setLineDash(const DashArray&, float)
+{
+}
+
+void GraphicsContextImplCairo::setLineJoin(LineJoin)
+{
+}
+
+void GraphicsContextImplCairo::setMiterLimit(float)
+{
+}
+
+void GraphicsContextImplCairo::fillRect(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::fillRect(const FloatRect&, const Color&)
+{
+}
+
+void GraphicsContextImplCairo::fillRect(const FloatRect&, Gradient&)
+{
+}
+
+void GraphicsContextImplCairo::fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode)
+{
+}
+
+void GraphicsContextImplCairo::fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode)
+{
+}
+
+void GraphicsContextImplCairo::fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect&, const Color&)
+{
+}
+
+void GraphicsContextImplCairo::fillPath(const Path&)
+{
+}
+
+void GraphicsContextImplCairo::fillEllipse(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::strokeRect(const FloatRect&, float)
+{
+}
+
+void GraphicsContextImplCairo::strokePath(const Path&)
+{
+}
+
+void GraphicsContextImplCairo::strokeEllipse(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::clearRect(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::drawGlyphs(const Font&, const GlyphBuffer&, unsigned, unsigned, const FloatPoint&, FontSmoothingMode)
+{
+}
+
+void GraphicsContextImplCairo::drawImage(Image&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&)
+{
+}
+
+void GraphicsContextImplCairo::drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions&)
+{
+}
+
+void GraphicsContextImplCairo::drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions&)
+{
+}
+
+void GraphicsContextImplCairo::drawNativeImage(const NativeImagePtr&, const FloatSize&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation)
+{
+}
+
+void GraphicsContextImplCairo::drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode)
+{
+}
+
+void GraphicsContextImplCairo::drawRect(const FloatRect&, float)
+{
+}
+
+void GraphicsContextImplCairo::drawLine(const FloatPoint&, const FloatPoint&)
+{
+}
+
+void GraphicsContextImplCairo::drawLinesForText(const FloatPoint&, const DashArray&, bool, bool, float)
+{
+}
+
+void GraphicsContextImplCairo::drawLineForDocumentMarker(const FloatPoint&, float, GraphicsContext::DocumentMarkerLineStyle)
+{
+}
+
+void GraphicsContextImplCairo::drawEllipse(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::drawPath(const Path&)
+{
+}
+
+void GraphicsContextImplCairo::drawFocusRing(const Path&, float, float, const Color&)
+{
+}
+
+void GraphicsContextImplCairo::drawFocusRing(const Vector<FloatRect>&, float, float, const Color&)
+{
+}
+
+void GraphicsContextImplCairo::save()
+{
+}
+
+void GraphicsContextImplCairo::restore()
+{
+}
+
+void GraphicsContextImplCairo::translate(float, float)
+{
+}
+
+void GraphicsContextImplCairo::rotate(float)
+{
+}
+
+void GraphicsContextImplCairo::scale(const FloatSize&)
+{
+}
+
+void GraphicsContextImplCairo::concatCTM(const AffineTransform&)
+{
+}
+
+void GraphicsContextImplCairo::beginTransparencyLayer(float)
+{
+}
+
+void GraphicsContextImplCairo::endTransparencyLayer()
+{
+}
+
+void GraphicsContextImplCairo::clip(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::clipOut(const FloatRect&)
+{
+}
+
+void GraphicsContextImplCairo::clipOut(const Path&)
+{
+}
+
+void GraphicsContextImplCairo::clipPath(const Path&, WindRule)
+{
+}
+
+void GraphicsContextImplCairo::applyDeviceScaleFactor(float)
+{
+}
+
+} // namespace WebCore
+
+#endif // USE(CAIRO)

Added: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h (0 => 224870)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	2017-11-15 06:08:44 UTC (rev 224870)
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#if USE(CAIRO)
+
+#include "GraphicsContextImpl.h"
+
+typedef struct _cairo cairo_t;
+
+namespace WebCore {
+
+class PlatformContextCairo;
+
+class GraphicsContextImplCairo final : public GraphicsContextImpl {
+public:
+    GraphicsContextImplCairo(GraphicsContext&, PlatformContextCairo&);
+    virtual ~GraphicsContextImplCairo();
+
+    void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) override;
+    void clearShadow() override;
+
+    void setLineCap(LineCap) override;
+    void setLineDash(const DashArray&, float) override;
+    void setLineJoin(LineJoin) override;
+    void setMiterLimit(float) override;
+
+    void fillRect(const FloatRect&) override;
+    void fillRect(const FloatRect&, const Color&) override;
+    void fillRect(const FloatRect&, Gradient&) override;
+    void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode) override;
+    void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode) override;
+    void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect&, const Color&) override;
+    void fillPath(const Path&) override;
+    void fillEllipse(const FloatRect&) override;
+    void strokeRect(const FloatRect&, float) override;
+    void strokePath(const Path&) override;
+    void strokeEllipse(const FloatRect&) override;
+    void clearRect(const FloatRect&) override;
+
+    void drawGlyphs(const Font&, const GlyphBuffer&, unsigned, unsigned, const FloatPoint&, FontSmoothingMode) override;
+
+    void drawImage(Image&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&) override;
+    void drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions&) override;
+    void drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions&) override;
+    void drawNativeImage(const NativeImagePtr&, const FloatSize&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation) override;
+    void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode = BlendModeNormal) override;
+
+    void drawRect(const FloatRect&, float) override;
+    void drawLine(const FloatPoint&, const FloatPoint&) override;
+    void drawLinesForText(const FloatPoint&, const DashArray&, bool, bool, float) override;
+    void drawLineForDocumentMarker(const FloatPoint&, float, GraphicsContext::DocumentMarkerLineStyle) override;
+    void drawEllipse(const FloatRect&) override;
+    void drawPath(const Path&) override;
+
+    void drawFocusRing(const Path&, float, float, const Color&) override;
+    void drawFocusRing(const Vector<FloatRect>&, float, float, const Color&) override;
+
+    void save() override;
+    void restore() override;
+
+    void translate(float, float) override;
+    void rotate(float) override;
+    void scale(const FloatSize&) override;
+    void concatCTM(const AffineTransform&) override;
+
+    void beginTransparencyLayer(float) override;
+    void endTransparencyLayer() override;
+
+    void clip(const FloatRect&) override;
+    void clipOut(const FloatRect&) override;
+    void clipOut(const Path&) override;
+    void clipPath(const Path&, WindRule) override;
+    
+    void applyDeviceScaleFactor(float) override;
+
+private:
+    PlatformContextCairo& m_platformContext;
+};
+
+} // namespace WebCore
+
+#endif // USE(CAIRO)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to