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; | |
73 | 72 |
74 TextureInfo() | 73 TextureInfo() |
75 : textureId(0) | 74 : textureId(0) |
76 , imageId(0) | 75 , imageId(0) |
77 , immutable(false) | |
78 { | 76 { |
79 } | 77 } |
80 }; | 78 }; |
81 | 79 |
82 struct MailboxInfo : public RefCounted<MailboxInfo> { | 80 struct MailboxInfo : public RefCounted<MailboxInfo> { |
83 WebExternalTextureMailbox mailbox; | 81 WebExternalTextureMailbox mailbox; |
84 TextureInfo textureInfo; | 82 TextureInfo textureInfo; |
85 IntSize size; | 83 IntSize size; |
86 // This keeps the parent drawing buffer alive as long as the compositor
is | 84 // This keeps the parent drawing buffer alive as long as the compositor
is |
87 // referring to one of the mailboxes DrawingBuffer produced. The parent
drawing buffer is | 85 // 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... |
225 ReadbackSkia | 223 ReadbackSkia |
226 }; | 224 }; |
227 | 225 |
228 // Helper function which does a readback from the currently-bound | 226 // Helper function which does a readback from the currently-bound |
229 // framebuffer into a buffer of a certain size with 4-byte pixels. | 227 // framebuffer into a buffer of a certain size with 4-byte pixels. |
230 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); | 228 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); |
231 | 229 |
232 // Helper function to flip a bitmap vertically. | 230 // Helper function to flip a bitmap vertically. |
233 void flipVertically(uint8_t* data, int width, int height); | 231 void flipVertically(uint8_t* data, int width, int height); |
234 | 232 |
| 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); |
235 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. | 236 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. |
236 void allocateTextureMemory(TextureInfo*, const IntSize&); | 237 void allocateTextureMemory(TextureInfo*, const IntSize&); |
237 void deleteChromiumImageForTexture(TextureInfo*); | 238 void deleteChromiumImageForTexture(TextureInfo*); |
238 | 239 |
239 PreserveDrawingBuffer m_preserveDrawingBuffer; | 240 PreserveDrawingBuffer m_preserveDrawingBuffer; |
240 bool m_scissorEnabled; | 241 bool m_scissorEnabled; |
241 Platform3DObject m_texture2DBinding; | 242 Platform3DObject m_texture2DBinding; |
242 Platform3DObject m_drawFramebufferBinding; | 243 Platform3DObject m_drawFramebufferBinding; |
243 Platform3DObject m_readFramebufferBinding; | 244 Platform3DObject m_readFramebufferBinding; |
244 GLenum m_activeTextureUnit; | 245 GLenum m_activeTextureUnit; |
245 | 246 |
246 OwnPtr<WebGraphicsContext3D> m_context; | 247 OwnPtr<WebGraphicsContext3D> m_context; |
247 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 248 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
248 IntSize m_size; | 249 IntSize m_size; |
249 WebGraphicsContext3D::Attributes m_requestedAttributes; | 250 WebGraphicsContext3D::Attributes m_requestedAttributes; |
250 bool m_multisampleExtensionSupported; | 251 bool m_multisampleExtensionSupported; |
251 bool m_packedDepthStencilExtensionSupported; | 252 bool m_packedDepthStencilExtensionSupported; |
252 bool m_discardFramebufferSupported; | 253 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 |