| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering | 69 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering |
| 70 // results to a WebLayer for compositing. | 70 // results to a WebLayer for compositing. |
| 71 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { | 71 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { |
| 72 WTF_MAKE_NONCOPYABLE(DrawingBuffer); | 72 WTF_MAKE_NONCOPYABLE(DrawingBuffer); |
| 73 public: | 73 public: |
| 74 enum PreserveDrawingBuffer { | 74 enum PreserveDrawingBuffer { |
| 75 Preserve, | 75 Preserve, |
| 76 Discard | 76 Discard |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 static PassRefPtr<DrawingBuffer> create(PassOwnPtr<WebGraphicsContext3DProvi
der>, const IntSize&, PreserveDrawingBuffer, WebGraphicsContext3D::Attributes re
questedAttributes); | 79 static PassRefPtr<DrawingBuffer> create(PassOwnPtr<WebGraphicsContext3DProvi
der>, const IntSize&, bool premultipliedAlpha, PreserveDrawingBuffer, WebGraphic
sContext3D::Attributes requestedAttributes); |
| 80 static void forceNextDrawingBufferCreationToFail(); | 80 static void forceNextDrawingBufferCreationToFail(); |
| 81 | 81 |
| 82 ~DrawingBuffer() override; | 82 ~DrawingBuffer() override; |
| 83 | 83 |
| 84 // Destruction will be completed after all mailboxes are released. | 84 // Destruction will be completed after all mailboxes are released. |
| 85 void beginDestruction(); | 85 void beginDestruction(); |
| 86 | 86 |
| 87 // Issues a glClear() on all framebuffers associated with this DrawingBuffer
. The caller is responsible for | 87 // Issues a glClear() on all framebuffers associated with this DrawingBuffer
. The caller is responsible for |
| 88 // making the context current and setting the clear values and masks. Modifi
es the framebuffer binding. | 88 // making the context current and setting the clear values and masks. Modifi
es the framebuffer binding. |
| 89 void clearFramebuffers(GLbitfield clearMask); | 89 void clearFramebuffers(GLbitfield clearMask); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void restoreFramebufferBindings(); | 178 void restoreFramebufferBindings(); |
| 179 | 179 |
| 180 void addNewMailboxCallback(PassOwnPtr<SameThreadClosure> closure) { m_newMai
lboxCallback = std::move(closure); } | 180 void addNewMailboxCallback(PassOwnPtr<SameThreadClosure> closure) { m_newMai
lboxCallback = std::move(closure); } |
| 181 | 181 |
| 182 protected: // For unittests | 182 protected: // For unittests |
| 183 DrawingBuffer( | 183 DrawingBuffer( |
| 184 PassOwnPtr<WebGraphicsContext3DProvider>, | 184 PassOwnPtr<WebGraphicsContext3DProvider>, |
| 185 PassOwnPtr<Extensions3DUtil>, | 185 PassOwnPtr<Extensions3DUtil>, |
| 186 bool multisampleExtensionSupported, | 186 bool multisampleExtensionSupported, |
| 187 bool discardFramebufferSupported, | 187 bool discardFramebufferSupported, |
| 188 bool premultipliedAlpha, |
| 188 PreserveDrawingBuffer, | 189 PreserveDrawingBuffer, |
| 189 WebGraphicsContext3D::Attributes requestedAttributes); | 190 WebGraphicsContext3D::Attributes requestedAttributes); |
| 190 | 191 |
| 191 bool initialize(const IntSize&); | 192 bool initialize(const IntSize&); |
| 192 | 193 |
| 193 private: | 194 private: |
| 194 struct TextureParameters { | 195 struct TextureParameters { |
| 195 DISALLOW_NEW(); | 196 DISALLOW_NEW(); |
| 196 GLenum target; | 197 GLenum target; |
| 197 GLenum internalColorFormat; | 198 GLenum internalColorFormat; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 GLenum m_activeTextureUnit; | 307 GLenum m_activeTextureUnit; |
| 307 | 308 |
| 308 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; | 309 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; |
| 309 WebGraphicsContext3D* m_context; // Lifetime is tied to the m_contextProvide
r. | 310 WebGraphicsContext3D* m_context; // Lifetime is tied to the m_contextProvide
r. |
| 310 gpu::gles2::GLES2Interface* m_gl; // Lifetime is tied to the m_contextProvid
er. | 311 gpu::gles2::GLES2Interface* m_gl; // Lifetime is tied to the m_contextProvid
er. |
| 311 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 312 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 312 IntSize m_size; | 313 IntSize m_size; |
| 313 WebGraphicsContext3D::Attributes m_requestedAttributes; | 314 WebGraphicsContext3D::Attributes m_requestedAttributes; |
| 314 bool m_multisampleExtensionSupported; | 315 bool m_multisampleExtensionSupported; |
| 315 bool m_discardFramebufferSupported; | 316 bool m_discardFramebufferSupported; |
| 317 bool m_premultipliedAlpha; |
| 316 GLuint m_fbo; | 318 GLuint m_fbo; |
| 317 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. | 319 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. |
| 318 TextureInfo m_colorBuffer; | 320 TextureInfo m_colorBuffer; |
| 319 struct FrontBufferInfo { | 321 struct FrontBufferInfo { |
| 320 TextureInfo texInfo; | 322 TextureInfo texInfo; |
| 321 WebExternalTextureMailbox mailbox; | 323 WebExternalTextureMailbox mailbox; |
| 322 }; | 324 }; |
| 323 FrontBufferInfo m_frontColorBuffer; | 325 FrontBufferInfo m_frontColorBuffer; |
| 324 | 326 |
| 325 OwnPtr<SameThreadClosure> m_newMailboxCallback; | 327 OwnPtr<SameThreadClosure> m_newMailboxCallback; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // used to resize the Canvas. | 371 // used to resize the Canvas. |
| 370 SkBitmap m_resizingBitmap; | 372 SkBitmap m_resizingBitmap; |
| 371 | 373 |
| 372 // Used to flip a bitmap vertically. | 374 // Used to flip a bitmap vertically. |
| 373 Vector<uint8_t> m_scanline; | 375 Vector<uint8_t> m_scanline; |
| 374 }; | 376 }; |
| 375 | 377 |
| 376 } // namespace blink | 378 } // namespace blink |
| 377 | 379 |
| 378 #endif // DrawingBuffer_h | 380 #endif // DrawingBuffer_h |
| OLD | NEW |