Commit 5463b8da authored by anilsson@rim.com's avatar anilsson@rim.com
Browse files

[BlackBerry] BlackBerry::Platform::Graphics::GraphicsContext integration...

[BlackBerry] BlackBerry::Platform::Graphics::GraphicsContext integration related changes in Source/WebKit/blackberry
https://bugs.webkit.org/show_bug.cgi?id=112467

Reviewed by Rob Buis.

PR 293208

This patch contains contributions from many members of the BlackBerry
WebKit team:

Mike Lattanzio
Arvid Nilsson
Jakob Petsovits
Konrad Piascik
Jeff Rogers
Filip Spacek

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::compositeContents):
(BlackBerry::WebKit::BackingStorePrivate::tileSize):
* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlayPrivate::drawContents):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::paintContents):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToImage):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::clearUploadedContents):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawTextures):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeFromParent):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage):
* Api/WebOverlay.h:
* Api/WebOverlayClient.h:
* Api/WebOverlay_p.h:
(WebOverlayPrivate):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showDebugBorders):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showRepaintCounter):
(WebOverlayLayerCompositingThreadClient):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::image):
(WebOverlayPrivateCompositingThread):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::WebPageCompositorPrivate):
* WebKitSupport/BackingStoreTile.cpp:
(BlackBerry::WebKit::TileBuffer::~TileBuffer):
(BlackBerry::WebKit::TileBuffer::nativeBuffer):
(BlackBerry::WebKit::TileBuffer::paintBackground):
* WebKitSupport/DefaultTapHighlight.cpp:
(BlackBerry::WebKit::DefaultTapHighlight::paintContents):
(BlackBerry::WebKit::DefaultTapHighlight::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::DefaultTapHighlight::showRepaintCounter):
* WebKitSupport/DefaultTapHighlight.h:
(DefaultTapHighlight):
* WebKitSupport/InspectorOverlayBlackBerry.cpp:
(BlackBerry::WebKit::InspectorOverlay::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::InspectorOverlay::showRepaintCounter):
* WebKitSupport/InspectorOverlayBlackBerry.h:
(InspectorOverlay):
* WebKitSupport/SelectionOverlay.cpp:
(BlackBerry::WebKit::SelectionOverlay::draw):
(BlackBerry::WebKit::SelectionOverlay::hide):
(BlackBerry::WebKit::SelectionOverlay::paintContents):
(BlackBerry::WebKit::SelectionOverlay::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::SelectionOverlay::showRepaintCounter):
* WebKitSupport/SelectionOverlay.h:
(SelectionOverlay):
* WebKitSupport/SurfacePool.cpp:
(BlackBerry::WebKit::SurfacePool::createPlatformGraphicsContext):
(BlackBerry::WebKit::SurfacePool::destroyPlatformGraphicsContext):
(BlackBerry::WebKit::SurfacePool::waitForBuffer):
(BlackBerry::WebKit::SurfacePool::notifyBuffersComposited):
(BlackBerry::WebKit::SurfacePool::destroyPlatformSync):
* WebKitSupport/SurfacePool.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 819d6c32
......@@ -49,8 +49,6 @@
#include <BlackBerryPlatformViewportAccessor.h>
#include <BlackBerryPlatformWindow.h>
#include <SkImageDecoder.h>
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
#include <wtf/NotFound.h>
......@@ -1064,12 +1062,7 @@ TileIndexList BackingStorePrivate::render(const TileIndexList& tileIndexList)
TileBuffer* backBuffer = SurfacePool::globalSurfacePool()->takeBackBuffer();
ASSERT(backBuffer);
// If the tile has been created, but this is the first time we are painting on it
// then it hasn't been given a default background yet so that we can save time during
// startup. That's why we are doing it here instead...
if (!backBuffer->backgroundPainted())
backBuffer->paintBackground();
backBuffer->paintBackground();
backBuffer->setLastRenderScale(currentScale);
backBuffer->setLastRenderOrigin(tileOrigin);
backBuffer->clearRenderedRegion();
......@@ -1223,6 +1216,18 @@ void BackingStorePrivate::blitVisibleContents(bool force)
dstRect.toString().c_str(), documentSrcRect.toString().c_str(), viewportAccessor->scale());
#endif
BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer();
ASSERT(dstBuffer);
if (dstBuffer) {
// On the GPU, clearing is free and allows for optimizations,
// so we always want to do this first for the whole surface.
// Don't call clearWindow() as we don't want to add it to the posted rect.
BlackBerry::Platform::Graphics::clearBuffer(dstBuffer,
m_webPageBackgroundColor.red(), m_webPageBackgroundColor.green(),
m_webPageBackgroundColor.blue(), m_webPageBackgroundColor.alpha());
} else
Platform::logAlways(Platform::LogLevelWarn, "Empty window buffer, can't blit contents.");
#if DEBUG_CHECKERBOARD
bool blitCheckered = false;
#endif
......@@ -1425,13 +1430,14 @@ void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRendere
Platform::IntRectRegion transformedContentsRegion = transformedContents;
Platform::IntRectRegion backingStoreRegion = geometry->backingStoreRect();
Platform::IntRectRegion checkeredRegion
Platform::IntRectRegion clearRegion
= Platform::IntRectRegion::subtractRegions(transformedContentsRegion, backingStoreRegion);
// Blit checkered to those parts that are not covered by the backingStoreRect.
std::vector<Platform::IntRect> checkeredRects = checkeredRegion.rects();
for (size_t i = 0; i < checkeredRects.size(); ++i)
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(checkeredRects.at(i))));
// Clear those parts that are not covered by the backingStoreRect.
Color clearColor(Color::white);
std::vector<Platform::IntRect> clearRects = clearRegion.rects();
for (size_t i = 0; i < clearRects.size(); ++i)
layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(clearRects.at(i))), clearColor);
// Get the list of tile rects that makeup the content.
TileRectList tileRectList = mapFromPixelContentsToTiles(transformedContents, geometry);
......@@ -1442,7 +1448,7 @@ void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRendere
TileBuffer* tileBuffer = currentMap.get(index);
if (!tileBuffer || !geometry->isTileCorrespondingToBuffer(index, tileBuffer))
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect)));
layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect)), clearColor);
else {
Platform::IntPoint tileOrigin = tileBuffer->lastRenderOrigin();
Platform::FloatRect tileDocumentContentsRect = m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(tileBuffer->pixelContentsRect()));
......@@ -1456,7 +1462,7 @@ void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRendere
for (size_t i = 0; i < notRenderedRects.size(); ++i) {
Platform::IntRect tileSurfaceRect = notRenderedRects.at(i);
tileSurfaceRect.move(-tileOrigin.x(), -tileOrigin.y());
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(tileSurfaceRect)));
layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(tileSurfaceRect)), clearColor);
}
}
}
......@@ -1808,7 +1814,7 @@ int BackingStorePrivate::tileHeight()
Platform::IntSize BackingStorePrivate::tileSize()
{
static Platform::IntSize tileSize = Platform::Settings::instance()->tileSize(Platform::BackingStoreTileUsage);
static Platform::IntSize tileSize = Platform::Settings::instance()->tileSize();
return tileSize;
}
......
/*
* Copyright (C) 2012 Research In Motion Limited. All rights reserved.
* Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -24,7 +24,6 @@
#include "LayerWebKitThread.h"
#include "NotImplemented.h"
#include "PlatformContextSkia.h"
#include "TextureCacheCompositingThread.h"
#include "WebAnimation.h"
#include "WebAnimation_p.h"
......@@ -35,16 +34,17 @@
#include "WebPageCompositor_p.h"
#include "WebPage_p.h"
#include <BlackBerryPlatformGraphicsContext.h>
#include <BlackBerryPlatformMessageClient.h>
#include <BlackBerryPlatformString.h>
#include <GLES2/gl2.h>
#include <SkDevice.h>
using namespace WebCore;
using BlackBerry::Platform::Graphics::GLES2Program;
namespace BlackBerry {
namespace WebKit {
using namespace WebCore;
WebOverlay::WebOverlay()
: d(0)
{
......@@ -230,12 +230,12 @@ WebOverlayOverride* WebOverlayPrivate::override()
return m_override.get();
}
void WebOverlayPrivate::drawContents(SkCanvas* canvas)
void WebOverlayPrivate::drawContents(Platform::Graphics::Drawable* drawable)
{
if (!client)
return;
client->drawOverlayContents(q, canvas);
client->drawOverlayContents(q, drawable);
}
void WebOverlayPrivate::scheduleCompositingRun()
......@@ -383,12 +383,11 @@ void WebOverlayPrivateWebKitThread::notifyFlushRequired(const WebCore::GraphicsL
void WebOverlayPrivateWebKitThread::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& c, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&)
{
drawContents(c.platformContext()->canvas());
drawContents(c.platformContext());
}
WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient()
: m_drawsContent(false)
, m_layerCompositingThread(0)
, m_client(0)
{
}
......@@ -404,9 +403,9 @@ void WebOverlayLayerCompositingThreadClient::invalidate()
clearUploadedContents();
}
void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& contents)
void WebOverlayLayerCompositingThreadClient::setContentsToImage(const BlackBerry::Platform::Graphics::TiledImage& image)
{
m_contents = contents;
m_image = image;
m_color = Color();
m_texture.clear();
clearUploadedContents();
......@@ -414,12 +413,12 @@ void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& content
void WebOverlayLayerCompositingThreadClient::clearUploadedContents()
{
m_uploadedContents = SkBitmap();
m_uploadedImage = BlackBerry::Platform::Graphics::TiledImage();
}
void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& color)
{
m_contents = SkBitmap();
m_image = BlackBerry::Platform::Graphics::TiledImage();
m_color = color;
m_texture.clear();
clearUploadedContents();
......@@ -434,9 +433,9 @@ void WebOverlayLayerCompositingThreadClient::layerVisibilityChanged(LayerComposi
{
}
void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread*)
void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread* layer)
{
if (m_contents.isNull() && !m_color.isValid() && !m_drawsContent)
if (m_image.isNull() && !m_color.isValid() && !m_drawsContent)
return;
if (m_texture && m_texture->textureId())
......@@ -447,38 +446,69 @@ void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerComposi
return;
}
Texture::HostType textureContents = Texture::HostType();
IntSize textureSize;
if (m_drawsContent) {
if (!m_client || !m_owner)
return;
if (m_contents.isNull()) {
m_contents.setConfig(SkBitmap::kARGB_8888_Config, m_layerCompositingThread->bounds().width(), m_layerCompositingThread->bounds().height());
m_contents.allocPixels();
}
textureSize = layer->bounds();
textureContents = BlackBerry::Platform::Graphics::createBuffer(IntSize(0, 0), BlackBerry::Platform::Graphics::NeverBacked);
if (!textureContents)
return;
clearBuffer(textureContents, 0, 0, 0, 0);
PlatformGraphicsContext* platformContext = lockBufferDrawable(textureContents);
double transform[] = {
1, 0,
0, 1,
-layer->bounds().width() / 2.0, -layer->bounds().height() / 2.0
};
platformContext->setTransform(transform);
m_client->drawOverlayContents(m_owner, platformContext);
releaseBufferDrawable(textureContents);
} else if (!m_image.isNull()) {
textureSize = IntSize(m_image.width(), m_image.height());
textureContents = BlackBerry::Platform::Graphics::createBuffer(IntSize(0, 0), BlackBerry::Platform::Graphics::NeverBacked);
if (!textureContents)
return;
PlatformGraphicsContext* platformContext = BlackBerry::Platform::Graphics::lockBufferDrawable(textureContents);
SkDevice device(m_contents);
SkCanvas canvas(&device);
m_client->drawOverlayContents(m_owner, &canvas);
canvas.flush();
AffineTransform transform;
platformContext->getTransform(reinterpret_cast<double*>(&transform));
transform.translate(-m_image.width() / 2.0, -m_image.height() / 2.0);
platformContext->setTransform(reinterpret_cast<double*>(&transform));
FloatRect rect(0, 0, m_image.width(), m_image.height());
platformContext->addImage(rect, rect, &m_image);
releaseBufferDrawable(textureContents);
m_uploadedImage = m_image;
}
m_texture = Texture::create();
m_texture->protect(IntSize(m_contents.width(), m_contents.height()));
IntRect bitmapRect(0, 0, m_contents.width(), m_contents.height());
m_uploadedContents = m_contents;
m_texture->updateContents(m_uploadedContents, bitmapRect, bitmapRect, false);
m_texture->protect(IntSize(), BlackBerry::Platform::Graphics::BackedWhenNecessary);
IntRect bitmapRect(0, 0, textureSize.width(), textureSize.height());
m_texture->updateContents(textureContents, bitmapRect, bitmapRect, false);
}
void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double /*scale*/, int positionLocation, int texCoordLocation)
void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double scale, const GLES2Program& program)
{
if (!m_texture || !m_texture->textureId())
return;
glBindTexture(GL_TEXTURE_2D, m_texture->textureId());
glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &layer->getTransformedBounds());
float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 };
glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
TransformationMatrix matrix = layer->drawTransform();
if (!m_image.isNull()) {
if (m_image.size().isEmpty())
return;
matrix.scaleNonUniform(static_cast<double>(layer->bounds().width()) / m_image.width(), static_cast<double>(layer->bounds().height()) / m_image.height());
}
matrix.scale(layer->sizeIsScaleInvariant() ? 1.0 / scale : 1.0);
blitToBuffer(0, m_texture->textureId(), reinterpret_cast<BlackBerry::Platform::TransformationMatrix&>(matrix),
BlackBerry::Platform::Graphics::SourceOver, static_cast<unsigned char>(layer->drawOpacity() * 255));
}
void WebOverlayLayerCompositingThreadClient::deleteTextures(LayerCompositingThread*)
......@@ -489,6 +519,7 @@ void WebOverlayLayerCompositingThreadClient::deleteTextures(LayerCompositingThre
WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread(PassRefPtr<LayerCompositingThread> layerCompositingThread)
: m_layerCompositingThreadClient(0)
, m_data(0)
{
m_layerCompositingThread = layerCompositingThread;
}
......@@ -497,7 +528,6 @@ WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread()
: m_layerCompositingThreadClient(new WebOverlayLayerCompositingThreadClient)
{
m_layerCompositingThread = LayerCompositingThread::create(LayerData::CustomLayer, m_layerCompositingThreadClient);
m_layerCompositingThreadClient->setLayer(m_layerCompositingThread.get());
}
WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread()
......@@ -616,8 +646,8 @@ void WebOverlayPrivateCompositingThread::addChild(WebOverlayPrivate* overlay)
void WebOverlayPrivateCompositingThread::removeFromParent()
{
if (m_layerCompositingThread->superlayer() == page()->m_compositor->compositingThreadOverlayLayer())
page()->m_compositor->removeOverlay(m_layerCompositingThread.get());
if (page() && m_layerCompositingThread->superlayer() == page()->compositor()->compositingThreadOverlayLayer())
page()->m_webPage->removeCompositingThreadOverlay(q);
else
m_layerCompositingThread->removeFromSuperlayer();
scheduleCompositingRun();
......@@ -628,33 +658,14 @@ void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char*
if (!m_layerCompositingThreadClient)
return;
const SkBitmap& oldContents = m_layerCompositingThreadClient->contents();
if (!oldContents.isNull()) {
SkAutoLockPixels lock(oldContents);
if (data == oldContents.getPixels())
return;
}
if (data == m_data)
return;
SkBitmap contents;
contents.setConfig(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height());
switch (adoptionType) {
case WebOverlay::ReferenceImageData:
contents.setPixels(const_cast<unsigned char*>(data));
break;
case WebOverlay::CopyImageData:
if (contents.allocPixels()) {
contents.lockPixels();
size_t bytes = SkBitmap::ComputeSize(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height());
memcpy(contents.getPixels(), data, bytes);
contents.unlockPixels();
}
break;
default:
ASSERT_NOT_REACHED();
}
m_data = data;
BlackBerry::Platform::Graphics::TiledImage image = BlackBerry::Platform::Graphics::TiledImage(imageSize, reinterpret_cast_ptr<const unsigned*>(data), true, BlackBerry::Platform::Graphics::TiledImage::Hardware);
m_layerCompositingThreadClient->setContents(contents);
m_layerCompositingThreadClient->setContentsToImage(image);
m_layerCompositingThread->setNeedsTexture(true);
}
......
/*
* Copyright (C) 2012 Research In Motion Limited. All rights reserved.
* Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -118,7 +118,7 @@ public:
// Will result in a future call to WebOverlayClient::drawContents, if the layer draws custom contents.
void invalidate();
// The client can be used to draw layer contents using Skia.
// The client can be used to draw layer contents.
void setClient(WebOverlayClient*);
// Must be called on UI thread.
......
......@@ -20,8 +20,7 @@
#define WebOverlayClient_h
#include "BlackBerryGlobal.h"
class SkCanvas;
#include <BlackBerryPlatformGraphics.h>
namespace BlackBerry {
namespace WebKit {
......@@ -34,7 +33,7 @@ class BLACKBERRY_EXPORT WebOverlayClient {
public:
virtual ~WebOverlayClient() { }
virtual void drawOverlayContents(WebOverlay*, SkCanvas*) = 0;
virtual void drawOverlayContents(WebOverlay*, BlackBerry::Platform::Graphics::Drawable*) = 0;
};
}
......
/*
* Copyright (C) 2012 Research In Motion Limited. All rights reserved.
* Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -27,13 +27,11 @@
#include "WebOverlay.h"
#include "WebOverlayOverride.h"
#include <SkBitmap.h>
#include <TiledImage.h>
#include <pthread.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
class SkCanvas;
namespace WTF {
class String;
}
......@@ -103,7 +101,7 @@ public:
virtual void clear() = 0;
virtual void invalidate() = 0;
void drawContents(SkCanvas*);
void drawContents(Platform::Graphics::Drawable*);
virtual void resetOverrides() = 0;
......@@ -171,7 +169,8 @@ public:
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { }
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip);
virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; }
virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; }
virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; }
private:
OwnPtr<WebCore::GraphicsLayer> m_layer;
......@@ -184,35 +183,33 @@ public:
WebOverlayLayerCompositingThreadClient();
virtual ~WebOverlayLayerCompositingThreadClient() { }
void setLayer(WebCore::LayerCompositingThread* layer) { m_layerCompositingThread = layer; }
void setClient(WebOverlay* owner, WebOverlayClient* client) { m_owner = owner; m_client = client; }
bool drawsContent() const { return m_drawsContent; }
void setDrawsContent(bool);
void invalidate();
const SkBitmap& contents() const { return m_contents; }
void setContents(const SkBitmap&);
void setContentsToImage(const BlackBerry::Platform::Graphics::TiledImage&);
void setContentsToColor(const WebCore::Color&);
const BlackBerry::Platform::Graphics::TiledImage& image() const { return m_image; }
// LayerCompositingThreadClient
virtual void layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*);
virtual void layerVisibilityChanged(WebCore::LayerCompositingThread*, bool visible);
virtual void uploadTexturesIfNeeded(WebCore::LayerCompositingThread*);
virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation);
virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, const Platform::Graphics::GLES2Program&);
virtual void deleteTextures(WebCore::LayerCompositingThread*);
private:
void clearUploadedContents();
private:
RefPtr<WebCore::Texture> m_texture;
bool m_drawsContent;
SkBitmap m_contents;
SkBitmap m_uploadedContents;
RefPtr<WebCore::Texture> m_texture;
BlackBerry::Platform::Graphics::TiledImage m_image;
BlackBerry::Platform::Graphics::TiledImage m_uploadedImage;
WebCore::Color m_color;
WebCore::LayerCompositingThread* m_layerCompositingThread;
WebOverlay* m_owner;
WebOverlayClient* m_client;
};
......@@ -262,6 +259,7 @@ public:
private:
WebOverlayLayerCompositingThreadClient* m_layerCompositingThreadClient;
const unsigned char* m_data;
};
}
......
......@@ -45,6 +45,7 @@ namespace WebKit {
WebPageCompositorPrivate::WebPageCompositorPrivate(WebPagePrivate* page, WebPageCompositorClient* client)
: m_client(client)
, m_webPage(page)
, m_context(0)
, m_drawsRootLayer(false)
, m_childWindowPlacement(WebPageCompositor::DocumentCoordinates)
{
......
2013-03-15 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] BlackBerry::Platform::Graphics::GraphicsContext integration related changes in Source/WebKit/blackberry
https://bugs.webkit.org/show_bug.cgi?id=112467
Reviewed by Rob Buis.
PR 293208
This patch contains contributions from many members of the BlackBerry
WebKit team:
Mike Lattanzio
Arvid Nilsson
Jakob Petsovits
Konrad Piascik
Jeff Rogers
Filip Spacek
* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::compositeContents):
(BlackBerry::WebKit::BackingStorePrivate::tileSize):
* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlayPrivate::drawContents):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::paintContents):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToImage):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::clearUploadedContents):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawTextures):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeFromParent):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage):
* Api/WebOverlay.h:
* Api/WebOverlayClient.h:
* Api/WebOverlay_p.h:
(WebOverlayPrivate):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showDebugBorders):
(BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showRepaintCounter):
(WebOverlayLayerCompositingThreadClient):
(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::image):
(WebOverlayPrivateCompositingThread):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::WebPageCompositorPrivate):
* WebKitSupport/BackingStoreTile.cpp:
(BlackBerry::WebKit::TileBuffer::~TileBuffer):
(BlackBerry::WebKit::TileBuffer::nativeBuffer):
(BlackBerry::WebKit::TileBuffer::paintBackground):
* WebKitSupport/DefaultTapHighlight.cpp:
(BlackBerry::WebKit::DefaultTapHighlight::paintContents):
(BlackBerry::WebKit::DefaultTapHighlight::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::DefaultTapHighlight::showRepaintCounter):
* WebKitSupport/DefaultTapHighlight.h:
(DefaultTapHighlight):
* WebKitSupport/InspectorOverlayBlackBerry.cpp:
(BlackBerry::WebKit::InspectorOverlay::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::InspectorOverlay::showRepaintCounter):
* WebKitSupport/InspectorOverlayBlackBerry.h:
(InspectorOverlay):
* WebKitSupport/SelectionOverlay.cpp:
(BlackBerry::WebKit::SelectionOverlay::draw):
(BlackBerry::WebKit::SelectionOverlay::hide):
(BlackBerry::WebKit::SelectionOverlay::paintContents):
(BlackBerry::WebKit::SelectionOverlay::showDebugBorders):
(WebKit):
(BlackBerry::WebKit::SelectionOverlay::showRepaintCounter):
* WebKitSupport/SelectionOverlay.h:
(SelectionOverlay):
* WebKitSupport/SurfacePool.cpp:
(BlackBerry::WebKit::SurfacePool::createPlatformGraphicsContext):
(BlackBerry::WebKit::SurfacePool::destroyPlatformGraphicsContext):
(BlackBerry::WebKit::SurfacePool::waitForBuffer):
(BlackBerry::WebKit::SurfacePool::notifyBuffersComposited):
(BlackBerry::WebKit::SurfacePool::destroyPlatformSync):
* WebKitSupport/SurfacePool.h:
2013-03-15 Arvid Nilsson <anilsson@rim.com>
 
[BlackBerry] Expose the compositing thread layer's draw rectangle to aid hit testing
......
......@@ -45,7 +45,7 @@ TileBuffer::TileBuffer(const Platform::IntSize& size)
TileBuffer::~TileBuffer()
{
destroyBuffer(m_nativeBuffer);
Platform::Graphics::destroyBuffer(m_nativeBuffer);
}
Platform::IntSize TileBuffer::size() const
......@@ -101,7 +101,7 @@ Platform::IntRectRegion TileBuffer::notRenderedRegion() const
Platform::Graphics::Buffer* TileBuffer::nativeBuffer() const
{
if (!m_nativeBuffer)
m_nativeBuffer = createBuffer(m_size, Platform::Graphics::AlwaysBacked, SurfacePool::globalSurfacePool()->sharedPixmapGroup());
m_nativeBuffer = Platform::Graphics::createBuffer(m_size, Platform::Graphics::AlwaysBacked, SurfacePool::globalSurfacePool()->sharedPixmapGroup());
return m_nativeBuffer;
}
......@@ -115,7 +115,7 @@ void TileBuffer::paintBackground()
{
m_backgroundPainted = true;
clearBuffer(nativeBuffer(), 0, 0, 0, 0);
Platform::Graphics::clearBuffer(nativeBuffer(), 0, 0, 0, 0);
}
}
......
......@@ -24,10 +24,10 @@
#include "GraphicsContext.h"
#include "Path.h"
#include "PlatformContextSkia.h"
#include "WebAnimation.h"
#include "WebPage_p.h"