| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public
SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayer
Bridge>, public RefCounted<Canvas2DLayerBridge> { | 64 class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public
SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayer
Bridge>, public RefCounted<Canvas2DLayerBridge> { |
| 65 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); | 65 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); |
| 66 public: | 66 public: |
| 67 enum OpacityMode { | 67 enum OpacityMode { |
| 68 Opaque, | 68 Opaque, |
| 69 NonOpaque | 69 NonOpaque |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 static PassRefPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>,
const IntSize&, OpacityMode); | 72 static PassRefPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>,
const IntSize&, OpacityMode, int msaaSampleCount); |
| 73 | 73 |
| 74 virtual ~Canvas2DLayerBridge(); | 74 virtual ~Canvas2DLayerBridge(); |
| 75 | 75 |
| 76 // WebKit::WebExternalTextureLayerClient implementation. | 76 // WebKit::WebExternalTextureLayerClient implementation. |
| 77 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; | 77 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; |
| 78 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebE
xternalBitmap*) OVERRIDE; | 78 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebE
xternalBitmap*) OVERRIDE; |
| 79 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR
IDE; | 79 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR
IDE; |
| 80 | 80 |
| 81 // SkDeferredCanvas::NotificationClient implementation | 81 // SkDeferredCanvas::NotificationClient implementation |
| 82 virtual void prepareForDraw() OVERRIDE; | 82 virtual void prepareForDraw() OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 void contextAcquired(); | 95 void contextAcquired(); |
| 96 PassRefPtr<SkCanvas> getCanvas() { return PassRefPtr<SkCanvas>(m_canvas); } | 96 PassRefPtr<SkCanvas> getCanvas() { return PassRefPtr<SkCanvas>(m_canvas); } |
| 97 | 97 |
| 98 unsigned backBufferTexture(); | 98 unsigned backBufferTexture(); |
| 99 | 99 |
| 100 bool isValid(); | 100 bool isValid(); |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 void destroy(); | 103 void destroy(); |
| 104 friend class Canvas2DLayerBridgePtr; | 104 friend class Canvas2DLayerBridgePtr; |
| 105 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassRefPtr<SkDeferredCanv
as>, OpacityMode); | 105 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassRefPtr<SkDeferredCanv
as>, int, OpacityMode); |
| 106 void setRateLimitingEnabled(bool); | 106 void setRateLimitingEnabled(bool); |
| 107 | 107 |
| 108 RefPtr<SkDeferredCanvas> m_canvas; | 108 RefPtr<SkDeferredCanvas> m_canvas; |
| 109 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; | 109 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; |
| 110 RefPtr<GraphicsContext3D> m_context; | 110 RefPtr<GraphicsContext3D> m_context; |
| 111 int m_msaaSampleCount; |
| 111 size_t m_bytesAllocated; | 112 size_t m_bytesAllocated; |
| 112 bool m_didRecordDrawCommand; | 113 bool m_didRecordDrawCommand; |
| 113 bool m_surfaceIsValid; | 114 bool m_surfaceIsValid; |
| 114 int m_framesPending; | 115 int m_framesPending; |
| 115 bool m_destructionInProgress; | 116 bool m_destructionInProgress; |
| 116 bool m_rateLimitingEnabled; | 117 bool m_rateLimitingEnabled; |
| 117 | 118 |
| 118 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; | 119 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; |
| 119 Canvas2DLayerBridge* m_next; | 120 Canvas2DLayerBridge* m_next; |
| 120 Canvas2DLayerBridge* m_prev; | 121 Canvas2DLayerBridge* m_prev; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 134 MailboxInfo(const MailboxInfo&); | 135 MailboxInfo(const MailboxInfo&); |
| 135 MailboxInfo() {} | 136 MailboxInfo() {} |
| 136 }; | 137 }; |
| 137 MailboxInfo* createMailboxInfo(); | 138 MailboxInfo* createMailboxInfo(); |
| 138 | 139 |
| 139 uint32_t m_lastImageId; | 140 uint32_t m_lastImageId; |
| 140 Vector<MailboxInfo> m_mailboxes; | 141 Vector<MailboxInfo> m_mailboxes; |
| 141 }; | 142 }; |
| 142 } | 143 } |
| 143 #endif | 144 #endif |
| OLD | NEW |