+2012-04-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use TextureLayerChromium for WebGL content instead of a dedicated layer type
+ https://bugs.webkit.org/show_bug.cgi?id=84311
+
+ Reviewed by Adrienne Walker.
+
+ Remove some unused getters.
+
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebExternalTextureLayer):
+
2012-04-20 Dana Jansens <danakj@chromium.org>
[chromium] WebFilterOperations API does not compile or dynamically link
// Sets whether or not the texture should be flipped in the Y direction when
// rendered.
WEBKIT_EXPORT void setFlipped(bool);
- WEBKIT_EXPORT bool flipped() const;
// Sets the rect in UV space of the texture that is mapped to the layer
// bounds.
WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
- WEBKIT_EXPORT WebFloatRect uvRect() const;
private:
#if WEBKIT_IMPLEMENTATION
+2012-04-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use TextureLayerChromium for WebGL content instead of a dedicated layer type
+ https://bugs.webkit.org/show_bug.cgi?id=84311
+
+ Reviewed by Adrienne Walker.
+
+ WebGL content's interface with the compositor can be expressed in terms of two basic operations:
+ 1.) Do some stuff
+ 2.) Provide a texture ID for the compositor to use
+
+ This implements (1) in DrawingBufferChromium and uses the already-existing TextureLayerChromium to handle (2).
+ This cuts down the compositor interface significantly and allows for more code reuse in exchange for more code
+ in TextureLayerChromium to handle the features WebGL needs.
+
+ * WebCore.gypi:
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBuffer::~DrawingBuffer):
+ (DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (WebCore):
+ (WebCore::DrawingBuffer::platformLayer):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ * platform/graphics/chromium/TextureLayerChromium.h:
+ (TextureLayerChromiumClient):
+ (WebCore::TextureLayerChromiumClient::~TextureLayerChromiumClient):
+ (WebCore):
+ (TextureLayerChromium):
+ (WebCore::TextureLayerChromium::clearClient):
+ * platform/graphics/chromium/WebGLLayerChromium.cpp: Removed.
+ * platform/graphics/chromium/WebGLLayerChromium.h: Removed.
+ * platform/graphics/gpu/DrawingBuffer.h:
+ (WebCore):
+ (WebCore::DrawingBuffer::graphicsContext3D):
+ (DrawingBuffer):
+
2012-04-23 Alec Flett <alecflett@chromium.org>
IndexedDB: remove IDB(Index|ObjectStore)BackendImpl::get/getKey for IDBKey
'platform/graphics/chromium/VDMXParser.h',
'platform/graphics/chromium/VideoLayerChromium.cpp',
'platform/graphics/chromium/VideoLayerChromium.h',
- 'platform/graphics/chromium/WebGLLayerChromium.cpp',
- 'platform/graphics/chromium/WebGLLayerChromium.h',
'platform/graphics/chromium/cc/CCActiveAnimation.cpp',
'platform/graphics/chromium/cc/CCActiveAnimation.h',
'platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp',
#include "CanvasRenderingContext.h"
#include "Extensions3DChromium.h"
#include "GraphicsContext3D.h"
-#include "WebGLLayerChromium.h"
+#include "TextureLayerChromium.h"
#include "cc/CCProxy.h"
+#include "cc/CCTextureUpdater.h"
#include <algorithm>
using namespace std;
DrawingBuffer::~DrawingBuffer()
{
- if (m_platformLayer)
- m_platformLayer->setDrawingBuffer(0);
-
if (!m_context)
return;
}
#endif
+class DrawingBufferPrivate : public TextureLayerChromiumClient {
+ WTF_MAKE_NONCOPYABLE(DrawingBufferPrivate);
+public:
+ explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
+ : m_drawingBuffer(drawingBuffer)
+ , m_layer(TextureLayerChromium::create(this))
+ {
+ GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
+ m_layer->setOpaque(!attributes.alpha);
+ m_layer->setPremultipliedAlpha(attributes.premultipliedAlpha);
+ }
+
+ virtual ~DrawingBufferPrivate()
+ {
+ m_layer->clearClient();
+ }
+
+ virtual unsigned prepareTexture(CCTextureUpdater& updater) OVERRIDE
+ {
+ m_drawingBuffer->prepareBackBuffer();
+
+ context()->flush();
+ context()->markLayerComposited();
+
+ unsigned textureId = m_drawingBuffer->frontColorBuffer();
+ if (m_drawingBuffer->requiresCopyFromBackToFrontBuffer())
+ updater.appendCopy(m_drawingBuffer->colorBuffer(), textureId, m_drawingBuffer->size());
+
+ return textureId;
+ }
+
+ virtual GraphicsContext3D* context() OVERRIDE
+ {
+ return m_drawingBuffer->graphicsContext3D();
+ }
+
+ LayerChromium* layer() const { return m_layer.get(); }
+
+private:
+ DrawingBuffer* m_drawingBuffer;
+ RefPtr<TextureLayerChromium> m_layer;
+};
+
#if USE(ACCELERATED_COMPOSITING)
PlatformLayer* DrawingBuffer::platformLayer()
{
- if (!m_platformLayer) {
- m_platformLayer = WebGLLayerChromium::create();
- m_platformLayer->setDrawingBuffer(this);
- m_platformLayer->setOpaque(m_alpha == Opaque);
- }
+ if (!m_private)
+ m_private = adoptPtr(new DrawingBufferPrivate(this));
- return m_platformLayer.get();
+ return m_private->layer();
}
#endif
#include "TraceEvent.h"
#include "TrackingTextureAllocator.h"
#include "TreeSynchronizer.h"
-#include "WebGLLayerChromium.h"
#include "cc/CCCheckerboardDrawQuad.h"
#include "cc/CCDamageTracker.h"
#include "cc/CCDebugBorderDrawQuad.h"
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
- if (quad->hasAlpha() && !quad->premultipliedAlpha())
+ if (!quad->premultipliedAlpha())
GLC(context(), context()->blendFunc(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
const IntSize& bounds = quad->quadRect().size();
#include "TextureLayerChromium.h"
+#include "Extensions3D.h"
+#include "cc/CCLayerTreeHost.h"
#include "cc/CCTextureLayerImpl.h"
namespace WebCore {
-PassRefPtr<TextureLayerChromium> TextureLayerChromium::create()
+PassRefPtr<TextureLayerChromium> TextureLayerChromium::create(TextureLayerChromiumClient* client)
{
- return adoptRef(new TextureLayerChromium);
+ return adoptRef(new TextureLayerChromium(client));
}
-TextureLayerChromium::TextureLayerChromium()
+TextureLayerChromium::TextureLayerChromium(TextureLayerChromiumClient* client)
: LayerChromium()
- , m_textureId(0)
+ , m_client(client)
, m_flipped(true)
, m_uvRect(0, 0, 1, 1)
+ , m_premultipliedAlpha(true)
+ , m_rateLimitContext(false)
+ , m_contextLost(false)
+ , m_textureId(0)
, m_ioSurfaceId(0)
{
}
+TextureLayerChromium::~TextureLayerChromium()
+{
+ if (m_rateLimitContext && m_client && layerTreeHost())
+ layerTreeHost()->stopRateLimiter(m_client->context());
+}
+
PassOwnPtr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl()
{
return CCTextureLayerImpl::create(m_layerId);
}
-bool TextureLayerChromium::drawsContent() const
+void TextureLayerChromium::setFlipped(bool flipped)
{
- return (m_textureId || m_ioSurfaceId) && LayerChromium::drawsContent();
+ m_flipped = flipped;
+ setNeedsCommit();
}
-void TextureLayerChromium::setTextureId(unsigned id)
+void TextureLayerChromium::setUVRect(const FloatRect& rect)
{
- m_textureId = id;
+ m_uvRect = rect;
setNeedsCommit();
}
-void TextureLayerChromium::setFlipped(bool flipped)
+void TextureLayerChromium::setPremultipliedAlpha(bool premultipliedAlpha)
{
- m_flipped = flipped;
+ m_premultipliedAlpha = premultipliedAlpha;
setNeedsCommit();
}
-void TextureLayerChromium::setUVRect(const FloatRect& rect)
+void TextureLayerChromium::setRateLimitContext(bool rateLimit)
{
- m_uvRect = rect;
+ if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost())
+ layerTreeHost()->stopRateLimiter(m_client->context());
+
+ m_rateLimitContext = rateLimit;
+}
+
+void TextureLayerChromium::setTextureId(unsigned id)
+{
+ m_textureId = id;
setNeedsCommit();
}
setNeedsCommit();
}
+void TextureLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
+{
+ LayerChromium::setNeedsDisplayRect(dirtyRect);
+
+ if (m_rateLimitContext && m_client && layerTreeHost())
+ layerTreeHost()->startRateLimiter(m_client->context());
+}
+
+bool TextureLayerChromium::drawsContent() const
+{
+ return (m_client || m_textureId || m_ioSurfaceId) && !m_contextLost && LayerChromium::drawsContent();
+}
+
+void TextureLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*)
+{
+ if (m_client) {
+ m_textureId = m_client->prepareTexture(updater);
+ m_contextLost = m_client->context()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR;
+ }
+
+ m_needsDisplay = false;
+}
+
void TextureLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
{
LayerChromium::pushPropertiesTo(layer);
CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer);
- textureLayer->setTextureId(m_textureId);
textureLayer->setFlipped(m_flipped);
textureLayer->setUVRect(m_uvRect);
+ textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
+ textureLayer->setTextureId(m_textureId);
textureLayer->setIOSurfaceProperties(m_ioSurfaceSize, m_ioSurfaceId);
}
namespace WebCore {
+class TextureLayerChromiumClient {
+public:
+ // Called to prepare this layer's texture for compositing. The client may queue a texture
+ // upload or copy on the CCTextureUpdater.
+ // Returns the texture ID to be used for compositing.
+ virtual unsigned prepareTexture(CCTextureUpdater&) = 0;
+
+ // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
+ virtual GraphicsContext3D* context() = 0;
+
+protected:
+ virtual ~TextureLayerChromiumClient() { }
+};
+
// A Layer containing a the rendered output of a plugin instance.
class TextureLayerChromium : public LayerChromium {
public:
- static PassRefPtr<TextureLayerChromium> create();
+ // If this texture layer requires special preparation logic for each frame driven by
+ // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
+ // are driven by an external process.
+ static PassRefPtr<TextureLayerChromium> create(TextureLayerChromiumClient*);
+ virtual ~TextureLayerChromium();
+
+ void clearClient() { m_client = 0; }
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
- virtual bool drawsContent() const OVERRIDE;
+ // Sets whether this texture should be Y-flipped at draw time. Defaults to true.
+ void setFlipped(bool);
+
+ // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
+ void setUVRect(const FloatRect&);
+
+ // Sets whether the alpha channel is premultiplied or unpremultiplied. Defaults to true.
+ void setPremultipliedAlpha(bool);
+
+ // Sets whether this context should rate limit on damage to prevent too many frames from
+ // being queued up before the compositor gets a chance to run. Requires a non-nil client.
+ // Defaults to false.
+ void setRateLimitContext(bool);
// Code path for plugins which supply their own texture ID.
void setTextureId(unsigned);
- void setFlipped(bool);
- bool flipped() const { return m_flipped; }
- void setUVRect(const FloatRect&);
- const FloatRect& uvRect() const { return m_uvRect; }
// Code path for plugins which render via an IOSurface.
void setIOSurfaceProperties(int width, int height, uint32_t ioSurfaceId);
+ virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
+
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
protected:
- TextureLayerChromium();
+ explicit TextureLayerChromium(TextureLayerChromiumClient*);
private:
- unsigned m_textureId;
+ TextureLayerChromiumClient* m_client;
+
bool m_flipped;
FloatRect m_uvRect;
+ bool m_premultipliedAlpha;
+ bool m_rateLimitContext;
+ bool m_contextLost;
+
+ unsigned m_textureId;
+
IntSize m_ioSurfaceSize;
uint32_t m_ioSurfaceId;
};
+++ /dev/null
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "WebGLLayerChromium.h"
-
-#include "DrawingBuffer.h"
-#include "Extensions3DChromium.h"
-#include "GraphicsContext3D.h"
-#include "TextureCopier.h"
-#include "TraceEvent.h"
-#include "cc/CCLayerTreeHost.h"
-#include "cc/CCTextureLayerImpl.h"
-#include "cc/CCTextureUpdater.h"
-
-namespace WebCore {
-
-PassRefPtr<WebGLLayerChromium> WebGLLayerChromium::create()
-{
- return adoptRef(new WebGLLayerChromium());
-}
-
-WebGLLayerChromium::WebGLLayerChromium()
- : CanvasLayerChromium()
- , m_hasAlpha(true)
- , m_premultipliedAlpha(true)
- , m_contextLost(false)
- , m_textureId(0)
- , m_drawingBuffer(0)
-{
-}
-
-WebGLLayerChromium::~WebGLLayerChromium()
-{
- if (context() && layerTreeHost())
- layerTreeHost()->stopRateLimiter(context());
-}
-
-bool WebGLLayerChromium::drawsContent() const
-{
- return LayerChromium::drawsContent() && !m_contextLost;
-}
-
-void WebGLLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*)
-{
- if (!drawsContent() || !m_needsDisplay || !m_drawingBuffer)
- return;
-
- m_drawingBuffer->prepareBackBuffer();
-
- context()->flush();
- context()->markLayerComposited();
- m_needsDisplay = false;
- m_contextLost = context()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR;
-
- m_textureId = m_drawingBuffer->frontColorBuffer();
- if (m_drawingBuffer->requiresCopyFromBackToFrontBuffer())
- updater.appendCopy(m_drawingBuffer->colorBuffer(), m_textureId, bounds());
-
- m_drawingBuffer->restoreFramebufferBinding();
-}
-
-void WebGLLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
-{
- CanvasLayerChromium::pushPropertiesTo(layer);
-
- CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer);
- textureLayer->setTextureId(m_textureId);
- textureLayer->setHasAlpha(m_hasAlpha);
- textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
-}
-
-void WebGLLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
-{
- LayerChromium::setNeedsDisplayRect(dirtyRect);
-
- // If WebGL commands are issued outside of a the animation callbacks, then use
- // call rateLimitOffscreenContextCHROMIUM() to keep the context from getting too far ahead.
- if (layerTreeHost())
- layerTreeHost()->startRateLimiter(context());
-}
-
-void WebGLLayerChromium::setDrawingBuffer(DrawingBuffer* drawingBuffer)
-{
- bool drawingBufferChanged = (m_drawingBuffer != drawingBuffer);
-
- // The GraphicsContext3D used by the layer is the context associated with
- // the drawing buffer. If the drawing buffer is changing, make sure
- // to stop the rate limiter on the old context, not the new context from the
- // new drawing buffer.
- GraphicsContext3D* context3D = context();
- if (layerTreeHost() && drawingBufferChanged && context3D)
- layerTreeHost()->stopRateLimiter(context3D);
-
- m_drawingBuffer = drawingBuffer;
- if (!m_drawingBuffer)
- return;
-
- GraphicsContext3D::Attributes attributes = context()->getContextAttributes();
- m_hasAlpha = attributes.alpha;
- m_premultipliedAlpha = attributes.premultipliedAlpha;
- m_contextLost = context()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR;
-}
-
-GraphicsContext3D* WebGLLayerChromium::context() const
-{
- if (drawingBuffer())
- return drawingBuffer()->graphicsContext3D().get();
-
- return 0;
-}
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
+++ /dev/null
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef WebGLLayerChromium_h
-#define WebGLLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CanvasLayerChromium.h"
-#include "DrawingBuffer.h"
-
-namespace WebCore {
-
-class GraphicsContext3D;
-class WebGLLayerChromiumRateLimitTask;
-
-// A Layer containing a WebGL canvas
-class WebGLLayerChromium : public CanvasLayerChromium {
-public:
- static PassRefPtr<WebGLLayerChromium> create();
-
- virtual ~WebGLLayerChromium();
-
- virtual bool drawsContent() const OVERRIDE;
- virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
- virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
-
- GraphicsContext3D* context() const;
-
- void setDrawingBuffer(DrawingBuffer*);
- DrawingBuffer* drawingBuffer() const { return m_drawingBuffer; }
-private:
- WebGLLayerChromium();
- friend class WebGLLayerChromiumRateLimitTask;
-
- bool m_hasAlpha;
- bool m_premultipliedAlpha;
- bool m_contextLost;
- unsigned m_textureId;
-
- // The DrawingBuffer holding the WebGL contents for this layer.
- // A reference is not held here, because the DrawingBuffer already holds
- // a reference to the WebGLLayerChromium.
- DrawingBuffer* m_drawingBuffer;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
namespace WebCore {
-PassOwnPtr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool hasAlpha, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
+PassOwnPtr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
{
- return adoptPtr(new CCTextureDrawQuad(sharedQuadState, quadRect, textureId, hasAlpha, premultipliedAlpha, uvRect, flipped, ioSurfaceSize, ioSurfaceTextureId));
+ return adoptPtr(new CCTextureDrawQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped, ioSurfaceSize, ioSurfaceTextureId));
}
-CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool hasAlpha, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
+CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId)
: CCDrawQuad(sharedQuadState, CCDrawQuad::TextureContent, quadRect)
, m_textureId(textureId)
- , m_hasAlpha(hasAlpha)
, m_premultipliedAlpha(premultipliedAlpha)
, m_uvRect(uvRect)
, m_flipped(flipped)
class CCTextureDrawQuad : public CCDrawQuad {
WTF_MAKE_NONCOPYABLE(CCTextureDrawQuad);
public:
- static PassOwnPtr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, bool hasAlpha, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
+ static PassOwnPtr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
unsigned textureId() const { return m_textureId; }
- bool hasAlpha() const { return m_hasAlpha; }
bool premultipliedAlpha() const { return m_premultipliedAlpha; }
FloatRect uvRect() const { return m_uvRect; }
bool flipped() const { return m_flipped; }
unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; }
private:
- CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned texture_id, bool hasAlpha, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
+ CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned texture_id, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId);
unsigned m_textureId;
- bool m_hasAlpha;
bool m_premultipliedAlpha;
FloatRect m_uvRect;
bool m_flipped;
CCTextureLayerImpl::CCTextureLayerImpl(int id)
: CCLayerImpl(id)
, m_textureId(0)
- , m_hasAlpha(true)
, m_premultipliedAlpha(true)
, m_flipped(true)
, m_uvRect(0, 0, 1, 1)
void CCTextureLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&)
{
IntRect quadRect(IntPoint(), bounds());
- quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_textureId, m_hasAlpha, m_premultipliedAlpha, m_uvRect, m_flipped, m_ioSurfaceSize, m_ioSurfaceTextureId));
+ quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_textureId, m_premultipliedAlpha, m_uvRect, m_flipped, m_ioSurfaceSize, m_ioSurfaceTextureId));
}
void CCTextureLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
unsigned textureId() const { return m_textureId; }
void setTextureId(unsigned id) { m_textureId = id; }
- void setHasAlpha(bool hasAlpha) { m_hasAlpha = hasAlpha; }
void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; }
void setFlipped(bool flipped) { m_flipped = flipped; }
void setUVRect(const FloatRect& rect) { m_uvRect = rect; }
virtual const char* layerTypeAsString() const OVERRIDE { return "TextureLayer"; }
unsigned m_textureId;
- bool m_hasAlpha;
bool m_premultipliedAlpha;
bool m_flipped;
FloatRect m_uvRect;
class GraphicsContext3D;
class ImageData;
#if PLATFORM(CHROMIUM)
-class WebGLLayerChromium;
+class DrawingBufferPrivate;
#endif
// Manages a rendering target (framebuffer + attachment) for a canvas. Can publish its rendering
void paintCompositedResultsToCanvas(CanvasRenderingContext*);
#endif
- PassRefPtr<GraphicsContext3D> graphicsContext3D() const { return m_context; }
+ GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
private:
DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionSupported,
Platform3DObject m_multisampleColorBuffer;
#if PLATFORM(CHROMIUM)
- RefPtr<WebGLLayerChromium> m_platformLayer;
+ OwnPtr<DrawingBufferPrivate> m_private;
#endif
#if PLATFORM(MAC)
+2012-04-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use TextureLayerChromium for WebGL content instead of a dedicated layer type
+ https://bugs.webkit.org/show_bug.cgi?id=84311
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * src/WebExternalTextureLayer.cpp:
+ (WebKit::WebExternalTextureLayer::create):
+ * src/WebLayer.cpp:
+ * tests/WebGLLayerChromiumTest.cpp: Removed.
+ * tests/WebLayerTest.cpp:
+
2012-04-23 Alec Flett <alecflett@chromium.org>
IndexedDB: remove IDB(Index|ObjectStore)BackendImpl::get/getKey for IDBKey
'tests/CompositorFakeGraphicsContext3D.h',
'tests/CompositorFakeWebGraphicsContext3D.h',
'tests/DragImageTest.cpp',
+ 'tests/DrawingBufferChromiumTest.cpp',
'tests/FakeCCLayerTreeHostClient.h',
'tests/FakeGraphicsContext3DTest.cpp',
'tests/FakeWebGraphicsContext3D.h',
'tests/TreeTestHelpers.h',
'tests/WebCompositorInputHandlerImplTest.cpp',
'tests/WebFrameTest.cpp',
- 'tests/WebGLLayerChromiumTest.cpp',
'tests/WebLayerTest.cpp',
'tests/WebPageNewSerializerTest.cpp',
'tests/WebPageSerializerTest.cpp',
WebExternalTextureLayer WebExternalTextureLayer::create()
{
- RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create();
+ RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create(0);
layer->setIsDrawable(true);
return WebExternalTextureLayer(layer.release());
}
unwrap<TextureLayerChromium>()->setFlipped(flipped);
}
-bool WebExternalTextureLayer::flipped() const
-{
- return constUnwrap<TextureLayerChromium>()->flipped();
-}
-
void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
{
unwrap<TextureLayerChromium>()->setUVRect(rect);
}
-WebFloatRect WebExternalTextureLayer::uvRect() const
-{
- return WebFloatRect(constUnwrap<TextureLayerChromium>()->uvRect());
-}
-
WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
: WebLayer(layer)
{
#include "SkMatrix44.h"
#include "TransformationMatrix.h"
#include "WebLayerImpl.h"
-
+#include <public/WebFilterOperations.h>
#include <public/WebFloatPoint.h>
#include <public/WebFloatRect.h>
#include <public/WebSize.h>
-#include <public/WebFilterOperations.h>
-
using namespace WebCore;
namespace {
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "config.h"
-#include "WebGLLayerChromium.h"
+#include "DrawingBuffer.h"
#include "CompositorFakeGraphicsContext3D.h"
-#include "DrawingBuffer.h"
+#include "LayerChromium.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
namespace {
-TEST(WebGLLayerChromiumTest, opaqueFormats)
+TEST(DrawingBufferChromiumTest, opaqueFormats)
{
RefPtr<DrawingBuffer> buffer;
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
textureLayer.setFlipped(true);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(textureLayer.flipped());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f);
textureLayer.setUVRect(uvRect);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(textureLayer.flipped());
// Content layer.