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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace WebKit { | 38 namespace WebKit { |
39 class WebGraphicsContext3D; | 39 class WebGraphicsContext3D; |
40 } | 40 } |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public
SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayer
Bridge> { | 44 class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public
SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayer
Bridge> { |
45 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); | 45 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); |
46 public: | 46 public: |
| 47 enum OpacityMode { |
| 48 Opaque, |
| 49 NonOpaque |
| 50 }; |
| 51 |
47 enum ThreadMode { | 52 enum ThreadMode { |
48 SingleThread, | 53 SingleThread, |
49 Threaded | 54 Threaded |
50 }; | 55 }; |
51 | 56 |
52 static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>
context, const IntSize& size, ThreadMode threading, unsigned textureId) | 57 static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>
context, const IntSize& size, OpacityMode opacityMode, ThreadMode threading, uns
igned textureId) |
53 { | 58 { |
54 return adoptPtr(new Canvas2DLayerBridge(context, size, threading, textur
eId)); | 59 return adoptPtr(new Canvas2DLayerBridge(context, size, opacityMode, thre
ading, textureId)); |
55 } | 60 } |
56 | 61 |
57 virtual ~Canvas2DLayerBridge(); | 62 virtual ~Canvas2DLayerBridge(); |
58 | 63 |
59 // WebKit::WebExternalTextureLayerClient implementation. | 64 // WebKit::WebExternalTextureLayerClient implementation. |
60 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE; | 65 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE; |
61 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; | 66 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; |
62 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE { r
eturn false; } | 67 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE { r
eturn false; } |
63 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR
IDE { } | 68 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR
IDE { } |
64 | 69 |
(...skipping 10 matching lines...) Expand all Loading... |
75 size_t bytesAllocated() const {return m_bytesAllocated;} | 80 size_t bytesAllocated() const {return m_bytesAllocated;} |
76 void limitPendingFrames(); | 81 void limitPendingFrames(); |
77 | 82 |
78 SkCanvas* skCanvas(SkDevice*); | 83 SkCanvas* skCanvas(SkDevice*); |
79 WebKit::WebLayer* layer(); | 84 WebKit::WebLayer* layer(); |
80 void contextAcquired(); | 85 void contextAcquired(); |
81 | 86 |
82 unsigned backBufferTexture(); | 87 unsigned backBufferTexture(); |
83 | 88 |
84 protected: | 89 protected: |
85 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, const IntSize&, ThreadMod
e, unsigned textureId); | 90 Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMo
de, ThreadMode, unsigned textureId); |
86 | 91 |
87 unsigned m_backBufferTexture; | 92 unsigned m_backBufferTexture; |
88 IntSize m_size; | 93 IntSize m_size; |
89 SkDeferredCanvas* m_canvas; | 94 SkDeferredCanvas* m_canvas; |
90 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; | 95 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; |
91 RefPtr<GraphicsContext3D> m_context; | 96 RefPtr<GraphicsContext3D> m_context; |
92 size_t m_bytesAllocated; | 97 size_t m_bytesAllocated; |
93 bool m_didRecordDrawCommand; | 98 bool m_didRecordDrawCommand; |
94 int m_framesPending; | 99 int m_framesPending; |
95 | 100 |
96 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; | 101 friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>; |
97 Canvas2DLayerBridge* m_next; | 102 Canvas2DLayerBridge* m_next; |
98 Canvas2DLayerBridge* m_prev; | 103 Canvas2DLayerBridge* m_prev; |
99 }; | 104 }; |
100 | 105 |
101 } | 106 } |
102 | 107 |
103 #endif | 108 #endif |
OLD | NEW |