| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 GLenum creationInternalColorFormat = 0; | 246 GLenum creationInternalColorFormat = 0; |
| 247 GLenum colorFormat = 0; | 247 GLenum colorFormat = 0; |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 // If we used CHROMIUM_image as the backing storage for our buffers, | 250 // If we used CHROMIUM_image as the backing storage for our buffers, |
| 251 // we need to know the mapping from texture id to image. | 251 // we need to know the mapping from texture id to image. |
| 252 struct TextureInfo { | 252 struct TextureInfo { |
| 253 DISALLOW_NEW(); | 253 DISALLOW_NEW(); |
| 254 GLuint textureId = 0; | 254 GLuint textureId = 0; |
| 255 GLuint imageId = 0; | 255 GLuint imageId = 0; |
| 256 bool immutable = false; |
| 256 | 257 |
| 257 // A GpuMemoryBuffer is a concept that the compositor understands. and | 258 // A GpuMemoryBuffer is a concept that the compositor understands. and |
| 258 // is able to operate on. The id is scoped to renderer process. | 259 // is able to operate on. The id is scoped to renderer process. |
| 259 GLint gpuMemoryBufferId = -1; | 260 GLint gpuMemoryBufferId = -1; |
| 260 | 261 |
| 261 TextureParameters parameters; | 262 TextureParameters parameters; |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 struct MailboxInfo : public RefCounted<MailboxInfo> { | 265 struct MailboxInfo : public RefCounted<MailboxInfo> { |
| 265 WTF_MAKE_NONCOPYABLE(MailboxInfo); | 266 WTF_MAKE_NONCOPYABLE(MailboxInfo); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 ReadbackSkia | 315 ReadbackSkia |
| 315 }; | 316 }; |
| 316 | 317 |
| 317 // Helper function which does a readback from the currently-bound | 318 // Helper function which does a readback from the currently-bound |
| 318 // framebuffer into a buffer of a certain size with 4-byte pixels. | 319 // framebuffer into a buffer of a certain size with 4-byte pixels. |
| 319 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); | 320 void readBackFramebuffer(unsigned char* pixels, int width, int height, Readb
ackOrder, WebGLImageConversion::AlphaOp); |
| 320 | 321 |
| 321 // Helper function to flip a bitmap vertically. | 322 // Helper function to flip a bitmap vertically. |
| 322 void flipVertically(uint8_t* data, int width, int height); | 323 void flipVertically(uint8_t* data, int width, int height); |
| 323 | 324 |
| 324 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. | 325 // Create a storage texture if possible. |
| 325 // By default, alignment is 4, the OpenGL default setting. | 326 // Return true if a storage texture is created. |
| 326 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); | 327 // Return false if a regular texture is created. |
| 328 bool createStorageTextureIfPossible(GLenum target, GLenum internalformat, GL
sizei width, GLsizei height, GLint border, GLenum format, GLenum type); |
| 327 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. | 329 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. |
| 328 void deleteChromiumImageForTexture(TextureInfo*); | 330 void deleteChromiumImageForTexture(TextureInfo*); |
| 329 | 331 |
| 330 // If RGB emulation is required, then the CHROMIUM image's alpha channel | 332 // If RGB emulation is required, then the CHROMIUM image's alpha channel |
| 331 // must be immediately cleared after it is bound to a texture. Nothing | 333 // must be immediately cleared after it is bound to a texture. Nothing |
| 332 // should be allowed to change the alpha channel after this. | 334 // should be allowed to change the alpha channel after this. |
| 333 void clearChromiumImageAlpha(const TextureInfo&); | 335 void clearChromiumImageAlpha(const TextureInfo&); |
| 334 | 336 |
| 335 // Tries to create a CHROMIUM_image backed texture if | 337 // Tries to create a CHROMIUM_image backed texture if |
| 336 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure, | 338 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 371 |
| 370 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; | 372 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; |
| 371 // Lifetime is tied to the m_contextProvider. | 373 // Lifetime is tied to the m_contextProvider. |
| 372 gpu::gles2::GLES2Interface* m_gl; | 374 gpu::gles2::GLES2Interface* m_gl; |
| 373 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; | 375 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; |
| 374 IntSize m_size = { -1, -1 }; | 376 IntSize m_size = { -1, -1 }; |
| 375 const bool m_discardFramebufferSupported; | 377 const bool m_discardFramebufferSupported; |
| 376 const bool m_wantAlphaChannel; | 378 const bool m_wantAlphaChannel; |
| 377 const bool m_premultipliedAlpha; | 379 const bool m_premultipliedAlpha; |
| 378 bool m_hasImplicitStencilBuffer = false; | 380 bool m_hasImplicitStencilBuffer = false; |
| 381 bool m_storageTextureSupported = false; |
| 379 struct FrontBufferInfo { | 382 struct FrontBufferInfo { |
| 380 TextureInfo texInfo; | 383 TextureInfo texInfo; |
| 381 WebExternalTextureMailbox mailbox; | 384 WebExternalTextureMailbox mailbox; |
| 382 }; | 385 }; |
| 383 FrontBufferInfo m_frontColorBuffer; | 386 FrontBufferInfo m_frontColorBuffer; |
| 384 | 387 |
| 385 std::unique_ptr<WTF::Closure> m_newMailboxCallback; | 388 std::unique_ptr<WTF::Closure> m_newMailboxCallback; |
| 386 | 389 |
| 387 // This is used when the user requests either a depth or stencil buffer. | 390 // This is used when the user requests either a depth or stencil buffer. |
| 388 GLuint m_depthStencilBuffer = 0; | 391 GLuint m_depthStencilBuffer = 0; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 // used to resize the Canvas. | 447 // used to resize the Canvas. |
| 445 SkBitmap m_resizingBitmap; | 448 SkBitmap m_resizingBitmap; |
| 446 | 449 |
| 447 // Used to flip a bitmap vertically. | 450 // Used to flip a bitmap vertically. |
| 448 Vector<uint8_t> m_scanline; | 451 Vector<uint8_t> m_scanline; |
| 449 }; | 452 }; |
| 450 | 453 |
| 451 } // namespace blink | 454 } // namespace blink |
| 452 | 455 |
| 453 #endif // DrawingBuffer_h | 456 #endif // DrawingBuffer_h |
| OLD | NEW |