[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 15:17:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e60894e4c9b377b81d13c04b3b5b1fc47b3dadca
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 29 20:49:44 2010 +0000

    2010-10-29  Aaron Colwell  <acolwell at chromium.org>
    
            Reviewed by James Robinson.
    
            Added a layout test for verifying that globalAlpha is properly handled
            when copying a video frame to a 2D canvas context.
            https://bugs.webkit.org/show_bug.cgi?id=48094
    
            * media/video-canvas-alpha-expected.txt: Added.
            * media/video-canvas-alpha.html: Added.
            * platform/chromium-mac/media/video-canvas-alpha-expected.checksum: Added.
            * platform/chromium-mac/media/video-canvas-alpha-expected.png: Added.
            * platform/chromium-win/media/video-canvas-alpha-expected.checksum: Added.
            * platform/chromium-win/media/video-canvas-alpha-expected.png: Added.
    2010-10-29  Aaron Colwell  <acolwell at chromium.org>
    
            Reviewed by James Robinson.
    
            Created helper method WebCore::PlatformContextSkia::getNormalizedAlpha()
            to centralize alpha rounding & clipping logic.
            https://bugs.webkit.org/show_bug.cgi?id=48094
    
            Test: media/video-canvas-alpha.html
    
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::paintSkBitmap):
            * platform/graphics/skia/PlatformContextSkia.cpp:
            (WebCore::PlatformContextSkia::getNormalizedAlpha):
            * platform/graphics/skia/PlatformContextSkia.h:
    2010-10-29  Aaron Colwell  <acolwell at chromium.org>
    
            Reviewed by James Robinson.
    
            Fix globalAlpha support when using drawImage() to copy a video frame
            to a 2D canvas context.
            https://bugs.webkit.org/show_bug.cgi?id=48094
    
            This fix applies the globalAlpha value to the canvas before passing it
            down to the lower layers that don't have access to the graphics
            context. This makes sure that any drawing on the canvas will have the
            proper global alpha value applied.
    
            * src/WebMediaPlayerClientImpl.cpp:
            (WebKit::WebMediaPlayerClientImpl::paint):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70919 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5848219..8a86897 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-29  Aaron Colwell  <acolwell at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Added a layout test for verifying that globalAlpha is properly handled
+        when copying a video frame to a 2D canvas context.
+        https://bugs.webkit.org/show_bug.cgi?id=48094
+
+        * media/video-canvas-alpha-expected.txt: Added.
+        * media/video-canvas-alpha.html: Added.
+        * platform/chromium-mac/media/video-canvas-alpha-expected.checksum: Added.
+        * platform/chromium-mac/media/video-canvas-alpha-expected.png: Added.
+        * platform/chromium-win/media/video-canvas-alpha-expected.checksum: Added.
+        * platform/chromium-win/media/video-canvas-alpha-expected.png: Added.
+
 2010-10-29  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/LayoutTests/media/video-canvas-alpha-expected.txt b/LayoutTests/media/video-canvas-alpha-expected.txt
new file mode 100644
index 0000000..ff80dd0
--- /dev/null
+++ b/LayoutTests/media/video-canvas-alpha-expected.txt
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 320x240
+  RenderVideo {VIDEO} at (0,0) size 320x240
+layer at (228,8) size 320x240
+  RenderHTMLCanvas {CANVAS} at (320,0) size 320x240
diff --git a/LayoutTests/media/video-canvas-alpha.html b/LayoutTests/media/video-canvas-alpha.html
new file mode 100644
index 0000000..9001ae1
--- /dev/null
+++ b/LayoutTests/media/video-canvas-alpha.html
@@ -0,0 +1,32 @@
+<html>
+ <head>
+  <script src="media-file.js"></script>
+
+  <script>
+    if (window.layoutTestController) {
+      layoutTestController.waitUntilDone();
+    }
+
+    function onLoad() {
+      video = document.getElementsByTagName('video')[0];
+      video.src = findMediaFile("video", "content/test");
+    
+      canvas = document.getElementsByTagName('canvas')[0];
+      ctx = canvas.getContext('2d');
+
+      video.load();
+      video.addEventListener("canplay", function (e) {
+        ctx.globalAlpha = 0.5;
+        ctx.drawImage(video, 0, 0);
+
+        if (window.layoutTestController) {
+          layoutTestController.notifyDone();
+        }
+      }); 
+    }
+  </script>
+ </head>
+ <body onload="onLoad();">
+   <video></video><canvas width="320px" height="240px" style="position:relative;left:-100px;"> </canvas>
+ </body>
+</html>
diff --git a/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.checksum b/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.checksum
new file mode 100644
index 0000000..cd5734d
--- /dev/null
+++ b/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.checksum
@@ -0,0 +1 @@
+9f1b403f773c34cc23a977601b5a5590
\ No newline at end of file
diff --git a/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.png b/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.png
new file mode 100644
index 0000000..1542b6d
Binary files /dev/null and b/LayoutTests/platform/chromium-mac/media/video-canvas-alpha-expected.png differ
diff --git a/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.checksum b/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.checksum
new file mode 100644
index 0000000..2f3592c
--- /dev/null
+++ b/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.checksum
@@ -0,0 +1 @@
+608387ef6a45c66000e97d7cdbf1eb8b
\ No newline at end of file
diff --git a/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.png b/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.png
new file mode 100644
index 0000000..1542b6d
Binary files /dev/null and b/LayoutTests/platform/chromium-win/media/video-canvas-alpha-expected.png differ
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f3e093d..03d8d09 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-29  Aaron Colwell  <acolwell at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Created helper method WebCore::PlatformContextSkia::getNormalizedAlpha()
+        to centralize alpha rounding & clipping logic. 
+        https://bugs.webkit.org/show_bug.cgi?id=48094
+
+        Test: media/video-canvas-alpha.html
+
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::paintSkBitmap):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::getNormalizedAlpha):
+        * platform/graphics/skia/PlatformContextSkia.h:
+
 2010-10-29  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index 23e7be6..ae2653a 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -236,12 +236,7 @@ static void paintSkBitmap(PlatformContextSkia* platformContext, const NativeImag
     SkPaint paint;
     paint.setXfermodeMode(compOp);
     paint.setFilterBitmap(true);
-    int alpha = roundf(platformContext->getAlpha() * 256);
-    if (alpha > 255)
-        alpha = 255;
-    else if (alpha < 0)
-        alpha = 0;
-    paint.setAlpha(alpha);
+    paint.setAlpha(platformContext->getNormalizedAlpha());
 
     skia::PlatformCanvas* canvas = platformContext->canvas();
 
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index 3f9e4c1..6204597 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -510,6 +510,16 @@ float PlatformContextSkia::getAlpha() const
     return m_state->m_alpha;
 }
 
+int PlatformContextSkia::getNormalizedAlpha() const
+{
+    int alpha = roundf(m_state->m_alpha * 256);
+    if (alpha > 255)
+        alpha = 255;
+    else if (alpha < 0)
+        alpha = 0;
+    return alpha;
+}
+
 void PlatformContextSkia::setTextDrawingMode(int mode)
 {
     // cTextClip is never used, so we assert that it isn't set:
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h
index 84e5d78..110085d 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -134,6 +134,7 @@ public:
     float getStrokeThickness() const;
     int getTextDrawingMode() const;
     float getAlpha() const;
+    int getNormalizedAlpha() const;
 
     void beginPath();
     void addPath(const SkPath&);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 64fd3c6..f9b6ea6 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-29  Aaron Colwell  <acolwell at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Fix globalAlpha support when using drawImage() to copy a video frame
+        to a 2D canvas context.
+        https://bugs.webkit.org/show_bug.cgi?id=48094
+
+        This fix applies the globalAlpha value to the canvas before passing it
+        down to the lower layers that don't have access to the graphics
+        context. This makes sure that any drawing on the canvas will have the
+        proper global alpha value applied.
+
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::paint):
+
 2010-10-29  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 45a6df3..65f0fde 100644
--- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -402,7 +402,14 @@ void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
     // check.
     if (m_webMediaPlayer.get() && !context->paintingDisabled()) {
 #if WEBKIT_USING_SKIA
-        m_webMediaPlayer->paint(context->platformContext()->canvas(), rect);
+        PlatformGraphicsContext* platformContext = context->platformContext();
+        WebCanvas* canvas = platformContext->canvas();
+
+        canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha());
+
+        m_webMediaPlayer->paint(canvas, rect);
+
+        canvas->restore();
 #elif WEBKIT_USING_CG
         m_webMediaPlayer->paint(context->platformContext(), rect);
 #else

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list