| 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 class WebGraphicsContext3DProvider; | 69 class WebGraphicsContext3DProvider; |
| 70 class WebLayer; | 70 class WebLayer; |
| 71 | 71 |
| 72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering | 72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering |
| 73 // results to a WebLayer for compositing. | 73 // results to a WebLayer for compositing. |
| 74 class PLATFORM_EXPORT DrawingBuffer : public NON_EXPORTED_BASE(cc::TextureLayerC
lient), public RefCounted<DrawingBuffer> { | 74 class PLATFORM_EXPORT DrawingBuffer : public NON_EXPORTED_BASE(cc::TextureLayerC
lient), public RefCounted<DrawingBuffer> { |
| 75 WTF_MAKE_NONCOPYABLE(DrawingBuffer); | 75 WTF_MAKE_NONCOPYABLE(DrawingBuffer); |
| 76 public: | 76 public: |
| 77 enum PreserveDrawingBuffer { | 77 enum PreserveDrawingBuffer { |
| 78 Preserve, | 78 Preserve, |
| 79 Discard | 79 Discard, |
| 80 }; | 80 }; |
| 81 enum WebGLVersion { | 81 enum WebGLVersion { |
| 82 WebGL1, | 82 WebGL1, |
| 83 WebGL2, | 83 WebGL2, |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 enum ChromiumImageUsage { |
| 87 AllowChromiumImage, |
| 88 DisallowChromiumImage, |
| 89 }; |
| 90 |
| 86 static PassRefPtr<DrawingBuffer> create( | 91 static PassRefPtr<DrawingBuffer> create( |
| 87 std::unique_ptr<WebGraphicsContext3DProvider>, | 92 std::unique_ptr<WebGraphicsContext3DProvider>, |
| 88 const IntSize&, | 93 const IntSize&, |
| 89 bool premultipliedAlpha, | 94 bool premultipliedAlpha, |
| 90 bool wantAlphaChannel, | 95 bool wantAlphaChannel, |
| 91 bool wantDepthBuffer, | 96 bool wantDepthBuffer, |
| 92 bool wantStencilBuffer, | 97 bool wantStencilBuffer, |
| 93 bool wantAntialiasing, | 98 bool wantAntialiasing, |
| 94 PreserveDrawingBuffer, | 99 PreserveDrawingBuffer, |
| 95 WebGLVersion); | 100 WebGLVersion, |
| 101 ChromiumImageUsage); |
| 96 static void forceNextDrawingBufferCreationToFail(); | 102 static void forceNextDrawingBufferCreationToFail(); |
| 97 | 103 |
| 98 ~DrawingBuffer() override; | 104 ~DrawingBuffer() override; |
| 99 | 105 |
| 100 // Destruction will be completed after all mailboxes are released. | 106 // Destruction will be completed after all mailboxes are released. |
| 101 void beginDestruction(); | 107 void beginDestruction(); |
| 102 | 108 |
| 103 // Issues a glClear() on all framebuffers associated with this DrawingBuffer
. The caller is responsible for | 109 // Issues a glClear() on all framebuffers associated with this DrawingBuffer
. The caller is responsible for |
| 104 // making the context current and setting the clear values and masks. Modifi
es the framebuffer binding. | 110 // making the context current and setting the clear values and masks. Modifi
es the framebuffer binding. |
| 105 void clearFramebuffers(GLbitfield clearMask); | 111 void clearFramebuffers(GLbitfield clearMask); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 protected: // For unittests | 260 protected: // For unittests |
| 255 DrawingBuffer( | 261 DrawingBuffer( |
| 256 std::unique_ptr<WebGraphicsContext3DProvider>, | 262 std::unique_ptr<WebGraphicsContext3DProvider>, |
| 257 std::unique_ptr<Extensions3DUtil>, | 263 std::unique_ptr<Extensions3DUtil>, |
| 258 bool discardFramebufferSupported, | 264 bool discardFramebufferSupported, |
| 259 bool wantAlphaChannel, | 265 bool wantAlphaChannel, |
| 260 bool premultipliedAlpha, | 266 bool premultipliedAlpha, |
| 261 PreserveDrawingBuffer, | 267 PreserveDrawingBuffer, |
| 262 WebGLVersion, | 268 WebGLVersion, |
| 263 bool wantsDepth, | 269 bool wantsDepth, |
| 264 bool wantsStencil); | 270 bool wantsStencil, |
| 271 ChromiumImageUsage); |
| 265 | 272 |
| 266 bool initialize(const IntSize&, bool useMultisampling); | 273 bool initialize(const IntSize&, bool useMultisampling); |
| 267 | 274 |
| 268 // Shared memory bitmaps that were released by the compositor and can be use
d again by this DrawingBuffer. | 275 // Shared memory bitmaps that were released by the compositor and can be use
d again by this DrawingBuffer. |
| 269 struct RecycledBitmap { | 276 struct RecycledBitmap { |
| 270 std::unique_ptr<cc::SharedBitmap> bitmap; | 277 std::unique_ptr<cc::SharedBitmap> bitmap; |
| 271 IntSize size; | 278 IntSize size; |
| 272 }; | 279 }; |
| 273 Vector<RecycledBitmap> m_recycledBitmaps; | 280 Vector<RecycledBitmap> m_recycledBitmaps; |
| 274 | 281 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 503 |
| 497 // If the width and height of the Canvas's backing store don't | 504 // If the width and height of the Canvas's backing store don't |
| 498 // match those that we were given in the most recent call to | 505 // match those that we were given in the most recent call to |
| 499 // reshape(), then we need an intermediate bitmap to read back the | 506 // reshape(), then we need an intermediate bitmap to read back the |
| 500 // frame buffer into. This seems to happen when CSS styles are | 507 // frame buffer into. This seems to happen when CSS styles are |
| 501 // used to resize the Canvas. | 508 // used to resize the Canvas. |
| 502 SkBitmap m_resizingBitmap; | 509 SkBitmap m_resizingBitmap; |
| 503 | 510 |
| 504 // Used to flip a bitmap vertically. | 511 // Used to flip a bitmap vertically. |
| 505 Vector<uint8_t> m_scanline; | 512 Vector<uint8_t> m_scanline; |
| 513 |
| 514 // In the case of OffscreenCanvas, we do not want to enable the WebGLImageCh
romium flag, |
| 515 // so we replace all the RuntimeEnabledFeatures::webGLImageChromiumEnabled()
call with |
| 516 // shouldUseChromiumImage() call, and set m_chromiumImageUsage to DisallowCh
romiumImage |
| 517 // in the case of OffscreenCanvas. |
| 518 ChromiumImageUsage m_chromiumImageUsage; |
| 519 bool shouldUseChromiumImage(); |
| 506 }; | 520 }; |
| 507 | 521 |
| 508 } // namespace blink | 522 } // namespace blink |
| 509 | 523 |
| 510 #endif // DrawingBuffer_h | 524 #endif // DrawingBuffer_h |
| OLD | NEW |