summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/texmap
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/WebCore/platform/graphics/texmap
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/WebCore/platform/graphics/texmap')
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp19
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h4
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapper.h5
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp4
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h5
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp130
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperGL.h18
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp2
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h2
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp20
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h6
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h6
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp4
13 files changed, 115 insertions, 110 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
index f3b0eb411..42954a499 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
@@ -20,10 +20,19 @@
#include "config.h"
#include "GraphicsLayerTextureMapper.h"
+#include "GraphicsLayerFactory.h"
#include "TextureMapperLayer.h"
namespace WebCore {
+PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
+{
+ if (!factory)
+ return adoptPtr(new GraphicsLayerTextureMapper(client));
+
+ return factory->createGraphicsLayer(client);
+}
+
PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
{
if (s_graphicsLayerFactory)
@@ -47,7 +56,7 @@ void GraphicsLayerTextureMapper::notifyChange(TextureMapperLayer::ChangeMask cha
m_changeMask |= changeMask;
if (!client())
return;
- client()->notifySyncRequired(this);
+ client()->notifyFlushRequired(this);
}
void GraphicsLayerTextureMapper::didSynchronize()
@@ -358,16 +367,16 @@ void GraphicsLayerTextureMapper::setContentsToMedia(TextureMapperPlatformLayer*
/* \reimp (GraphicsLayer.h)
*/
-void GraphicsLayerTextureMapper::syncCompositingStateForThisLayerOnly()
+void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
{
- m_layer->syncCompositingState(this);
+ m_layer->flushCompositingState(this);
}
/* \reimp (GraphicsLayer.h)
*/
-void GraphicsLayerTextureMapper::syncCompositingState(const FloatRect&)
+void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect&)
{
- m_layer->syncCompositingState(this, TextureMapperLayer::TraverseDescendants);
+ m_layer->flushCompositingState(this, TextureMapperLayer::TraverseDescendants);
}
bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
index 50070cc0f..637abd9d4 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
@@ -69,8 +69,8 @@ public:
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsToCanvas(PlatformLayer* canvas) { setContentsToMedia(canvas); }
- virtual void syncCompositingState(const FloatRect&);
- virtual void syncCompositingStateForThisLayerOnly();
+ virtual void flushCompositingState(const FloatRect&);
+ virtual void flushCompositingStateForThisLayerOnly();
virtual void setName(const String& name);
virtual PlatformLayer* platformLayer() const { return 0; }
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.h b/Source/WebCore/platform/graphics/texmap/TextureMapper.h
index b4504682b..a90dbe4f1 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.h
@@ -28,6 +28,9 @@
#define TEXMAP_OPENGL_ES_2
#endif
#endif
+#if PLATFORM(GTK) && USE(OPENGL_ES_2)
+#define TEXMAP_OPENGL_ES_2
+#endif
#include "FilterOperations.h"
#include "GraphicsContext.h"
@@ -84,7 +87,7 @@ public:
inline bool isOpaque() const { return !(m_flags & SupportsAlpha); }
#if ENABLE(CSS_FILTERS)
- virtual PassRefPtr<BitmapTexture> applyFilters(const BitmapTexture& contentTexture, const FilterOperations&) { return this; }
+ virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const BitmapTexture& contentTexture, const FilterOperations&) { return this; }
#endif
protected:
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp
index b25372ce6..995cc79da 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp
@@ -34,7 +34,7 @@
namespace WebCore {
#if USE(GRAPHICS_SURFACE)
-void TextureMapperSurfaceBackingStore::setGraphicsSurface(uint64_t graphicsSurfaceToken, const IntSize& surfaceSize, uint32_t frontBuffer)
+void TextureMapperSurfaceBackingStore::setGraphicsSurface(const GraphicsSurfaceToken& graphicsSurfaceToken, const IntSize& surfaceSize, uint32_t frontBuffer)
{
if (graphicsSurfaceToken != m_graphicsSurfaceToken) {
GraphicsSurface::Flags surfaceFlags = GraphicsSurface::SupportsTextureTarget
@@ -68,7 +68,7 @@ void TextureMapperSurfaceBackingStore::setSurface(PassRefPtr<GraphicsSurface> su
m_graphicsSurfaceToken = m_graphicsSurface->exportToken();
} else {
m_graphicsSurface = RefPtr<GraphicsSurface>();
- m_graphicsSurfaceToken = 0;
+ m_graphicsSurfaceToken = GraphicsSurfaceToken();
}
}
#endif
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h
index 9d002b48e..93de3da06 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h
@@ -50,7 +50,7 @@ protected:
class TextureMapperSurfaceBackingStore : public TextureMapperBackingStore {
public:
static PassRefPtr<TextureMapperSurfaceBackingStore> create() { return adoptRef(new TextureMapperSurfaceBackingStore); }
- void setGraphicsSurface(uint64_t graphicsSurfaceToken, const IntSize& surfaceSize, uint32_t frontBuffer);
+ void setGraphicsSurface(const GraphicsSurfaceToken&, const IntSize& surfaceSize, uint32_t frontBuffer);
PassRefPtr<WebCore::GraphicsSurface> graphicsSurface() const { return m_graphicsSurface; }
virtual PassRefPtr<BitmapTexture> texture() const;
virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*);
@@ -62,10 +62,9 @@ protected:
private:
TextureMapperSurfaceBackingStore()
: TextureMapperBackingStore()
- , m_graphicsSurfaceToken(0)
{ }
- uint64_t m_graphicsSurfaceToken;
+ GraphicsSurfaceToken m_graphicsSurfaceToken;
RefPtr<WebCore::GraphicsSurface> m_graphicsSurface;
IntSize m_graphicsSurfaceSize;
};
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
index 7f10e31bb..e5289473b 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
@@ -72,7 +72,7 @@ public:
{
GLContextDataMap::iterator it = glContextDataMap().find(context->platformGraphicsContext3D());
if (it != glContextDataMap().end())
- return it->second;
+ return it->value;
return adoptRef(new SharedGLData(context));
}
@@ -92,7 +92,7 @@ public:
GLContextDataMap::const_iterator end = glContextDataMap().end();
GLContextDataMap::iterator it;
for (it = glContextDataMap().begin(); it != end; ++it) {
- if (it->second == this)
+ if (it->value == this)
break;
}
@@ -568,6 +568,15 @@ void TextureMapperGL::drawTexturedQuadWithProgram(TextureMapperShaderProgram* pr
drawQuad(quadToDraw, modelViewMatrix, program, GraphicsContext3D::TRIANGLE_FAN, needsBlending);
}
+BitmapTextureGL::BitmapTextureGL(TextureMapperGL* textureMapper)
+ : m_id(0)
+ , m_fbo(0)
+ , m_rbo(0)
+ , m_shouldClear(true)
+ , m_context3D(textureMapper->graphicsContext3D())
+{
+}
+
bool BitmapTextureGL::canReuseWith(const IntSize& contentsSize, Flags)
{
return contentsSize == m_textureSize;
@@ -611,10 +620,8 @@ static bool driverSupportsSubImage()
void BitmapTextureGL::didReset()
{
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
-
if (!m_id)
- m_id = context3D->createTexture();
+ m_id = m_context3D->createTexture();
m_shouldClear = true;
if (m_textureSize == contentSize())
@@ -623,21 +630,19 @@ void BitmapTextureGL::didReset()
Platform3DObject format = driverSupportsBGRASwizzling() ? GraphicsContext3D::BGRA : GraphicsContext3D::RGBA;
m_textureSize = contentSize();
- context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
- context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
- context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
- context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
- context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
- context3D->texImage2DDirect(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_textureSize.width(), m_textureSize.height(), 0, format, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, 0);
+ m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
+ m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
+ m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
+ m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
+ m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
+ m_context3D->texImage2DDirect(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_textureSize.width(), m_textureSize.height(), 0, format, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, 0);
}
void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine)
{
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
-
Platform3DObject glFormat = GraphicsContext3D::RGBA;
- context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
+ m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id);
const unsigned bytesPerPixel = 4;
if (driverSupportsBGRASwizzling())
@@ -645,8 +650,8 @@ void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect
else
swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(const_cast<void*>(data)), IntRect(sourceOffset, targetRect.size()), bytesPerLine / bytesPerPixel);
- if (bytesPerLine == targetRect.width() / 4 && sourceOffset == IntPoint::zero()) {
- context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data);
+ if (bytesPerLine == targetRect.width() * bytesPerPixel && sourceOffset == IntPoint::zero()) {
+ m_context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data);
return;
}
@@ -664,19 +669,19 @@ void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect
dst += targetBytesPerLine;
}
- context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, temporaryData.data());
+ m_context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, temporaryData.data());
return;
}
#if !defined(TEXMAP_OPENGL_ES_2)
// Use the OpenGL sub-image extension, now that we know it's available.
- context3D->pixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
- context3D->pixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y());
- context3D->pixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x());
- context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data);
- context3D->pixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- context3D->pixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- context3D->pixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ m_context3D->pixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerLine / bytesPerPixel);
+ m_context3D->pixelStorei(GL_UNPACK_SKIP_ROWS, sourceOffset.y());
+ m_context3D->pixelStorei(GL_UNPACK_SKIP_PIXELS, sourceOffset.x());
+ m_context3D->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, DEFAULT_TEXTURE_PIXEL_TRANSFER_TYPE, (const char*)data);
+ m_context3D->pixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ m_context3D->pixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ m_context3D->pixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
#endif
}
@@ -692,8 +697,9 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co
const char* imageData;
#if PLATFORM(QT)
- imageData = reinterpret_cast<const char*>(frameImage->constBits());
- bytesPerLine = frameImage->bytesPerLine();
+ QImage qImage = frameImage->toImage();
+ imageData = reinterpret_cast<const char*>(qImage.constBits());
+ bytesPerLine = qImage.bytesPerLine();
#elif USE(CAIRO)
cairo_surface_t* surface = frameImage->surface();
imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface));
@@ -727,25 +733,26 @@ void TextureMapperGL::drawFiltered(const BitmapTexture& sourceTexture, const Bit
m_context3D->disableVertexAttribArray(program->texCoordAttrib());
}
-PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(const BitmapTexture& contentTexture, const FilterOperations& filters)
+PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper* textureMapper, const BitmapTexture& contentTexture, const FilterOperations& filters)
{
- RefPtr<BitmapTexture> previousSurface = m_textureMapper->data().currentSurface;
+ TextureMapperGL* textureMapperGL = static_cast<TextureMapperGL*>(textureMapper);
+ RefPtr<BitmapTexture> previousSurface = textureMapperGL->data().currentSurface;
RefPtr<BitmapTexture> source = this;
- RefPtr<BitmapTexture> target = m_textureMapper->acquireTextureFromPool(m_textureSize);
- for (int i = 0; i < filters.size(); ++i) {
+ RefPtr<BitmapTexture> target = textureMapper->acquireTextureFromPool(m_textureSize);
+ for (size_t i = 0; i < filters.size(); ++i) {
const FilterOperation* filter = filters.at(i);
ASSERT(filter);
- int numPasses = m_textureMapper->data().sharedGLData().textureMapperShaderManager.getPassesRequiredForFilter(*filter);
+ int numPasses = textureMapperGL->data().sharedGLData().textureMapperShaderManager.getPassesRequiredForFilter(*filter);
for (int j = 0; j < numPasses; ++j) {
- m_textureMapper->bindSurface(target.get());
- m_textureMapper->drawFiltered((i || j) ? *source : contentTexture, contentTexture, *filter, j);
+ textureMapperGL->bindSurface(target.get());
+ textureMapperGL->drawFiltered((i || j) ? *source : contentTexture, contentTexture, *filter, j);
std::swap(source, target);
}
}
- m_textureMapper->bindSurface(previousSurface.get());
+ textureMapperGL->bindSurface(previousSurface.get());
return source;
}
#endif
@@ -766,18 +773,17 @@ void BitmapTextureGL::initializeStencil()
if (m_rbo)
return;
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
- m_rbo = context3D->createRenderbuffer();
- context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_rbo);
+ m_rbo = m_context3D->createRenderbuffer();
+ m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_rbo);
#ifdef TEXMAP_OPENGL_ES_2
- context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
+ m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_textureSize.width(), m_textureSize.height());
#else
- context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_STENCIL, m_textureSize.width(), m_textureSize.height());
+ m_context3D->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_STENCIL, m_textureSize.width(), m_textureSize.height());
#endif
- context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
- context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_rbo);
- context3D->clearStencil(0);
- context3D->clear(GraphicsContext3D::STENCIL_BUFFER_BIT);
+ m_context3D->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0);
+ m_context3D->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_rbo);
+ m_context3D->clearStencil(0);
+ m_context3D->clear(GraphicsContext3D::STENCIL_BUFFER_BIT);
}
void BitmapTextureGL::clearIfNeeded()
@@ -785,12 +791,10 @@ void BitmapTextureGL::clearIfNeeded()
if (!m_shouldClear)
return;
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
-
m_clipStack.init(IntRect(IntPoint::zero(), m_textureSize));
- m_clipStack.apply(context3D);
- context3D->clearColor(0, 0, 0, 0);
- context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+ m_clipStack.apply(m_context3D.get());
+ m_context3D->clearColor(0, 0, 0, 0);
+ m_context3D->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
m_shouldClear = false;
}
@@ -799,37 +803,33 @@ void BitmapTextureGL::createFboIfNeeded()
if (m_fbo)
return;
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
- m_fbo = context3D->createFramebuffer();
- context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
- context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, id(), 0);
+ m_fbo = m_context3D->createFramebuffer();
+ m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+ m_context3D->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, id(), 0);
m_shouldClear = true;
}
-void BitmapTextureGL::bind()
+void BitmapTextureGL::bind(TextureMapperGL* textureMapper)
{
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
- context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
+ m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
createFboIfNeeded();
- context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
- context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
+ m_context3D->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+ m_context3D->viewport(0, 0, m_textureSize.width(), m_textureSize.height());
clearIfNeeded();
- m_textureMapper->data().projectionMatrix = createProjectionMatrix(m_textureSize, true /* mirrored */);
- m_clipStack.apply(context3D);
+ textureMapper->data().projectionMatrix = createProjectionMatrix(m_textureSize, true /* mirrored */);
+ m_clipStack.apply(m_context3D.get());
}
BitmapTextureGL::~BitmapTextureGL()
{
- GraphicsContext3D* context3D = m_textureMapper->graphicsContext3D();
-
if (m_id)
- context3D->deleteTexture(m_id);
+ m_context3D->deleteTexture(m_id);
if (m_fbo)
- context3D->deleteFramebuffer(m_fbo);
+ m_context3D->deleteFramebuffer(m_fbo);
if (m_rbo)
- context3D->deleteRenderbuffer(m_rbo);
+ m_context3D->deleteRenderbuffer(m_rbo);
}
bool BitmapTextureGL::isValid() const
@@ -864,7 +864,7 @@ void TextureMapperGL::bindSurface(BitmapTexture *surface)
return;
}
- static_cast<BitmapTextureGL*>(surface)->bind();
+ static_cast<BitmapTextureGL*>(surface)->bind(this);
data().currentSurface = surface;
}
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
index 8a72d67af..64bffafe5 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
@@ -133,19 +133,18 @@ public:
virtual bool isValid() const;
virtual bool canReuseWith(const IntSize& contentsSize, Flags = 0);
virtual void didReset();
- void bind();
+ void bind(TextureMapperGL*);
void initializeStencil();
~BitmapTextureGL();
virtual uint32_t id() const { return m_id; }
uint32_t textureTarget() const { return GraphicsContext3D::TEXTURE_2D; }
IntSize textureSize() const { return m_textureSize; }
- void setTextureMapper(TextureMapperGL* texmap) { m_textureMapper = texmap; }
void updateContents(Image*, const IntRect&, const IntPoint&);
virtual void updateContents(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine);
virtual bool isBackedByOpenGL() const { return true; }
#if ENABLE(CSS_FILTERS)
- virtual PassRefPtr<BitmapTexture> applyFilters(const BitmapTexture& contentTexture, const FilterOperations&);
+ virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const BitmapTexture& contentTexture, const FilterOperations&);
#endif
private:
@@ -156,17 +155,10 @@ private:
Platform3DObject m_rbo;
bool m_shouldClear;
TextureMapperGL::ClipStack m_clipStack;
- TextureMapperGL* m_textureMapper;
+ RefPtr<GraphicsContext3D> m_context3D;
+ BitmapTextureGL(TextureMapperGL*);
BitmapTextureGL();
- BitmapTextureGL(TextureMapperGL* textureMapper)
- : m_id(0)
- , m_fbo(0)
- , m_rbo(0)
- , m_shouldClear(true)
- , m_textureMapper(textureMapper)
- {
- }
void clearIfNeeded();
void createFboIfNeeded();
@@ -174,8 +166,6 @@ private:
friend class TextureMapperGL;
};
-typedef uint64_t ImageUID;
-ImageUID uidForImage(Image*);
BitmapTextureGL* toBitmapTextureGL(BitmapTexture*);
}
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
index 9b0c9a56f..9282959de 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
@@ -121,7 +121,7 @@ void TextureMapperImageBuffer::drawTexture(const BitmapTexture& texture, const F
}
#if ENABLE(CSS_FILTERS)
-PassRefPtr<BitmapTexture> BitmapTextureImageBuffer::applyFilters(const BitmapTexture& contentTexture, const FilterOperations& filters)
+PassRefPtr<BitmapTexture> BitmapTextureImageBuffer::applyFilters(TextureMapper*, const BitmapTexture& contentTexture, const FilterOperations& filters)
{
RefPtr<FilterEffectRenderer> renderer = FilterEffectRenderer::create();
renderer->setSourceImageRect(FloatRect(FloatPoint::zero(), contentTexture.size()));
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
index 71511fc12..7d51e8805 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
@@ -37,7 +37,7 @@ public:
virtual void updateContents(Image*, const IntRect&, const IntPoint&);
virtual void updateContents(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine);
#if ENABLE(CSS_FILTERS)
- PassRefPtr<BitmapTexture> applyFilters(const BitmapTexture&, const FilterOperations&);
+ PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const BitmapTexture&, const FilterOperations&);
#endif
private:
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
index 36958987d..e36dbc948 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
@@ -342,7 +342,7 @@ static PassRefPtr<BitmapTexture> applyFilters(const FilterOperations& filters, T
return source;
RefPtr<BitmapTexture> filterSurface = shouldKeepContentTexture(filters) ? textureMapper->acquireTextureFromPool(source->size()) : source;
- return filterSurface->applyFilters(*source, filters);
+ return filterSurface->applyFilters(textureMapper, *source, filters);
}
#endif
@@ -402,12 +402,12 @@ TextureMapperLayer::~TextureMapperLayer()
m_parent->m_children.remove(m_parent->m_children.find(this));
}
-void TextureMapperLayer::syncCompositingState(GraphicsLayerTextureMapper* graphicsLayer, int options)
+void TextureMapperLayer::flushCompositingState(GraphicsLayerTextureMapper* graphicsLayer, int options)
{
- syncCompositingState(graphicsLayer, rootLayer()->m_textureMapper, options);
+ flushCompositingState(graphicsLayer, rootLayer()->m_textureMapper, options);
}
-void TextureMapperLayer::syncCompositingStateSelf(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper)
+void TextureMapperLayer::flushCompositingStateSelf(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper)
{
int changeMask = graphicsLayer->changeMask();
@@ -519,18 +519,18 @@ void TextureMapperLayer::syncAnimations()
setOpacity(m_state.opacity);
}
-void TextureMapperLayer::syncCompositingState(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper, int options)
+void TextureMapperLayer::flushCompositingState(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper* textureMapper, int options)
{
if (!textureMapper)
return;
if (graphicsLayer && !(options & ComputationsOnly)) {
- syncCompositingStateSelf(graphicsLayer, textureMapper);
+ flushCompositingStateSelf(graphicsLayer, textureMapper);
graphicsLayer->didSynchronize();
}
if (graphicsLayer && m_state.maskLayer) {
- m_state.maskLayer->syncCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->maskLayer()), textureMapper);
+ m_state.maskLayer->flushCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->maskLayer()), textureMapper);
// A mask layer has its parent's size by default, in case it's not set specifically.
if (m_state.maskLayer->m_size.isEmpty())
@@ -538,7 +538,7 @@ void TextureMapperLayer::syncCompositingState(GraphicsLayerTextureMapper* graphi
}
if (m_state.replicaLayer)
- m_state.replicaLayer->syncCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->replicaLayer()), textureMapper);
+ m_state.replicaLayer->flushCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->replicaLayer()), textureMapper);
syncAnimations();
updateBackingStore(textureMapper, graphicsLayer);
@@ -552,11 +552,11 @@ void TextureMapperLayer::syncCompositingState(GraphicsLayerTextureMapper* graphi
TextureMapperLayer* layer = toTextureMapperLayer(children[i]);
if (!layer)
continue;
- layer->syncCompositingState(toGraphicsLayerTextureMapper(children[i]), textureMapper, options);
+ layer->flushCompositingState(toGraphicsLayerTextureMapper(children[i]), textureMapper, options);
}
} else {
for (int i = m_children.size() - 1; i >= 0; --i)
- m_children[i]->syncCompositingState(0, textureMapper, options);
+ m_children[i]->flushCompositingState(0, textureMapper, options);
}
}
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
index 2f7f4b821..5740acf52 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
@@ -114,8 +114,8 @@ public:
virtual ~TextureMapperLayer();
- void syncCompositingState(GraphicsLayerTextureMapper*, int syncOptions = 0);
- void syncCompositingState(GraphicsLayerTextureMapper*, TextureMapper*, int syncOptions = 0);
+ void flushCompositingState(GraphicsLayerTextureMapper*, int syncOptions = 0);
+ void flushCompositingState(GraphicsLayerTextureMapper*, TextureMapper*, int syncOptions = 0);
IntSize size() const { return IntSize(m_size.width(), m_size.height()); }
void setTransform(const TransformationMatrix&);
void setOpacity(float value) { m_opacity = value; }
@@ -144,7 +144,7 @@ private:
FloatRect targetRectForTileRect(const FloatRect& totalTargetRect, const FloatRect& tileRect) const;
void invalidateViewport(const FloatRect&);
void notifyChange(ChangeMask);
- void syncCompositingStateSelf(GraphicsLayerTextureMapper*, TextureMapper*);
+ void flushCompositingStateSelf(GraphicsLayerTextureMapper*, TextureMapper*);
static int compareGraphicsLayersZValue(const void* a, const void* b);
static void sortByZOrder(Vector<TextureMapperLayer* >& array, int first, int last);
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
index 2292f4eb4..db3f0bec6 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
@@ -20,6 +20,10 @@
#ifndef TextureMapperPlatformLayer_h
#define TextureMapperPlatformLayer_h
+#if USE(GRAPHICS_SURFACE)
+#include "GraphicsSurface.h"
+#endif
+
#include "TransformationMatrix.h"
namespace WebCore {
@@ -34,7 +38,7 @@ public:
virtual void swapBuffers() { }
#if USE(GRAPHICS_SURFACE)
virtual uint32_t copyToGraphicsSurface() { return 0; }
- virtual uint64_t graphicsSurfaceToken() const { return 0; }
+ virtual GraphicsSurfaceToken graphicsSurfaceToken() const { return GraphicsSurfaceToken(); }
#endif
};
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp
index 73d6fefbb..5ca8c96bf 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp
@@ -199,7 +199,7 @@ PassRefPtr<TextureMapperShaderProgram> TextureMapperShaderManager::getShaderProg
TextureMapperShaderProgramMap::iterator it = m_textureMapperShaderProgramMap.find(shaderType);
if (it != m_textureMapperShaderProgramMap.end())
- return it->second;
+ return it->value;
switch (shaderType) {
case Simple:
@@ -759,7 +759,7 @@ PassRefPtr<StandardFilterProgram> TextureMapperShaderManager::getShaderForFilter
m_filterMap.add(key, program);
} else
- program = iterator->second;
+ program = iterator->value;
return program;
}