| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 PassOwnPtr<blink::WebGraphicsContext3D>, | 153 PassOwnPtr<blink::WebGraphicsContext3D>, |
| 154 PassOwnPtr<Extensions3DUtil>, | 154 PassOwnPtr<Extensions3DUtil>, |
| 155 bool multisampleExtensionSupported, | 155 bool multisampleExtensionSupported, |
| 156 bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer, PassRe
fPtr<ContextEvictionManager>); | 156 bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer, PassRe
fPtr<ContextEvictionManager>); |
| 157 | 157 |
| 158 bool initialize(const IntSize&); | 158 bool initialize(const IntSize&); |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 void mailboxReleasedWhileDestructionInProgress(const blink::WebExternalTextu
reMailbox&); | 161 void mailboxReleasedWhileDestructionInProgress(const blink::WebExternalTextu
reMailbox&); |
| 162 | 162 |
| 163 unsigned createColorTexture(const IntSize& size = IntSize()); | 163 unsigned createColorTexture(); |
| 164 // Create the depth/stencil and multisample buffers, if needed. | 164 // Create the depth/stencil and multisample buffers, if needed. |
| 165 void createSecondaryBuffers(); | 165 void createSecondaryBuffers(); |
| 166 bool resizeFramebuffer(const IntSize&); | 166 bool resizeFramebuffer(const IntSize&); |
| 167 bool resizeMultisampleFramebuffer(const IntSize&); | 167 bool resizeMultisampleFramebuffer(const IntSize&); |
| 168 void resizeDepthStencil(const IntSize&); | 168 void resizeDepthStencil(const IntSize&); |
| 169 | 169 |
| 170 // Bind to the m_framebufferBinding if it's not 0. | 170 // Bind to the m_framebufferBinding if it's not 0. |
| 171 void restoreFramebufferBinding(); | 171 void restoreFramebufferBinding(); |
| 172 | 172 |
| 173 void clearPlatformLayer(); | 173 void clearPlatformLayer(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 197 // Helper function which does a readback from the currently-bound | 197 // Helper function which does a readback from the currently-bound |
| 198 // framebuffer into a buffer of a certain size with 4-byte pixels. | 198 // framebuffer into a buffer of a certain size with 4-byte pixels. |
| 199 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); | 199 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); |
| 200 | 200 |
| 201 // Helper function to flip a bitmap vertically. | 201 // Helper function to flip a bitmap vertically. |
| 202 void flipVertically(uint8_t* data, int width, int height); | 202 void flipVertically(uint8_t* data, int width, int height); |
| 203 | 203 |
| 204 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. | 204 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. |
| 205 // By default, alignment is 4, the OpenGL default setting. | 205 // By default, alignment is 4, the OpenGL default setting. |
| 206 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); | 206 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); |
| 207 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. |
| 208 void allocateTextureMemory(Platform3DObject textureId, const IntSize&); |
| 209 void deleteChromiumImageForTexture(Platform3DObject textureId); |
| 207 | 210 |
| 208 PreserveDrawingBuffer m_preserveDrawingBuffer; | 211 PreserveDrawingBuffer m_preserveDrawingBuffer; |
| 209 bool m_scissorEnabled; | 212 bool m_scissorEnabled; |
| 210 Platform3DObject m_texture2DBinding; | 213 Platform3DObject m_texture2DBinding; |
| 211 Platform3DObject m_framebufferBinding; | 214 Platform3DObject m_framebufferBinding; |
| 212 GLenum m_activeTextureUnit; | 215 GLenum m_activeTextureUnit; |
| 213 | 216 |
| 214 OwnPtr<blink::WebGraphicsContext3D> m_context; | 217 OwnPtr<blink::WebGraphicsContext3D> m_context; |
| 215 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 218 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 216 IntSize m_size; | 219 IntSize m_size; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 int m_sampleCount; | 258 int m_sampleCount; |
| 256 int m_packAlignment; | 259 int m_packAlignment; |
| 257 bool m_destructionInProgress; | 260 bool m_destructionInProgress; |
| 258 | 261 |
| 259 OwnPtr<blink::WebExternalTextureLayer> m_layer; | 262 OwnPtr<blink::WebExternalTextureLayer> m_layer; |
| 260 | 263 |
| 261 // All of the mailboxes that this DrawingBuffer has ever created. | 264 // All of the mailboxes that this DrawingBuffer has ever created. |
| 262 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; | 265 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; |
| 263 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. | 266 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. |
| 264 Deque<blink::WebExternalTextureMailbox> m_recycledMailboxQueue; | 267 Deque<blink::WebExternalTextureMailbox> m_recycledMailboxQueue; |
| 268 // If we used CHROMIUM_image as the backing storage for our buffers, |
| 269 // we need to know the mapping from texture id to image. |
| 270 HashMap<Platform3DObject, blink::WGC3Duint> m_textureToImageChromiumMap; |
| 265 | 271 |
| 266 RefPtr<ContextEvictionManager> m_contextEvictionManager; | 272 RefPtr<ContextEvictionManager> m_contextEvictionManager; |
| 267 | 273 |
| 268 // If the width and height of the Canvas's backing store don't | 274 // If the width and height of the Canvas's backing store don't |
| 269 // match those that we were given in the most recent call to | 275 // match those that we were given in the most recent call to |
| 270 // reshape(), then we need an intermediate bitmap to read back the | 276 // reshape(), then we need an intermediate bitmap to read back the |
| 271 // frame buffer into. This seems to happen when CSS styles are | 277 // frame buffer into. This seems to happen when CSS styles are |
| 272 // used to resize the Canvas. | 278 // used to resize the Canvas. |
| 273 SkBitmap m_resizingBitmap; | 279 SkBitmap m_resizingBitmap; |
| 274 | 280 |
| 275 // Used to flip a bitmap vertically. | 281 // Used to flip a bitmap vertically. |
| 276 Vector<uint8_t> m_scanline; | 282 Vector<uint8_t> m_scanline; |
| 277 }; | 283 }; |
| 278 | 284 |
| 279 } // namespace WebCore | 285 } // namespace WebCore |
| 280 | 286 |
| 281 #endif // DrawingBuffer_h | 287 #endif // DrawingBuffer_h |
| OLD | NEW |