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

jamesr at google.com jamesr at google.com
Wed Dec 22 11:36:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8fd22cff5d891806811868e769d55bbe83dc7272
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 30 21:20:03 2010 +0000

    2010-07-30  James Robinson  <jamesr at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [chromium] Make the GLES2 texture map generic and teach ImageSkia and ImageBufferSkia about GLES2
            https://bugs.webkit.org/show_bug.cgi?id=43218
    
            This makes the GLES2Canvas' TextureHashMap key on void* instead of NativeImagePtr
            to make it easier to use with other backends.  It also teaches ImageSkia how
            to draw to a GLES2Canvas instead of a skia buffer.
    
            No change in functionality (yet), no new tests.
    
            * platform/graphics/chromium/GLES2Canvas.cpp:
            (WebCore::GLES2Canvas::GLES2Canvas):
            (WebCore::GLES2Canvas::createTexture):
            (WebCore::GLES2Canvas::getTexture):
            * platform/graphics/chromium/GLES2Canvas.h:
            * platform/graphics/skia/ImageBufferSkia.cpp:
            (WebCore::ImageBuffer::getUnmultipliedImageData):
            (WebCore::ImageBuffer::getPremultipliedImageData):
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::drawBitmapGLES2):
            (WebCore::BitmapImage::draw):
            (WebCore::BitmapImageSingleFrameSkia::draw):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64374 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 23d6041..bc8df97 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-07-30  James Robinson  <jamesr at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [chromium] Make the GLES2 texture map generic and teach ImageSkia and ImageBufferSkia about GLES2
+        https://bugs.webkit.org/show_bug.cgi?id=43218
+
+        This makes the GLES2Canvas' TextureHashMap key on void* instead of NativeImagePtr
+        to make it easier to use with other backends.  It also teaches ImageSkia how
+        to draw to a GLES2Canvas instead of a skia buffer.
+
+        No change in functionality (yet), no new tests.
+
+        * platform/graphics/chromium/GLES2Canvas.cpp:
+        (WebCore::GLES2Canvas::GLES2Canvas):
+        (WebCore::GLES2Canvas::createTexture):
+        (WebCore::GLES2Canvas::getTexture):
+        * platform/graphics/chromium/GLES2Canvas.h:
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::getUnmultipliedImageData):
+        (WebCore::ImageBuffer::getPremultipliedImageData):
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::drawBitmapGLES2):
+        (WebCore::BitmapImage::draw):
+        (WebCore::BitmapImageSingleFrameSkia::draw):
+
 2010-07-30  Yong Li  <yoli at rim.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
index ec188c8..9fc8917 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp
@@ -99,6 +99,10 @@ GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size)
 
     m_stateStack.append(State());
     m_state = &m_stateStack.last();
+
+    // Force the source over composite mode to be applied.
+    m_lastCompositeOp = CompositeClear;
+    applyCompositeOperator(CompositeSourceOver);
 }
 
 GLES2Canvas::~GLES2Canvas()
diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h
index e3a7a3b..4e500be 100644
--- a/WebCore/platform/graphics/chromium/GLES2Canvas.h
+++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h
@@ -42,6 +42,7 @@
 
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index 26c44f2..3eb033d 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -198,11 +198,13 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap,
 
 PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const
 {
+    context()->platformContext()->syncSoftwareCanvas();
     return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size);
 }
 
 PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const
 {
+    context()->platformContext()->syncSoftwareCanvas();
     return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size);
 }
 
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index d1d1692..a2485e6 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -47,6 +47,11 @@
 
 #include "skia/ext/image_operations.h"
 #include "skia/ext/platform_canvas.h"
+#if USE(GLES2_RENDERING)
+#include "GLES2Canvas.h"
+#include "GLES2Context.h"
+#include "SkPixelRef.h"
+#endif
 
 namespace WebCore {
 
@@ -404,6 +409,24 @@ void Image::drawPattern(GraphicsContext* context,
     context->platformContext()->paintSkPaint(destRect, paint);
 }
 
+#if USE(GLES2_RENDERING)
+static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace styleColorSpace, CompositeOperator compositeOp)
+{
+    ctxt->platformContext()->prepareForHardwareDraw();
+    GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas();
+    gpuCanvas->gles2Context()->makeCurrent();
+    GLES2Texture* texture = gpuCanvas->getTexture(bitmap);
+    if (!texture) {
+        ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config);
+        ASSERT(bitmap->rowBytes() == bitmap->width() * 4);
+        texture = gpuCanvas->createTexture(bitmap, GLES2Texture::BGRA8, bitmap->width(), bitmap->height());
+        ASSERT(bitmap->pixelRef());
+        texture->load(bitmap->pixelRef()->pixels());
+    }
+    gpuCanvas->drawTexturedRect(texture, srcRect, dstRect, styleColorSpace, compositeOp);
+}
+#endif
+
 // ================================================
 // BitmapImage Class
 // ================================================
@@ -429,7 +452,7 @@ void BitmapImage::checkForSolidColor()
 }
 
 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
-                       const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
+                       const FloatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp)
 {
     if (!m_source.initialized())
         return;
@@ -439,16 +462,24 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
     // causing flicker and wasting CPU.
     startAnimation();
 
-    const NativeImageSkia* bm = nativeImageForCurrentFrame();
+    NativeImageSkia* bm = nativeImageForCurrentFrame();
     if (!bm)
         return;  // It's too early and we don't have an image yet.
 
+#if  USE(GLES2_RENDERING)
+    if (ctxt->platformContext()->useGPU()) {
+        drawBitmapGLES2(ctxt, bm, srcRect, dstRect, colorSpace, compositeOp);
+        return;
+    }
+#endif
     FloatRect normDstRect = normalizeRect(dstRect);
     FloatRect normSrcRect = normalizeRect(srcRect);
 
     if (normSrcRect.isEmpty() || normDstRect.isEmpty())
         return;  // Nothing to draw.
 
+    ctxt->platformContext()->prepareForSoftwareDraw();
+
     paintSkBitmap(ctxt->platformContext(),
                   *bm,
                   enclosingIntRect(normSrcRect),
@@ -470,6 +501,15 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,
     if (normSrcRect.isEmpty() || normDstRect.isEmpty())
         return;  // Nothing to draw.
 
+#if  USE(GLES2_RENDERING)
+    if (ctxt->platformContext()->useGPU()) {
+        drawBitmapGLES2(ctxt, &m_nativeImage, srcRect, dstRect, styleColorSpace, compositeOp);
+        return;
+    }
+#endif
+
+    ctxt->platformContext()->prepareForSoftwareDraw();
+
     paintSkBitmap(ctxt->platformContext(),
                   m_nativeImage,
                   enclosingIntRect(normSrcRect),

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list