[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

senorblanco at chromium.org senorblanco at chromium.org
Wed Dec 22 11:32:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit af7756d6328babac4e6e66fc520440c853c38edb
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 28 20:21:04 2010 +0000

    2010-07-28  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Hook the GLES2 rendering path up to GraphicsContextSkia.
            https://bugs.webkit.org/show_bug.cgi?id=43119
    
            This connects the state-setting and drawing calls implemented in
            so far in GLES2Canvas, and calls PlatformContextSkia's
            prepareForSoftwareDraw() for all the non-accelerated paths.
    
            * platform/graphics/skia/GraphicsContextSkia.cpp:
            (WebCore::GraphicsContext::addInnerRoundedRectClip):
            (WebCore::GraphicsContext::addPath):
            (WebCore::GraphicsContext::beginPath):
            (WebCore::GraphicsContext::clip):
            (WebCore::GraphicsContext::drawConvexPolygon):
            (WebCore::GraphicsContext::drawEllipse):
            (WebCore::GraphicsContext::drawFocusRing):
            (WebCore::GraphicsContext::drawLine):
            (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar):
            (WebCore::GraphicsContext::drawLineForText):
            (WebCore::GraphicsContext::drawRect):
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::fillRoundedRect):
            (WebCore::GraphicsContext::strokeArc):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::strokeRect):
            These calls are software-only; call preSoftwareDraw() for these.
            (WebCore::GraphicsContext::savePlatformState):
            (WebCore::GraphicsContext::restorePlatformState):
            (WebCore::GraphicsContext::setAlpha):
            (WebCore::GraphicsContext::setCompositeOperation):
            (WebCore::GraphicsContext::setPlatformFillColor):
            (WebCore::GraphicsContext::scale):
            (WebCore::GraphicsContext::rotate):
            (WebCore::GraphicsContext::translate):
            (WebCore::GraphicsContext::concatCTM):
            These ones set state on both Skia and GLES2Canvas.
            (WebCore::GraphicsContext::clearRect):
            (WebCore::GraphicsContext::fillRect):
            These ones have a GLES2 implementation; call through to it if PlatformContextSkia's useGPU() flag is set and the state permits.
            * platform/graphics/skia/PlatformContextSkia.cpp:
            (PlatformContextSkia::prepareForSoftwareDraw):
            (PlatformContextSkia::prepareForHardwareDraw):
            Rename preXXXDraw() -> prepareForXXXDraw().
            * platform/graphics/skia/PlatformContextSkia.h:
            (PlatformContextSkia::prepareForSoftwareDraw):
            (PlatformContextSkia::prepareForHardwareDraw):
            Rename preXXXDraw() -> prepareForXXXDraw().
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64227 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 14e8b81..d5fed82 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,54 @@
+2010-07-28  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Hook the GLES2 rendering path up to GraphicsContextSkia.
+        https://bugs.webkit.org/show_bug.cgi?id=43119
+        
+        This connects the state-setting and drawing calls implemented in
+        so far in GLES2Canvas, and calls PlatformContextSkia's
+        prepareForSoftwareDraw() for all the non-accelerated paths.
+
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::addInnerRoundedRectClip):
+        (WebCore::GraphicsContext::addPath):
+        (WebCore::GraphicsContext::beginPath):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::GraphicsContext::drawFocusRing):
+        (WebCore::GraphicsContext::drawLine):
+        (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar):
+        (WebCore::GraphicsContext::drawLineForText):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::strokeArc):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::strokeRect):
+        These calls are software-only; call preSoftwareDraw() for these.
+        (WebCore::GraphicsContext::savePlatformState):
+        (WebCore::GraphicsContext::restorePlatformState):
+        (WebCore::GraphicsContext::setAlpha):
+        (WebCore::GraphicsContext::setCompositeOperation):
+        (WebCore::GraphicsContext::setPlatformFillColor):
+        (WebCore::GraphicsContext::scale):
+        (WebCore::GraphicsContext::rotate):
+        (WebCore::GraphicsContext::translate):
+        (WebCore::GraphicsContext::concatCTM):
+        These ones set state on both Skia and GLES2Canvas.
+        (WebCore::GraphicsContext::clearRect):
+        (WebCore::GraphicsContext::fillRect):
+        These ones have a GLES2 implementation; call through to it if PlatformContextSkia's useGPU() flag is set and the state permits.
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (PlatformContextSkia::prepareForSoftwareDraw):
+        (PlatformContextSkia::prepareForHardwareDraw):
+        Rename preXXXDraw() -> prepareForXXXDraw().
+        * platform/graphics/skia/PlatformContextSkia.h:
+        (PlatformContextSkia::prepareForSoftwareDraw):
+        (PlatformContextSkia::prepareForHardwareDraw):
+        Rename preXXXDraw() -> prepareForXXXDraw().
+
 2010-07-28  fsamuel at chromium.org  <fsamuel at chromium.org>
 
         Reviewed by David Hyatt.
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 367abde..7994244 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -54,6 +54,10 @@
 #include <wtf/Assertions.h>
 #include <wtf/MathExtras.h>
 
+#if USE(GLES2_RENDERING)
+#include "GLES2Canvas.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -243,6 +247,11 @@ void GraphicsContext::savePlatformState()
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->save();
+#endif
+
     // Save our private State.
     platformContext()->save();
 }
@@ -252,6 +261,11 @@ void GraphicsContext::restorePlatformState()
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->restore();
+#endif
+
     // Restore our private State.
     platformContext()->restore();
 }
@@ -290,6 +304,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
     if (!isRectSkiaSafe(getCTM(), r))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
     SkPath path;
     path.addOval(r, SkPath::kCW_Direction);
     // only perform the inset if we won't invert r
@@ -307,6 +322,7 @@ void GraphicsContext::addPath(const Path& path)
 {
     if (paintingDisabled())
         return;
+    platformContext()->prepareForSoftwareDraw();
     platformContext()->addPath(*path.platformPath());
 }
 
@@ -314,6 +330,7 @@ void GraphicsContext::beginPath()
 {
     if (paintingDisabled())
         return;
+    platformContext()->prepareForSoftwareDraw();
     platformContext()->beginPath();
 }
 
@@ -329,6 +346,16 @@ void GraphicsContext::clearRect(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU()) {
+        platformContext()->prepareForHardwareDraw();
+        platformContext()->gpuCanvas()->clearRect(rect);
+        return;
+    }
+#endif
+
+    platformContext()->prepareForSoftwareDraw();
+
     SkRect r = rect;
     if (!isRectSkiaSafe(getCTM(), r))
         ClipRectToCanvas(*platformContext()->canvas(), r, &r);
@@ -348,6 +375,7 @@ void GraphicsContext::clip(const FloatRect& rect)
     if (!isRectSkiaSafe(getCTM(), r))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
     platformContext()->canvas()->clipRect(r);
 }
 
@@ -360,6 +388,7 @@ void GraphicsContext::clip(const Path& path)
     if (!isPathSkiaSafe(getCTM(), p))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
     platformContext()->clipPathAntiAliased(p);
 }
 
@@ -441,6 +470,12 @@ void GraphicsContext::concatCTM(const AffineTransform& affine)
 {
     if (paintingDisabled())
         return;
+
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->concatCTM(affine);
+#endif
+
     platformContext()->canvas()->concat(affine);
 }
 
@@ -454,6 +489,8 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints,
     if (numPoints <= 1)
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkPath path;
 
     path.incReserve(numPoints);
@@ -499,6 +536,7 @@ void GraphicsContext::drawEllipse(const IntRect& elipseRect)
     if (!isRectSkiaSafe(getCTM(), rect))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     platformContext()->canvas()->drawOval(rect, paint);
@@ -524,6 +562,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width *
     if (!rectCount)
         return;
 
+    platformContext()->prepareForSoftwareDraw();
     SkRegion focusRingRegion;
     const SkScalar focusRingOutset = WebCoreFloatToSkScalar(0.5);
     for (unsigned i = 0; i < rectCount; i++) {
@@ -558,6 +597,8 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
     if (!isPointSkiaSafe(getCTM(), point1) || !isPointSkiaSafe(getCTM(), point2))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     FloatPoint p1 = point1;
     FloatPoint p2 = point2;
     bool isVerticalLine = (p1.x() == p2.x());
@@ -604,6 +645,8 @@ void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint& pt,
     if (paintingDisabled())
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     // Create the pattern we'll use to draw the underline.
     static SkBitmap* misspellBitmap = 0;
     if (!misspellBitmap) {
@@ -684,6 +727,8 @@ void GraphicsContext::drawLineForText(const IntPoint& pt,
     if (width <= 0)
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     int thickness = SkMax32(static_cast<int>(strokeThickness()), 1);
     SkRect r;
     r.fLeft = SkIntToScalar(pt.x());
@@ -704,6 +749,8 @@ void GraphicsContext::drawRect(const IntRect& rect)
     if (paintingDisabled())
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkRect r = rect;
     if (!isRectSkiaSafe(getCTM(), r)) {
         // See the fillRect below.
@@ -722,6 +769,8 @@ void GraphicsContext::fillPath()
     if (!isPathSkiaSafe(getCTM(), path))
       return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     const GraphicsContextState& state = m_common->state;
     path.setFillType(state.fillRule == RULE_EVENODD ?
         SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
@@ -745,6 +794,16 @@ void GraphicsContext::fillRect(const FloatRect& rect)
         ClipRectToCanvas(*platformContext()->canvas(), r, &r);
     }
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient) {
+        platformContext()->prepareForHardwareDraw();
+        platformContext()->gpuCanvas()->fillRect(rect);
+        return;
+    }
+#endif
+
+    platformContext()->prepareForSoftwareDraw();
+
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
     platformContext()->canvas()->drawRect(r, paint);
@@ -757,6 +816,16 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU() && !m_common->state.fillPattern && !m_common->state.fillGradient) {
+        platformContext()->prepareForHardwareDraw();
+        platformContext()->gpuCanvas()->fillRect(rect, color, colorSpace);
+        return;
+    }
+#endif
+
+    platformContext()->prepareForSoftwareDraw();
+
     SkRect r = rect;
     if (!isRectSkiaSafe(getCTM(), r)) {
         // Special case when the rectangle overflows fixed point. This is a
@@ -789,6 +858,8 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect,
     if (paintingDisabled())
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkRect r = rect;
     if (!isRectSkiaSafe(getCTM(), r))
         // See fillRect().
@@ -872,6 +943,12 @@ void GraphicsContext::scale(const FloatSize& size)
 {
     if (paintingDisabled())
         return;
+
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->scale(size);
+#endif
+
     platformContext()->canvas()->scale(WebCoreFloatToSkScalar(size.width()),
         WebCoreFloatToSkScalar(size.height()));
 }
@@ -880,6 +957,10 @@ void GraphicsContext::setAlpha(float alpha)
 {
     if (paintingDisabled())
         return;
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->setAlpha(alpha);
+#endif
     platformContext()->setAlpha(alpha);
 }
 
@@ -887,6 +968,10 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op)
 {
     if (paintingDisabled())
         return;
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->setCompositeOperation(op);
+#endif
     platformContext()->setXfermodeMode(WebCoreCompositeToSkiaComposite(op));
 }
 
@@ -973,6 +1058,11 @@ void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorS
 {
     if (paintingDisabled())
         return;
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->setFillColor(color, colorSpace);
+#endif
+
     platformContext()->setFillColor(color.rgb());
 }
 
@@ -1102,6 +1192,8 @@ void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan)
     if (paintingDisabled())
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkPaint paint;
     SkRect oval = r;
     if (strokeStyle() == NoStroke) {
@@ -1133,6 +1225,8 @@ void GraphicsContext::strokePath()
     if (!isPathSkiaSafe(getCTM(), path))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkPaint paint;
     platformContext()->setupPaintForStroking(&paint, 0, 0);
     platformContext()->canvas()->drawPath(path, paint);
@@ -1146,6 +1240,8 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
     if (!isRectSkiaSafe(getCTM(), rect))
         return;
 
+    platformContext()->prepareForSoftwareDraw();
+
     SkPaint paint;
     platformContext()->setupPaintForStroking(&paint, 0, 0);
     paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));
@@ -1157,6 +1253,11 @@ void GraphicsContext::rotate(float angleInRadians)
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->rotate(angleInRadians);
+#endif
+
     platformContext()->canvas()->rotate(WebCoreFloatToSkScalar(
         angleInRadians * (180.0f / 3.14159265f)));
 }
@@ -1166,6 +1267,11 @@ void GraphicsContext::translate(float w, float h)
     if (paintingDisabled())
         return;
 
+#if USE(GLES2_RENDERING)
+    if (platformContext()->useGPU())
+        platformContext()->gpuCanvas()->translate(w, h);
+#endif
+
     platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w),
                                            WebCoreFloatToSkScalar(h));
 }
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index 392d505..65c6e95 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -682,7 +682,7 @@ void PlatformContextSkia::setGLES2Context(WebCore::GLES2Context* context, const
     m_gpuCanvas = new WebCore::GLES2Canvas(context, size);
 }
 
-void PlatformContextSkia::preSoftwareDraw() const
+void PlatformContextSkia::prepareForSoftwareDraw() const
 {
     if (!m_useGPU)
         return;
@@ -724,7 +724,7 @@ void PlatformContextSkia::preSoftwareDraw() const
     }
 }
 
-void PlatformContextSkia::preHardwareDraw() const
+void PlatformContextSkia::prepareForHardwareDraw() const
 {
     if (!m_useGPU)
         return;
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h
index 1b4e79c..2099dd0 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -191,13 +191,13 @@ public:
 #if USE(GLES2_RENDERING)
     // Call these before making a call that manipulates the underlying
     // skia::PlatformCanvas or WebCore::GLES2Canvas
-    void preSoftwareDraw() const;
-    void preHardwareDraw() const;
+    void prepareForSoftwareDraw() const;
+    void prepareForHardwareDraw() const;
     // Call to force the skia::PlatformCanvas to contain all rendering results.
     void syncSoftwareCanvas() const;
 #else
-    void preSoftwareDraw() const {}
-    void preHardwareDraw() const {}
+    void prepareForSoftwareDraw() const {}
+    void prepareForHardwareDraw() const {}
     void syncSoftwareCanvas() const {}
 #endif
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list