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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:44:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 659fc76b5146186e4fee91483ba93b3559233214
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 28 03:01:32 2010 +0000

    2010-08-27  Vincent Scheib  <scheib at chromium.org>
    
            Reviewed by Darin Fisher.
    
            CanvasRenderingContext2D::willDraw changed to didDraw
    
            Solves issue with canvas to canvas draw calls, and simplifies
            mixed software and GPU acceleration of GraphicsContext implementations
            which must track dirty rects for backing stores.
    
            https://bugs.webkit.org/show_bug.cgi?id=44741
    
            * html/HTMLCanvasElement.cpp:
            (WebCore::HTMLCanvasElement::didDraw):
            * html/HTMLCanvasElement.h:
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::fill):
            (WebCore::CanvasRenderingContext2D::stroke):
            (WebCore::CanvasRenderingContext2D::clearRect):
            (WebCore::CanvasRenderingContext2D::fillRect):
            (WebCore::CanvasRenderingContext2D::strokeRect):
            (WebCore::CanvasRenderingContext2D::drawImage):
            (WebCore::CanvasRenderingContext2D::drawImageFromRect):
            (WebCore::CanvasRenderingContext2D::didDraw):
            (WebCore::CanvasRenderingContext2D::putImageData):
            (WebCore::CanvasRenderingContext2D::drawTextInternal):
            * html/canvas/CanvasRenderingContext2D.h:
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::markContextChanged):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66295 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 372c00c..e8fd5ee 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-08-27  Vincent Scheib  <scheib at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        CanvasRenderingContext2D::willDraw changed to didDraw
+
+        Solves issue with canvas to canvas draw calls, and simplifies
+        mixed software and GPU acceleration of GraphicsContext implementations
+        which must track dirty rects for backing stores.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44741
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::didDraw):
+        * html/HTMLCanvasElement.h:
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::fill):
+        (WebCore::CanvasRenderingContext2D::stroke):
+        (WebCore::CanvasRenderingContext2D::clearRect):
+        (WebCore::CanvasRenderingContext2D::fillRect):
+        (WebCore::CanvasRenderingContext2D::strokeRect):
+        (WebCore::CanvasRenderingContext2D::drawImage):
+        (WebCore::CanvasRenderingContext2D::drawImageFromRect):
+        (WebCore::CanvasRenderingContext2D::didDraw):
+        (WebCore::CanvasRenderingContext2D::putImageData):
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+        * html/canvas/CanvasRenderingContext2D.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::markContextChanged):
+
 2010-08-27  Daniel Cheng  <dcheng at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index ea7479d..3838f14 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -185,7 +185,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas
     return 0;
 }
 
-void HTMLCanvasElement::willDraw(const FloatRect& rect)
+void HTMLCanvasElement::didDraw(const FloatRect& rect)
 {
     m_copiedImage.clear(); // Clear our image snapshot if we have one.
 
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index feef9d0..172ffbd 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -85,7 +85,7 @@ public:
     String toDataURL(const String& mimeType, ExceptionCode& ec) { return toDataURL(mimeType, 0, ec); }
 
     // Used for rendering
-    void willDraw(const FloatRect&);
+    void didDraw(const FloatRect&);
 
     void paint(GraphicsContext*, const IntRect&);
 
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 2a7b96a..6df6abf 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -804,8 +804,8 @@ void CanvasRenderingContext2D::fill()
     if (!m_path.isEmpty()) {
         c->beginPath();
         c->addPath(m_path);
-        willDraw(m_path.boundingRect());
         c->fillPath();
+        didDraw(m_path.boundingRect());
     }
 
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -835,9 +835,8 @@ void CanvasRenderingContext2D::stroke()
         CanvasStrokeStyleApplier strokeApplier(this);
         FloatRect boundingRect = m_path.strokeBoundingRect(&strokeApplier);
 #endif
-        willDraw(boundingRect);
-
         c->strokePath();
+        didDraw(boundingRect);
     }
 
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -885,8 +884,8 @@ void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
 
     save();
     setAllAttributesToDefault();
-    willDraw(rect);
     context->clearRect(rect);
+    didDraw(rect);
     restore();
 }
 
@@ -909,9 +908,9 @@ void CanvasRenderingContext2D::fillRect(float x, float y, float width, float hei
         return;
 
     FloatRect rect(x, y, width, height);
-    willDraw(rect);
 
     c->fillRect(rect);
+    didDraw(rect);
 }
 
 void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float height)
@@ -939,9 +938,9 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
 
     FloatRect boundingRect = rect;
     boundingRect.inflate(lineWidth / 2);
-    willDraw(boundingRect);
 
     c->strokeRect(rect, lineWidth);
+    didDraw(boundingRect);
 }
 
 #if PLATFORM(CG)
@@ -1198,8 +1197,8 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
 
     FloatRect sourceRect = c->roundToDevicePixels(srcRect);
     FloatRect destRect = c->roundToDevicePixels(dstRect);
-    willDraw(destRect);
     c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
+    didDraw(destRect);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y, ExceptionCode& ec)
@@ -1273,8 +1272,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
     sourceCanvas->makeRenderingResultsAvailable();
 
     c->drawImageBuffer(buffer, DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
-    willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty.
-                        // FIXME: Arguably willDraw should become didDraw and occur after drawing calls and not before them to avoid problems like this.
+    didDraw(destRect);
 }
 
 #if ENABLE(VIDEO)
@@ -1342,7 +1340,6 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
 
     FloatRect sourceRect = c->roundToDevicePixels(srcRect);
     FloatRect destRect = c->roundToDevicePixels(dstRect);
-    willDraw(destRect);
 
     c->save();
     c->clip(destRect);
@@ -1351,6 +1348,7 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
     c->translate(-sourceRect.x(), -sourceRect.y());
     video->paintCurrentFrameInContext(c, IntRect(IntPoint(), size(video)));
     c->restore();
+    didDraw(destRect);
 }
 #endif
 
@@ -1384,8 +1382,8 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
         op = CompositeSourceOver;
 
     FloatRect destRect = FloatRect(dx, dy, dw, dh);
-    willDraw(destRect);
     c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, FloatRect(sx, sy, sw, sh), op);
+    didDraw(destRect);
 }
 
 void CanvasRenderingContext2D::setAlpha(float alpha)
@@ -1475,7 +1473,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem
     return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas->originClean());
 }
 
-void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options)
+void CanvasRenderingContext2D::didDraw(const FloatRect& r, unsigned options)
 {
     GraphicsContext* c = drawingContext();
     if (!c)
@@ -1510,7 +1508,7 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options)
         renderBox->layer()->rendererContentChanged();
     else
 #endif
-        canvas()->willDraw(dirtyRect);
+        canvas()->didDraw(dirtyRect);
 }
 
 GraphicsContext* CanvasRenderingContext2D::drawingContext() const
@@ -1628,11 +1626,11 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
     sourceRect.intersect(IntRect(IntPoint(), buffer->size()));
     if (sourceRect.isEmpty())
         return;
-    willDraw(sourceRect, 0); // ignore transform, shadow and clip
     sourceRect.move(-destOffset);
     IntPoint destPoint(destOffset.width(), destOffset.height());
 
     buffer->putUnmultipliedImageData(data, sourceRect, destPoint);
+    didDraw(sourceRect, 0); // ignore transform, shadow and clip
 }
 
 String CanvasRenderingContext2D::font() const
@@ -1809,14 +1807,6 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
     if (!fill)
         textRect.inflate(c->strokeThickness() / 2);
 
-    if (fill)
-        canvas()->willDraw(textRect);
-    else {
-        // When stroking text, pointy miters can extend outside of textRect, so we
-        // punt and dirty the whole canvas.
-        canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height()));
-    }
-
 #if PLATFORM(CG)
     CanvasStyle* drawStyle = fill ? state().m_fillStyle.get() : state().m_strokeStyle.get();
     if (drawStyle->canvasGradient() || drawStyle->canvasPattern()) {
@@ -1859,6 +1849,14 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
 
     c->drawBidiText(font, textRun, location);
 
+    if (fill)
+        canvas()->didDraw(textRect);
+    else {
+        // When stroking text, pointy miters can extend outside of textRect, so we
+        // punt and dirty the whole canvas.
+        canvas()->didDraw(FloatRect(0, 0, canvas()->width(), canvas()->height()));
+    }
+
 #if PLATFORM(QT)
     Font::setCodePath(oldCodePath);
 #endif
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index f610250..9857344 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -269,7 +269,7 @@ private:
         CanvasWillDrawApplyAll = 0xffffffff
     };
 
-    void willDraw(const FloatRect&, unsigned options = CanvasWillDrawApplyAll);
+    void didDraw(const FloatRect&, unsigned options = CanvasWillDrawApplyAll);
 
     GraphicsContext* drawingContext() const;
 
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index e812068..a37a894 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -153,7 +153,7 @@ void WebGLRenderingContext::markContextChanged()
     else {
 #endif
         if (!m_markedCanvasDirty)
-            canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height()));
+            canvas()->didDraw(FloatRect(0, 0, canvas()->width(), canvas()->height()));
 #if USE(ACCELERATED_COMPOSITING)
     }
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list