[BlackBerry] Accelerated compositing updates
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 17:43:05 +0000 (17:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 17:43:05 +0000 (17:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82058

Patch by Filip Spacek <fspacek@rim.com> on 2012-03-26
Reviewed by Rob Buis.

* platform/graphics/blackberry/CanvasLayerWebKitThread.cpp:
(WebCore::CanvasLayerWebKitThread::CanvasLayerWebKitThread):
(WebCore::CanvasLayerWebKitThread::~CanvasLayerWebKitThread):
(WebCore::CanvasLayerWebKitThread::setDevice):
(WebCore::CanvasLayerWebKitThread::updateTextureContentsIfNeeded):
* platform/graphics/blackberry/CanvasLayerWebKitThread.h:
(WebCore::CanvasLayerWebKitThread::create):
(CanvasLayerWebKitThread):
* platform/graphics/blackberry/InstrumentedPlatformCanvas.h:
(WebCore::InstrumentedPlatformCanvas::InstrumentedPlatformCanvas):
(WebCore::InstrumentedPlatformCanvas::save):
(WebCore::InstrumentedPlatformCanvas::saveLayer):
(WebCore::InstrumentedPlatformCanvas::restore):
(WebCore::InstrumentedPlatformCanvas::translate):
(WebCore::InstrumentedPlatformCanvas::scale):
(WebCore::InstrumentedPlatformCanvas::rotate):
(WebCore::InstrumentedPlatformCanvas::skew):
(WebCore::InstrumentedPlatformCanvas::concat):
(WebCore::InstrumentedPlatformCanvas::setMatrix):
(WebCore::InstrumentedPlatformCanvas::clipRect):
(WebCore::InstrumentedPlatformCanvas::clipPath):
(WebCore::InstrumentedPlatformCanvas::clipRegion):
(WebCore::InstrumentedPlatformCanvas::clear):
(WebCore::InstrumentedPlatformCanvas::drawPaint):
(WebCore::InstrumentedPlatformCanvas::drawPoints):
(WebCore::InstrumentedPlatformCanvas::drawRect):
(WebCore::InstrumentedPlatformCanvas::drawPath):
(WebCore::InstrumentedPlatformCanvas::drawBitmap):
(WebCore::InstrumentedPlatformCanvas::drawBitmapRect):
(WebCore::InstrumentedPlatformCanvas::drawBitmapMatrix):
(WebCore::InstrumentedPlatformCanvas::drawSprite):
(WebCore::InstrumentedPlatformCanvas::drawText):
(WebCore::InstrumentedPlatformCanvas::drawPosText):
(WebCore::InstrumentedPlatformCanvas::drawPosTextH):
(WebCore::InstrumentedPlatformCanvas::drawTextOnPath):
(WebCore::InstrumentedPlatformCanvas::drawPicture):
(WebCore::InstrumentedPlatformCanvas::drawVertices):
(WebCore::InstrumentedPlatformCanvas::drawData):
* platform/graphics/blackberry/LayerData.h:
(WebCore::LayerData::LayerData):
(WebCore::LayerData::needsTexture):
(LayerData):
* platform/graphics/blackberry/LayerTiler.cpp:
(WebCore::LayerTiler::updateTextureContentsIfNeeded):
* platform/graphics/blackberry/LayerWebKitThread.cpp:
(WebCore::LayerWebKitThread::paintContents):
(WebCore::LayerWebKitThread::setDrawable):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::loadBufferingImageData):
* platform/graphics/blackberry/skia/ImageBufferDataSkia.h: Renamed from Source/WebCore/platform/graphics/blackberry/skia/ImageBufferData.h.
(WebCore):
(ImageBufferData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112124 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/blackberry/CanvasLayerWebKitThread.cpp
Source/WebCore/platform/graphics/blackberry/CanvasLayerWebKitThread.h
Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp
Source/WebCore/platform/graphics/blackberry/InstrumentedPlatformCanvas.h
Source/WebCore/platform/graphics/blackberry/LayerData.h
Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp
Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
Source/WebCore/platform/graphics/blackberry/skia/ImageBufferDataSkia.h [moved from Source/WebCore/platform/graphics/blackberry/skia/ImageBufferData.h with 88% similarity]

index 9720149..9891d4e 100644 (file)
@@ -1,3 +1,63 @@
+2012-03-26  Filip Spacek  <fspacek@rim.com>
+
+        [BlackBerry] Accelerated compositing updates
+        https://bugs.webkit.org/show_bug.cgi?id=82058
+
+        Reviewed by Rob Buis.
+
+        * platform/graphics/blackberry/CanvasLayerWebKitThread.cpp:
+        (WebCore::CanvasLayerWebKitThread::CanvasLayerWebKitThread):
+        (WebCore::CanvasLayerWebKitThread::~CanvasLayerWebKitThread):
+        (WebCore::CanvasLayerWebKitThread::setDevice):
+        (WebCore::CanvasLayerWebKitThread::updateTextureContentsIfNeeded):
+        * platform/graphics/blackberry/CanvasLayerWebKitThread.h:
+        (WebCore::CanvasLayerWebKitThread::create):
+        (CanvasLayerWebKitThread):
+        * platform/graphics/blackberry/InstrumentedPlatformCanvas.h:
+        (WebCore::InstrumentedPlatformCanvas::InstrumentedPlatformCanvas):
+        (WebCore::InstrumentedPlatformCanvas::save):
+        (WebCore::InstrumentedPlatformCanvas::saveLayer):
+        (WebCore::InstrumentedPlatformCanvas::restore):
+        (WebCore::InstrumentedPlatformCanvas::translate):
+        (WebCore::InstrumentedPlatformCanvas::scale):
+        (WebCore::InstrumentedPlatformCanvas::rotate):
+        (WebCore::InstrumentedPlatformCanvas::skew):
+        (WebCore::InstrumentedPlatformCanvas::concat):
+        (WebCore::InstrumentedPlatformCanvas::setMatrix):
+        (WebCore::InstrumentedPlatformCanvas::clipRect):
+        (WebCore::InstrumentedPlatformCanvas::clipPath):
+        (WebCore::InstrumentedPlatformCanvas::clipRegion):
+        (WebCore::InstrumentedPlatformCanvas::clear):
+        (WebCore::InstrumentedPlatformCanvas::drawPaint):
+        (WebCore::InstrumentedPlatformCanvas::drawPoints):
+        (WebCore::InstrumentedPlatformCanvas::drawRect):
+        (WebCore::InstrumentedPlatformCanvas::drawPath):
+        (WebCore::InstrumentedPlatformCanvas::drawBitmap):
+        (WebCore::InstrumentedPlatformCanvas::drawBitmapRect):
+        (WebCore::InstrumentedPlatformCanvas::drawBitmapMatrix):
+        (WebCore::InstrumentedPlatformCanvas::drawSprite):
+        (WebCore::InstrumentedPlatformCanvas::drawText):
+        (WebCore::InstrumentedPlatformCanvas::drawPosText):
+        (WebCore::InstrumentedPlatformCanvas::drawPosTextH):
+        (WebCore::InstrumentedPlatformCanvas::drawTextOnPath):
+        (WebCore::InstrumentedPlatformCanvas::drawPicture):
+        (WebCore::InstrumentedPlatformCanvas::drawVertices):
+        (WebCore::InstrumentedPlatformCanvas::drawData):
+        * platform/graphics/blackberry/LayerData.h:
+        (WebCore::LayerData::LayerData):
+        (WebCore::LayerData::needsTexture):
+        (LayerData):
+        * platform/graphics/blackberry/LayerTiler.cpp:
+        (WebCore::LayerTiler::updateTextureContentsIfNeeded):
+        * platform/graphics/blackberry/LayerWebKitThread.cpp:
+        (WebCore::LayerWebKitThread::paintContents):
+        (WebCore::LayerWebKitThread::setDrawable):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+        (WebCore::loadBufferingImageData):
+        * platform/graphics/blackberry/skia/ImageBufferDataSkia.h: Renamed from Source/WebCore/platform/graphics/blackberry/skia/ImageBufferData.h.
+        (WebCore):
+        (ImageBufferData):
+
 2012-03-26  Stephen Chenney  <schenney@chromium.org>
 
         Failure to invalidate text position attributes when DOM changes
index 4d20326..5f6a489 100644 (file)
 #include "config.h"
 #include "CanvasLayerWebKitThread.h"
 
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(SKIA_GPU_CANVAS)
+#if USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
 
-#include "HTMLCanvasElement.h"
-#include "PlatformContextSkia.h"
-
-#include <BlackBerryPlatformGraphics.h>
+#include "SharedGraphicsContext3D.h"
 #include <GLES2/gl2.h>
-#include <GrGLTexture.h>
 #include <SkGpuDevice.h>
 
 namespace WebCore {
 
-CanvasLayerWebKitThread::CanvasLayerWebKitThread(HTMLCanvasElement* canvas)
-    : LayerWebKitThread(Layer, 0)
+CanvasLayerWebKitThread::CanvasLayerWebKitThread(SkGpuDevice* device)
+    : LayerWebKitThread(CanvasLayer, 0)
 {
-    setCanvas(canvas);
+    setDevice(device);
 }
 
 CanvasLayerWebKitThread::~CanvasLayerWebKitThread()
 {
     if (m_texID) {
-        BlackBerry::Platform::Graphics::makeSharedResourceContextCurrent(BlackBerry::Platform::Graphics::GLES2);
+        SharedGraphicsContext3D::get()->makeContextCurrent();
         glDeleteTextures(1, &m_texID);
     }
 }
 
-void CanvasLayerWebKitThread::setCanvas(HTMLCanvasElement* canvas)
+void CanvasLayerWebKitThread::setDevice(SkGpuDevice* device)
 {
-    m_canvas = canvas;
-    setNeedsTexture(isDrawable() && canvas);
+    m_device = device;
     setLayerProgramShader(LayerProgramShaderRGBA);
     setNeedsDisplay();
 }
@@ -61,21 +56,11 @@ void CanvasLayerWebKitThread::setNeedsDisplay()
 
 void CanvasLayerWebKitThread::updateTextureContentsIfNeeded()
 {
-    if (!m_needsDisplay)
+    if (!m_needsDisplay || !m_device)
         return;
 
     m_needsDisplay = false;
-
-    if (!m_canvas || !m_canvas->drawingContext())
-        return;
-
-    SkGpuDevice* gpuDevice = static_cast<SkGpuDevice*>(m_canvas->drawingContext()->platformContext()->canvas()->getDevice());
-    gpuDevice->makeRenderTargetCurrent();
-    // We know this is a GrGLTexture
-    if (GrGLTexture* deviceTexture = (GrGLTexture*)gpuDevice->accessTexture()) {
-        m_texWidth = deviceTexture->allocWidth();
-        m_texHeight = deviceTexture->allocHeight();
-    }
+    m_device->makeRenderTargetCurrent();
 
     GLint previousTexture;
     glGetIntegerv(GL_TEXTURE_BINDING_2D, &previousTexture);
@@ -87,18 +72,18 @@ void CanvasLayerWebKitThread::updateTextureContentsIfNeeded()
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_canvas->width(), m_canvas->height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_device->width(), m_device->height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
 
         createFrontBufferLock();
     }
 
     pthread_mutex_lock(m_frontBufferLock);
     glBindTexture(GL_TEXTURE_2D, m_texID);
-    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, m_texWidth, m_texHeight, 0);
+    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, m_device->width(), m_device->height(), 0);
     glBindTexture(GL_TEXTURE_2D, previousTexture);
     pthread_mutex_unlock(m_frontBufferLock);
 }
 
 }
 
-#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(SKIA_GPU_CANVAS)
+#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
index 9a731ce..eac6b82 100644 (file)
 #ifndef CanvasLayerWebKitThread_h
 #define CanvasLayerWebKitThread_h
 
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(SKIA_GPU_CANVAS)
+#if USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
 
 #include "LayerWebKitThread.h"
 
+class SkGpuDevice;
+
 namespace WebCore {
 
 class HTMLCanvasElement;
 
 class CanvasLayerWebKitThread : public LayerWebKitThread {
 public:
-    static PassRefPtr<CanvasLayerWebKitThread> create(HTMLCanvasElement* canvas)
+    static PassRefPtr<CanvasLayerWebKitThread> create(SkGpuDevice* device)
     {
-        return adoptRef(new CanvasLayerWebKitThread(canvas));
+        return adoptRef(new CanvasLayerWebKitThread(device));
     }
 
     virtual ~CanvasLayerWebKitThread();
 
-    void setCanvas(HTMLCanvasElement*);
+    void setDevice(SkGpuDevice*);
 
     virtual void setNeedsDisplay();
 
@@ -44,12 +46,13 @@ protected:
     virtual void updateTextureContentsIfNeeded();
 
 private:
-    CanvasLayerWebKitThread(HTMLCanvasElement*);
+    CanvasLayerWebKitThread(SkGpuDevice*);
     bool m_needsDisplay;
+    SkGpuDevice* m_device;
 };
 
 }
 
-#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(SKIA_GPU_CANVAS)
+#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
 
 #endif // CanvasLayerWebKitThread_h
index 56a585e..d3f008e 100644 (file)
@@ -187,15 +187,16 @@ void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imag
 
     canvasBitmap.setConfig(SkBitmap::kARGB_8888_Config, canvasWidth, canvasHeight);
     canvasBitmap.allocPixels(0, 0);
-    bool rc = canvasBitmap.copyPixelsFrom(static_cast<void*>(const_cast<unsigned char*>(tempPixels)), imageWidth * imageHeight * 4);
+    canvasBitmap.lockPixels();
+    memcpy(canvasBitmap.getPixels(), tempPixels, imageWidth * imageHeight * 4);
+    canvasBitmap.unlockPixels();
     delete [] tempPixels;
 
     FloatRect src(0, 0, canvasWidth, canvasHeight);
     FloatRect dst(0, 0, imageWidth, imageHeight);
 
     RefPtr<BitmapImageSingleFrameSkia> bitmapImage = BitmapImageSingleFrameSkia::create(canvasBitmap, false);
-    if (rc)
-        context->drawImage(bitmapImage.get(), ColorSpaceDeviceRGB, dst, src, CompositeCopy, false);
+    context->drawImage(bitmapImage.get(), ColorSpaceDeviceRGB, dst, src, CompositeCopy, false);
 }
 
 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
index 1629ff1..780bc01 100644 (file)
 
 namespace WebCore {
 
-class InstrumentedPlatformCanvas : public skia::PlatformCanvas {
+class InstrumentedPlatformCanvas : public SkCanvas {
 public:
-    InstrumentedPlatformCanvas(int width, int height, bool is_opaque, SkDeviceFactory* factory)
-        : skia::PlatformCanvas(width, height, is_opaque, factory)
-        , m_size(width, height)
+    InstrumentedPlatformCanvas(int width, int height)
+        : m_size(width, height)
         , m_isSolidColor(true)
         , m_solidColor(0, 0, 0, 0)
     {
+        setDevice(new SkDevice(SkBitmap::kARGB_8888_Config, width, height))->unref();
     }
 
     virtual ~InstrumentedPlatformCanvas() { }
@@ -53,76 +53,76 @@ public:
     virtual int save(SaveFlags flags)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::save(flags);
+        return SkCanvas::save(flags);
     }
 
     virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        return skia::PlatformCanvas::saveLayer(bounds, paint, flags);
+        return SkCanvas::saveLayer(bounds, paint, flags);
     }
 
     virtual void restore()
     {
         WRAPCANVAS_LOG_ENTRY("");
-        skia::PlatformCanvas::restore();
+        SkCanvas::restore();
     }
 
     virtual bool translate(SkScalar dx, SkScalar dy)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::translate(dx, dy);
+        return SkCanvas::translate(dx, dy);
     }
 
     virtual bool scale(SkScalar sx, SkScalar sy)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::scale(sx, sy);
+        return SkCanvas::scale(sx, sy);
     }
 
     virtual bool rotate(SkScalar degrees)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::rotate(degrees);
+        return SkCanvas::rotate(degrees);
     }
 
     virtual bool skew(SkScalar sx, SkScalar sy)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::skew(sx, sy);
+        return SkCanvas::skew(sx, sy);
     }
 
     virtual bool concat(const SkMatrix& matrix)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::concat(matrix);
+        return SkCanvas::concat(matrix);
     }
 
     virtual void setMatrix(const SkMatrix& matrix)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        skia::PlatformCanvas::setMatrix(matrix);
+        SkCanvas::setMatrix(matrix);
     }
 
     virtual bool clipRect(const SkRect& rect, SkRegion::Op op)
     {
         WRAPCANVAS_LOG_ENTRY("");
-        return skia::PlatformCanvas::clipRect(rect, op);
+        return SkCanvas::clipRect(rect, op);
     }
 
     virtual bool clipPath(const SkPath& path, SkRegion::Op op) 
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        return skia::PlatformCanvas::clipPath(path, op);
+        return SkCanvas::clipPath(path, op);
     }
 
     virtual bool clipRegion(const SkRegion& region, SkRegion::Op op)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        return skia::PlatformCanvas::clipRegion(region, op);
+        return SkCanvas::clipRegion(region, op);
     }
 
     virtual void clear(SkColor color)
@@ -130,14 +130,14 @@ public:
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = true;
         m_solidColor = Color(color);
-        skia::PlatformCanvas::clear(color);
+        SkCanvas::clear(color);
     }
 
     virtual void drawPaint(const SkPaint& paint)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPaint(paint);
+        SkCanvas::drawPaint(paint);
     }
 
     virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
@@ -145,7 +145,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPoints(mode, count, pts, paint);
+        SkCanvas::drawPoints(mode, count, pts, paint);
     }
 
     virtual void drawRect(const SkRect& rect, const SkPaint& paint)
@@ -165,14 +165,14 @@ public:
                  m_isSolidColor = false;
         } else
             m_isSolidColor = false;
-        skia::PlatformCanvas::drawRect(rect, paint);
+        SkCanvas::drawRect(rect, paint);
     }
 
     virtual void drawPath(const SkPath& path, const SkPaint& paint)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPath(path, paint);
+        SkCanvas::drawPath(path, paint);
     }
 
     virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left,
@@ -180,7 +180,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawBitmap(bitmap, left, top, paint);
+        SkCanvas::drawBitmap(bitmap, left, top, paint);
     }
 
     virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
@@ -188,7 +188,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawBitmapRect(bitmap, src, dst, paint);
+        SkCanvas::drawBitmapRect(bitmap, src, dst, paint);
     }
 
     virtual void drawBitmapMatrix(const SkBitmap& bitmap,
@@ -196,7 +196,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawBitmapMatrix(bitmap, matrix, paint);
+        SkCanvas::drawBitmapMatrix(bitmap, matrix, paint);
     }
 
     virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
@@ -204,7 +204,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawSprite(bitmap, left, top, paint);
+        SkCanvas::drawSprite(bitmap, left, top, paint);
     }
 
     virtual void drawText(const void* text, size_t byteLength, SkScalar x,
@@ -212,7 +212,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawText(text, byteLength, x, y, paint);
+        SkCanvas::drawText(text, byteLength, x, y, paint);
     }
 
     virtual void drawPosText(const void* text, size_t byteLength,
@@ -220,7 +220,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPosText(text, byteLength, pos, paint);
+        SkCanvas::drawPosText(text, byteLength, pos, paint);
     }
 
     virtual void drawPosTextH(const void* text, size_t byteLength,
@@ -228,7 +228,7 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPosTextH(text, byteLength, xpos, constY, paint);
+        SkCanvas::drawPosTextH(text, byteLength, xpos, constY, paint);
     }
 
     virtual void drawTextOnPath(const void* text, size_t byteLength,
@@ -236,14 +236,14 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawTextOnPath(text, byteLength, path, matrix, paint);
+        SkCanvas::drawTextOnPath(text, byteLength, path, matrix, paint);
     }
 
     virtual void drawPicture(SkPicture& picture)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawPicture(picture);
+        SkCanvas::drawPicture(picture);
     }
 
     virtual void drawVertices(VertexMode mode, int vertexCount,
@@ -253,14 +253,14 @@ public:
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawVertices(mode, vertexCount, vertices, texs, colors, xfermode, indices, indexCount, paint);
+        SkCanvas::drawVertices(mode, vertexCount, vertices, texs, colors, xfermode, indices, indexCount, paint);
     }
 
     virtual void drawData(const void* data, size_t size)
     {
         WRAPCANVAS_LOG_ENTRY("");
         m_isSolidColor = false;
-        skia::PlatformCanvas::drawData(data, size);
+        SkCanvas::drawData(data, size);
     }
 
 private:
index 57746fa..8575786 100644 (file)
@@ -54,7 +54,7 @@ class MediaPlayer;
 
 class LayerData {
 public:
-    enum LayerType { Layer, TransformLayer, WebGLLayer };
+    enum LayerType { Layer, TransformLayer, WebGLLayer, CanvasLayer };
     enum FilterType { Linear, Nearest, Trilinear, Lanczos };
     enum LayerProgramShader { LayerProgramShaderRGBA = 0,
                               LayerProgramShaderBGRA,
@@ -74,9 +74,6 @@ public:
         , m_mediaPlayer(0)
 #endif
         , m_texID(0)
-        , m_texWidth(0)
-        , m_texHeight(0)
-        , m_canvas(0)
         , m_frontBufferLock(0)
         , m_suspendTime(0)
         , m_doubleSided(true)
@@ -130,7 +127,7 @@ public:
     unsigned getTextureID() const { return m_texID; }
     void setTextureID(unsigned int value) { m_texID = value; }
 
-    bool needsTexture() const { return m_layerType == WebGLLayer ? true : m_needsTexture; }
+    bool needsTexture() const { return m_layerType == WebGLLayer || m_layerType == CanvasLayer || m_needsTexture; }
 
     LayerProgramShader layerProgramShader() const { return m_layerProgramShader; }
 
@@ -147,8 +144,6 @@ public:
     MediaPlayer* mediaPlayer() const { return m_mediaPlayer; }
 #endif
 
-    HTMLCanvasElement* canvas() const { return m_canvas; }
-
     void replicate(LayerData *to) const { *to = *this; }
 
     LayerType layerType() const { return m_layerType; }
@@ -193,10 +188,6 @@ protected:
     IntRect m_holePunchRect;
 
     unsigned m_texID;
-    unsigned m_texWidth;
-    unsigned m_texHeight;
-
-    HTMLCanvasElement* m_canvas;
 
     pthread_mutex_t* m_frontBufferLock;
 
index 3dad399..33800e1 100644 (file)
@@ -175,7 +175,7 @@ void LayerTiler::updateTextureContentsIfNeeded(double scale)
             if (image->isBitmapImage())
                 isOpaque = !static_cast<BitmapImage*>(image)->currentFrameHasAlpha();
             if (NativeImagePtr nativeImage = image->nativeImageForCurrentFrame()) {
-                SkBitmap bitmap = SkBitmap(*nativeImage);
+                SkBitmap bitmap = SkBitmap(nativeImage->bitmap());
                 addTextureJob(TextureJob::setContents(bitmap, isOpaque));
             }
         } else {
@@ -229,7 +229,7 @@ void LayerTiler::updateTextureContentsIfNeeded(double scale)
         // No point in tiling an image layer, the image is already stored as an SkBitmap
         NativeImagePtr nativeImage = m_layer->contents()->nativeImageForCurrentFrame();
         if (nativeImage) {
-            SkBitmap bitmap = SkBitmap(*nativeImage);
+            SkBitmap bitmap = SkBitmap(nativeImage->bitmap());
             addTextureJob(TextureJob::setContents(bitmap, isOpaque));
         }
         return;
index 55136bb..6c54382 100644 (file)
@@ -108,7 +108,7 @@ SkBitmap LayerWebKitThread::paintContents(const IntRect& contentsRect, double sc
     if (drawsContent()) { // Layer contents must be drawn into a canvas.
         IntRect untransformedContentsRect = contentsRect;
 
-        canvas = adoptPtr(new InstrumentedPlatformCanvas(contentsRect.width(), contentsRect.height(), false, 0));
+        canvas = adoptPtr(new InstrumentedPlatformCanvas(contentsRect.width(), contentsRect.height()));
         PlatformContextSkia skiaContext(canvas.get());
 
         GraphicsContext graphicsContext(&skiaContext);
@@ -191,7 +191,7 @@ void LayerWebKitThread::setDrawable(bool isDrawable)
 
     m_isDrawable = isDrawable;
 
-    setNeedsTexture(m_isDrawable && (drawsContent() || contents() || pluginView() || mediaPlayer() || canvas()));
+    setNeedsTexture(m_isDrawable && (drawsContent() || contents() || pluginView() || mediaPlayer() || m_texID));
     setNeedsCommit();
 }
 
index 1d8bd3a..0ab9878 100644 (file)
@@ -709,15 +709,15 @@ static void loadBufferingImageData()
             return;
 
         loaded = true;
-        nativeImage->lockPixels();
+        nativeImage->bitmap().lockPixels();
 
-        int bufSize = nativeImage->width() * nativeImage->height() * 4;
-        s_bufferingImageWidth = nativeImage->width();
-        s_bufferingImageHeight = nativeImage->height();
+        int bufSize = nativeImage->bitmap().width() * nativeImage->bitmap().height() * 4;
+        s_bufferingImageWidth = nativeImage->bitmap().width();
+        s_bufferingImageHeight = nativeImage->bitmap().height();
         s_bufferingImageData = static_cast<char*>(malloc(bufSize));
-        memcpy(s_bufferingImageData, nativeImage->getPixels(), bufSize);
+        memcpy(s_bufferingImageData, nativeImage->bitmap().getPixels(), bufSize);
 
-        nativeImage->unlockPixels();
+        nativeImage->bitmap().unlockPixels();
         bufferingIcon->deref();
     }
 }
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ImageBufferData_h
-#define ImageBufferData_h
+#ifndef ImageBufferDataSkia_h
+#define ImageBufferDataSkia_h
 
 #include "BlackBerryPlatformGraphics.h"
 #include "PlatformContextSkia.h"
-
-#include "skia/ext/platform_canvas.h"
+#if USE(ACCELERATED_COMPOSITING)
+#include "LayerWebKitThread.h"
+#endif
 
 namespace WebCore {
 
@@ -46,8 +47,11 @@ public:
     OwnPtr<SkCanvas> m_canvas;
     PlatformContextSkia m_platformContext;
     BlackBerry::Platform::Graphics::Buffer* m_buffer;
+#if USE(ACCELERATED_COMPOSITING)
+    RefPtr<LayerWebKitThread> m_platformLayer;
+#endif
 };
 
 } // namespace WebCore
 
-#endif // ImageBufferData_h
+#endif // ImageBufferDataSkia_h