Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: Source/platform/graphics/Canvas2DImageBufferSurface.h

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase mayhem Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/graphics/Canvas2DLayerBridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/Canvas2DImageBufferSurface.h
diff --git a/Source/core/testing/LayerRect.h b/Source/platform/graphics/Canvas2DImageBufferSurface.h
similarity index 55%
copy from Source/core/testing/LayerRect.h
copy to Source/platform/graphics/Canvas2DImageBufferSurface.h
index 4827feee4f2476d200f0a986a73c81ca9cb4d020..e14bb5d94246445d8620488bc0b07da2d10553c0 100644
--- a/Source/core/testing/LayerRect.h
+++ b/Source/platform/graphics/Canvas2DImageBufferSurface.h
@@ -28,44 +28,42 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LayerRect_h
-#define LayerRect_h
+#ifndef Canvas2DImageBufferSurface_h
+#define Canvas2DImageBufferSurface_h
-#include "core/dom/ClientRect.h"
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
+#include "platform/graphics/Canvas2DLayerBridge.h"
+#include "platform/graphics/ImageBufferSurface.h"
namespace WebCore {
-class Node;
-
-class LayerRect : public RefCounted<LayerRect> {
+// This shim necessary because ImageBufferSurfaces are not allowed to be RefCounted
+class Canvas2DImageBufferSurface : public ImageBufferSurface {
public:
- static PassRefPtr<LayerRect> create(PassRefPtr<Node> node, const String& layerType, PassRefPtr<ClientRect> rect)
+ Canvas2DImageBufferSurface(const IntSize& size, OpacityMode opacityMode = NonOpaque, int msaaSampleCount = 1)
+ : ImageBufferSurface(size, opacityMode)
+ , m_layerBridge(Canvas2DLayerBridge::create(size, opacityMode, msaaSampleCount))
{
- return adoptRef(new LayerRect(node, layerType, rect));
+ clear();
}
- Node* layerRootNode() const { return m_layerRootNode.get(); }
- String layerType() const { return m_layerType; }
- ClientRect* layerRelativeRect() const { return m_rect.get(); }
-
-private:
- LayerRect(PassRefPtr<Node> node, const String& layerName, PassRefPtr<ClientRect> rect)
- : m_layerRootNode(node)
- , m_layerType(layerName)
- , m_rect(rect)
+ virtual ~Canvas2DImageBufferSurface()
{
+ if (m_layerBridge)
+ m_layerBridge->beginDestruction();
}
- RefPtr<Node> m_layerRootNode;
- String m_layerType;
- RefPtr<ClientRect> m_rect;
+ // ImageBufferSurface implementation
+ virtual void willUse() OVERRIDE { m_layerBridge->willUse(); }
+ virtual SkCanvas* canvas() const OVERRIDE { return m_layerBridge->canvas(); }
+ virtual bool isValid() const OVERRIDE { return m_layerBridge && m_layerBridge->isValid(); }
+ virtual blink::WebLayer* layer() const OVERRIDE { return m_layerBridge->layer(); }
+ virtual Platform3DObject getBackingTexture() const OVERRIDE { return m_layerBridge->getBackingTexture(); }
+ virtual bool isAccelerated() const { return m_layerBridge->isAccelerated(); }
+
+private:
+ RefPtr<Canvas2DLayerBridge> m_layerBridge;
};
-} // namespace WebCore
+}
#endif
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/graphics/Canvas2DLayerBridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698