OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "core/platform/graphics/GraphicsContext3D.h" | 34 #include "core/platform/graphics/GraphicsContext3D.h" |
35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsTypes3D.h" | 36 #include "platform/graphics/GraphicsTypes3D.h" |
37 | 37 |
38 #include "public/platform/WebExternalTextureLayerClient.h" | 38 #include "public/platform/WebExternalTextureLayerClient.h" |
39 #include "public/platform/WebExternalTextureMailbox.h" | 39 #include "public/platform/WebExternalTextureMailbox.h" |
40 #include "wtf/Noncopyable.h" | 40 #include "wtf/Noncopyable.h" |
41 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
43 | 43 |
44 namespace WebKit { | 44 namespace blink { |
45 class WebExternalBitmap; | 45 class WebExternalBitmap; |
46 class WebExternalTextureLayer; | 46 class WebExternalTextureLayer; |
47 class WebGraphicsContext3D; | 47 class WebGraphicsContext3D; |
48 class WebLayer; | 48 class WebLayer; |
49 } | 49 } |
50 | 50 |
51 namespace WebCore { | 51 namespace WebCore { |
52 class GraphicsContext3D; | 52 class GraphicsContext3D; |
53 class ImageData; | 53 class ImageData; |
54 | 54 |
55 // Abstract interface to allow basic context eviction management | 55 // Abstract interface to allow basic context eviction management |
56 class ContextEvictionManager : public RefCounted<ContextEvictionManager> { | 56 class ContextEvictionManager : public RefCounted<ContextEvictionManager> { |
57 public: | 57 public: |
58 virtual ~ContextEvictionManager() {}; | 58 virtual ~ContextEvictionManager() {}; |
59 | 59 |
60 virtual void forciblyLoseOldestContext(const String& reason) = 0; | 60 virtual void forciblyLoseOldestContext(const String& reason) = 0; |
61 virtual IntSize oldestContextSize() = 0; | 61 virtual IntSize oldestContextSize() = 0; |
62 }; | 62 }; |
63 | 63 |
64 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering | 64 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering |
65 // results to a WebKit::WebLayer for compositing. | 65 // results to a blink::WebLayer for compositing. |
66 class DrawingBuffer : public RefCounted<DrawingBuffer>, public WebKit::WebExtern
alTextureLayerClient { | 66 class DrawingBuffer : public RefCounted<DrawingBuffer>, public blink::WebExterna
lTextureLayerClient { |
67 struct MailboxInfo : public RefCounted<MailboxInfo> { | 67 struct MailboxInfo : public RefCounted<MailboxInfo> { |
68 WebKit::WebExternalTextureMailbox mailbox; | 68 blink::WebExternalTextureMailbox mailbox; |
69 unsigned textureId; | 69 unsigned textureId; |
70 IntSize size; | 70 IntSize size; |
71 }; | 71 }; |
72 public: | 72 public: |
73 enum PreserveDrawingBuffer { | 73 enum PreserveDrawingBuffer { |
74 Preserve, | 74 Preserve, |
75 Discard | 75 Discard |
76 }; | 76 }; |
77 | 77 |
78 static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&,
PreserveDrawingBuffer, PassRefPtr<ContextEvictionManager>); | 78 static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&,
PreserveDrawingBuffer, PassRefPtr<ContextEvictionManager>); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Track the currently active texture unit. Texture unit 0 is used as host f
or a scratch | 113 // Track the currently active texture unit. Texture unit 0 is used as host f
or a scratch |
114 // texture. | 114 // texture. |
115 void setActiveTextureUnit(GC3Dint textureUnit) { m_activeTextureUnit = textu
reUnit; } | 115 void setActiveTextureUnit(GC3Dint textureUnit) { m_activeTextureUnit = textu
reUnit; } |
116 | 116 |
117 bool multisample() const; | 117 bool multisample() const; |
118 | 118 |
119 Platform3DObject framebuffer() const; | 119 Platform3DObject framebuffer() const; |
120 | 120 |
121 void markContentsChanged(); | 121 void markContentsChanged(); |
122 | 122 |
123 WebKit::WebLayer* platformLayer(); | 123 blink::WebLayer* platformLayer(); |
124 void paintCompositedResultsToCanvas(ImageBuffer*); | 124 void paintCompositedResultsToCanvas(ImageBuffer*); |
125 | 125 |
126 // WebExternalTextureLayerClient implementation. | 126 // WebExternalTextureLayerClient implementation. |
127 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; | 127 virtual blink::WebGraphicsContext3D* context() OVERRIDE; |
128 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebE
xternalBitmap*) OVERRIDE; | 128 virtual bool prepareMailbox(blink::WebExternalTextureMailbox*, blink::WebExt
ernalBitmap*) OVERRIDE; |
129 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERR
IDE; | 129 virtual void mailboxReleased(const blink::WebExternalTextureMailbox&) OVERRI
DE; |
130 | 130 |
131 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject texture, GC3
Denum internalFormat, | 131 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject texture, GC3
Denum internalFormat, |
132 GC3Denum destType, GC3Dint level, bool premultiplyAlpha, bool flipY); | 132 GC3Denum destType, GC3Dint level, bool premultiplyAlpha, bool flipY); |
133 | 133 |
134 private: | 134 private: |
135 DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionS
upported, | 135 DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionS
upported, |
136 bool packedDepthStencilExtensionSupported, PreserveDrawingBuff
er, PassRefPtr<ContextEvictionManager>); | 136 bool packedDepthStencilExtensionSupported, PreserveDrawingBuff
er, PassRefPtr<ContextEvictionManager>); |
137 | 137 |
138 void initialize(const IntSize&); | 138 void initialize(const IntSize&); |
139 | 139 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // True if commit() has been called since the last time markContentsChanged(
) had been called. | 196 // True if commit() has been called since the last time markContentsChanged(
) had been called. |
197 bool m_contentsChangeCommitted; | 197 bool m_contentsChangeCommitted; |
198 | 198 |
199 GraphicsContext3D::Attributes m_attributes; | 199 GraphicsContext3D::Attributes m_attributes; |
200 unsigned m_internalColorFormat; | 200 unsigned m_internalColorFormat; |
201 unsigned m_colorFormat; | 201 unsigned m_colorFormat; |
202 unsigned m_internalRenderbufferFormat; | 202 unsigned m_internalRenderbufferFormat; |
203 int m_maxTextureSize; | 203 int m_maxTextureSize; |
204 | 204 |
205 OwnPtr<WebKit::WebExternalTextureLayer> m_layer; | 205 OwnPtr<blink::WebExternalTextureLayer> m_layer; |
206 | 206 |
207 // All of the mailboxes that this DrawingBuffer has ever created. | 207 // All of the mailboxes that this DrawingBuffer has ever created. |
208 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; | 208 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; |
209 // Mailboxes that were released by the compositor and can be used again by t
his DrawingBuffer. | 209 // Mailboxes that were released by the compositor and can be used again by t
his DrawingBuffer. |
210 Vector<RefPtr<MailboxInfo> > m_recycledMailboxes; | 210 Vector<RefPtr<MailboxInfo> > m_recycledMailboxes; |
211 RefPtr<MailboxInfo> m_lastColorBuffer; | 211 RefPtr<MailboxInfo> m_lastColorBuffer; |
212 | 212 |
213 RefPtr<ContextEvictionManager> m_contextEvictionManager; | 213 RefPtr<ContextEvictionManager> m_contextEvictionManager; |
214 }; | 214 }; |
215 | 215 |
216 } // namespace WebCore | 216 } // namespace WebCore |
217 | 217 |
218 #endif // DrawingBuffer_h | 218 #endif // DrawingBuffer_h |
OLD | NEW |