| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // texture. | 135 // texture. |
| 136 void setActiveTextureUnit(GLint textureUnit) { m_activeTextureUnit = texture
Unit; } | 136 void setActiveTextureUnit(GLint textureUnit) { m_activeTextureUnit = texture
Unit; } |
| 137 | 137 |
| 138 bool multisample() const; | 138 bool multisample() const; |
| 139 | 139 |
| 140 Platform3DObject framebuffer() const; | 140 Platform3DObject framebuffer() const; |
| 141 | 141 |
| 142 void markContentsChanged(); | 142 void markContentsChanged(); |
| 143 void markLayerComposited(); | 143 void markLayerComposited(); |
| 144 bool layerComposited() const; | 144 bool layerComposited() const; |
| 145 void setIsHidden(bool); | |
| 146 | 145 |
| 147 blink::WebLayer* platformLayer(); | 146 blink::WebLayer* platformLayer(); |
| 148 void paintCompositedResultsToCanvas(ImageBuffer*); | 147 void paintCompositedResultsToCanvas(ImageBuffer*); |
| 149 | 148 |
| 150 blink::WebGraphicsContext3D* context(); | 149 blink::WebGraphicsContext3D* context(); |
| 151 | 150 |
| 152 // Returns the actual context attributes for this drawing buffer which may d
iffer from the | 151 // Returns the actual context attributes for this drawing buffer which may d
iffer from the |
| 153 // requested context attributes due to implementation limits. | 152 // requested context attributes due to implementation limits. |
| 154 blink::WebGraphicsContext3D::Attributes getActualAttributes() const { return
m_actualAttributes; } | 153 blink::WebGraphicsContext3D::Attributes getActualAttributes() const { return
m_actualAttributes; } |
| 155 | 154 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 172 PassOwnPtr<Extensions3DUtil>, | 171 PassOwnPtr<Extensions3DUtil>, |
| 173 bool multisampleExtensionSupported, | 172 bool multisampleExtensionSupported, |
| 174 bool packedDepthStencilExtensionSupported, | 173 bool packedDepthStencilExtensionSupported, |
| 175 PreserveDrawingBuffer, | 174 PreserveDrawingBuffer, |
| 176 blink::WebGraphicsContext3D::Attributes requestedAttributes, | 175 blink::WebGraphicsContext3D::Attributes requestedAttributes, |
| 177 PassRefPtr<ContextEvictionManager>); | 176 PassRefPtr<ContextEvictionManager>); |
| 178 | 177 |
| 179 bool initialize(const IntSize&); | 178 bool initialize(const IntSize&); |
| 180 | 179 |
| 181 private: | 180 private: |
| 182 void mailboxReleasedWithoutRecycling(const blink::WebExternalTextureMailbox&
); | 181 void mailboxReleasedWhileDestructionInProgress(const blink::WebExternalTextu
reMailbox&); |
| 183 | 182 |
| 184 unsigned createColorTexture(); | 183 unsigned createColorTexture(); |
| 185 // Create the depth/stencil and multisample buffers, if needed. | 184 // Create the depth/stencil and multisample buffers, if needed. |
| 186 void createSecondaryBuffers(); | 185 void createSecondaryBuffers(); |
| 187 bool resizeFramebuffer(const IntSize&); | 186 bool resizeFramebuffer(const IntSize&); |
| 188 bool resizeMultisampleFramebuffer(const IntSize&); | 187 bool resizeMultisampleFramebuffer(const IntSize&); |
| 189 void resizeDepthStencil(const IntSize&); | 188 void resizeDepthStencil(const IntSize&); |
| 190 | 189 |
| 191 // Bind to the m_framebufferBinding if it's not 0. | 190 // Bind to the m_framebufferBinding if it's not 0. |
| 192 void restoreFramebufferBinding(); | 191 void restoreFramebufferBinding(); |
| 193 | 192 |
| 194 void clearPlatformLayer(); | 193 void clearPlatformLayer(); |
| 195 | 194 |
| 196 PassRefPtr<MailboxInfo> recycledMailbox(); | 195 PassRefPtr<MailboxInfo> recycledMailbox(); |
| 197 PassRefPtr<MailboxInfo> createNewMailbox(const TextureInfo&); | 196 PassRefPtr<MailboxInfo> createNewMailbox(const TextureInfo&); |
| 198 void deleteMailbox(const blink::WebExternalTextureMailbox&); | 197 void deleteMailbox(const blink::WebExternalTextureMailbox&); |
| 199 void freeRecycledMailboxes(); | |
| 200 | 198 |
| 201 // Updates the current size of the buffer, ensuring that s_currentResourceUs
ePixels is updated. | 199 // Updates the current size of the buffer, ensuring that s_currentResourceUs
ePixels is updated. |
| 202 void setSize(const IntSize& size); | 200 void setSize(const IntSize& size); |
| 203 | 201 |
| 204 // Calculates the difference in pixels between the current buffer size and t
he proposed size. | 202 // Calculates the difference in pixels between the current buffer size and t
he proposed size. |
| 205 static int pixelDelta(const IntSize& newSize, const IntSize& curSize); | 203 static int pixelDelta(const IntSize& newSize, const IntSize& curSize); |
| 206 | 204 |
| 207 // Given the desired buffer size, provides the largest dimensions that will
fit in the pixel budget | 205 // Given the desired buffer size, provides the largest dimensions that will
fit in the pixel budget |
| 208 // Returns true if the buffer will only fit if the oldest WebGL context is f
orcibly lost | 206 // Returns true if the buffer will only fit if the oldest WebGL context is f
orcibly lost |
| 209 IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); | 207 IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 MultisampleMode m_multisampleMode; | 272 MultisampleMode m_multisampleMode; |
| 275 | 273 |
| 276 blink::WebGraphicsContext3D::Attributes m_actualAttributes; | 274 blink::WebGraphicsContext3D::Attributes m_actualAttributes; |
| 277 unsigned m_internalColorFormat; | 275 unsigned m_internalColorFormat; |
| 278 unsigned m_colorFormat; | 276 unsigned m_colorFormat; |
| 279 unsigned m_internalRenderbufferFormat; | 277 unsigned m_internalRenderbufferFormat; |
| 280 int m_maxTextureSize; | 278 int m_maxTextureSize; |
| 281 int m_sampleCount; | 279 int m_sampleCount; |
| 282 int m_packAlignment; | 280 int m_packAlignment; |
| 283 bool m_destructionInProgress; | 281 bool m_destructionInProgress; |
| 284 bool m_isHidden; | |
| 285 | 282 |
| 286 OwnPtr<blink::WebExternalTextureLayer> m_layer; | 283 OwnPtr<blink::WebExternalTextureLayer> m_layer; |
| 287 | 284 |
| 288 // All of the mailboxes that this DrawingBuffer has ever created. | 285 // All of the mailboxes that this DrawingBuffer has ever created. |
| 289 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; | 286 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; |
| 290 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. | 287 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. |
| 291 Deque<blink::WebExternalTextureMailbox> m_recycledMailboxQueue; | 288 Deque<blink::WebExternalTextureMailbox> m_recycledMailboxQueue; |
| 292 | 289 |
| 293 RefPtr<ContextEvictionManager> m_contextEvictionManager; | 290 RefPtr<ContextEvictionManager> m_contextEvictionManager; |
| 294 | 291 |
| 295 // If the width and height of the Canvas's backing store don't | 292 // If the width and height of the Canvas's backing store don't |
| 296 // match those that we were given in the most recent call to | 293 // match those that we were given in the most recent call to |
| 297 // reshape(), then we need an intermediate bitmap to read back the | 294 // reshape(), then we need an intermediate bitmap to read back the |
| 298 // frame buffer into. This seems to happen when CSS styles are | 295 // frame buffer into. This seems to happen when CSS styles are |
| 299 // used to resize the Canvas. | 296 // used to resize the Canvas. |
| 300 SkBitmap m_resizingBitmap; | 297 SkBitmap m_resizingBitmap; |
| 301 | 298 |
| 302 // Used to flip a bitmap vertically. | 299 // Used to flip a bitmap vertically. |
| 303 Vector<uint8_t> m_scanline; | 300 Vector<uint8_t> m_scanline; |
| 304 }; | 301 }; |
| 305 | 302 |
| 306 } // namespace WebCore | 303 } // namespace WebCore |
| 307 | 304 |
| 308 #endif // DrawingBuffer_h | 305 #endif // DrawingBuffer_h |
| OLD | NEW |