| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 class WebLayer; | 62 class WebLayer; |
| 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 WebLayer for compositing. | 65 // results to a WebLayer for compositing. |
| 66 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { | 66 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { |
| 67 // If we used CHROMIUM_image as the backing storage for our buffers, | 67 // If we used CHROMIUM_image as the backing storage for our buffers, |
| 68 // we need to know the mapping from texture id to image. | 68 // we need to know the mapping from texture id to image. |
| 69 struct TextureInfo { | 69 struct TextureInfo { |
| 70 Platform3DObject textureId; | 70 Platform3DObject textureId; |
| 71 WGC3Duint imageId; | 71 WGC3Duint imageId; |
| 72 bool immutable; |
| 72 | 73 |
| 73 TextureInfo() | 74 TextureInfo() |
| 74 : textureId(0) | 75 : textureId(0) |
| 75 , imageId(0) | 76 , imageId(0) |
| 77 , immutable(false) |
| 76 { | 78 { |
| 77 } | 79 } |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 struct MailboxInfo : public RefCounted<MailboxInfo> { | 82 struct MailboxInfo : public RefCounted<MailboxInfo> { |
| 81 WebExternalTextureMailbox mailbox; | 83 WebExternalTextureMailbox mailbox; |
| 82 TextureInfo textureInfo; | 84 TextureInfo textureInfo; |
| 83 IntSize size; | 85 IntSize size; |
| 84 // This keeps the parent drawing buffer alive as long as the compositor
is | 86 // This keeps the parent drawing buffer alive as long as the compositor
is |
| 85 // referring to one of the mailboxes DrawingBuffer produced. The parent
drawing buffer is | 87 // referring to one of the mailboxes DrawingBuffer produced. The parent
drawing buffer is |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 ReadbackSkia | 225 ReadbackSkia |
| 224 }; | 226 }; |
| 225 | 227 |
| 226 // Helper function which does a readback from the currently-bound | 228 // Helper function which does a readback from the currently-bound |
| 227 // framebuffer into a buffer of a certain size with 4-byte pixels. | 229 // framebuffer into a buffer of a certain size with 4-byte pixels. |
| 228 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); | 230 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); |
| 229 | 231 |
| 230 // Helper function to flip a bitmap vertically. | 232 // Helper function to flip a bitmap vertically. |
| 231 void flipVertically(uint8_t* data, int width, int height); | 233 void flipVertically(uint8_t* data, int width, int height); |
| 232 | 234 |
| 233 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. | |
| 234 // By default, alignment is 4, the OpenGL default setting. | |
| 235 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); | |
| 236 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. | 235 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. |
| 237 void allocateTextureMemory(TextureInfo*, const IntSize&); | 236 void allocateTextureMemory(TextureInfo*, const IntSize&); |
| 238 void deleteChromiumImageForTexture(TextureInfo*); | 237 void deleteChromiumImageForTexture(TextureInfo*); |
| 239 | 238 |
| 240 PreserveDrawingBuffer m_preserveDrawingBuffer; | 239 PreserveDrawingBuffer m_preserveDrawingBuffer; |
| 241 bool m_scissorEnabled; | 240 bool m_scissorEnabled; |
| 242 Platform3DObject m_texture2DBinding; | 241 Platform3DObject m_texture2DBinding; |
| 243 Platform3DObject m_drawFramebufferBinding; | 242 Platform3DObject m_drawFramebufferBinding; |
| 244 Platform3DObject m_readFramebufferBinding; | 243 Platform3DObject m_readFramebufferBinding; |
| 245 GLenum m_activeTextureUnit; | 244 GLenum m_activeTextureUnit; |
| 246 | 245 |
| 247 OwnPtr<WebGraphicsContext3D> m_context; | 246 OwnPtr<WebGraphicsContext3D> m_context; |
| 248 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 247 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 249 IntSize m_size; | 248 IntSize m_size; |
| 250 WebGraphicsContext3D::Attributes m_requestedAttributes; | 249 WebGraphicsContext3D::Attributes m_requestedAttributes; |
| 251 bool m_multisampleExtensionSupported; | 250 bool m_multisampleExtensionSupported; |
| 252 bool m_packedDepthStencilExtensionSupported; | 251 bool m_packedDepthStencilExtensionSupported; |
| 253 bool m_discardFramebufferSupported; | 252 bool m_discardFramebufferSupported; |
| 253 bool m_storageTextureSupported; |
| 254 Platform3DObject m_fbo; | 254 Platform3DObject m_fbo; |
| 255 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. | 255 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. |
| 256 TextureInfo m_colorBuffer; | 256 TextureInfo m_colorBuffer; |
| 257 struct FrontBufferInfo { | 257 struct FrontBufferInfo { |
| 258 TextureInfo texInfo; | 258 TextureInfo texInfo; |
| 259 WebExternalTextureMailbox mailbox; | 259 WebExternalTextureMailbox mailbox; |
| 260 }; | 260 }; |
| 261 FrontBufferInfo m_frontColorBuffer; | 261 FrontBufferInfo m_frontColorBuffer; |
| 262 | 262 |
| 263 // This is used when we have OES_packed_depth_stencil. | 263 // This is used when we have OES_packed_depth_stencil. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // used to resize the Canvas. | 312 // used to resize the Canvas. |
| 313 SkBitmap m_resizingBitmap; | 313 SkBitmap m_resizingBitmap; |
| 314 | 314 |
| 315 // Used to flip a bitmap vertically. | 315 // Used to flip a bitmap vertically. |
| 316 Vector<uint8_t> m_scanline; | 316 Vector<uint8_t> m_scanline; |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 } // namespace blink | 319 } // namespace blink |
| 320 | 320 |
| 321 #endif // DrawingBuffer_h | 321 #endif // DrawingBuffer_h |
| OLD | NEW |