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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef DrawingBuffer_h | 31 #ifndef DrawingBuffer_h |
32 #define DrawingBuffer_h | 32 #define DrawingBuffer_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsTypes3D.h" | 36 #include "platform/graphics/GraphicsTypes3D.h" |
37 #include "platform/graphics/gpu/WebGLImageConversion.h" | 37 #include "platform/graphics/gpu/WebGLImageConversion.h" |
38 #include "public/platform/WebExternalTextureLayerClient.h" | 38 #include "public/platform/WebExternalTextureLayerClient.h" |
39 #include "public/platform/WebExternalTextureMailbox.h" | 39 #include "public/platform/WebExternalTextureMailbox.h" |
40 #include "public/platform/WebGraphicsContext3D.h" | |
41 #include "third_party/khronos/GLES2/gl2.h" | 40 #include "third_party/khronos/GLES2/gl2.h" |
42 #include "third_party/khronos/GLES2/gl2ext.h" | 41 #include "third_party/khronos/GLES2/gl2ext.h" |
43 #include "third_party/skia/include/core/SkBitmap.h" | 42 #include "third_party/skia/include/core/SkBitmap.h" |
44 #include "wtf/Deque.h" | 43 #include "wtf/Deque.h" |
45 #include "wtf/Noncopyable.h" | 44 #include "wtf/Noncopyable.h" |
46 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
47 #include "wtf/PassOwnPtr.h" | 46 #include "wtf/PassOwnPtr.h" |
48 #include "wtf/RefCounted.h" | 47 #include "wtf/RefCounted.h" |
49 | 48 |
50 namespace gpu { | 49 namespace gpu { |
51 namespace gles2 { | 50 namespace gles2 { |
52 class GLES2Interface; | 51 class GLES2Interface; |
53 } | 52 } |
54 } | 53 } |
55 | 54 |
56 namespace WTF { | 55 namespace WTF { |
57 class ArrayBufferContents; | 56 class ArrayBufferContents; |
58 } | 57 } |
59 | 58 |
60 namespace blink { | 59 namespace blink { |
61 | 60 |
62 class Extensions3DUtil; | 61 class Extensions3DUtil; |
63 class ImageBuffer; | 62 class ImageBuffer; |
64 class WebExternalBitmap; | 63 class WebExternalBitmap; |
65 class WebExternalTextureLayer; | 64 class WebExternalTextureLayer; |
66 class WebGraphicsContext3D; | |
67 class WebGraphicsContext3DProvider; | 65 class WebGraphicsContext3DProvider; |
68 class WebLayer; | 66 class WebLayer; |
69 | 67 |
70 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering | 68 // Manages a rendering target (framebuffer + attachment) for a canvas. Can publ
ish its rendering |
71 // results to a WebLayer for compositing. | 69 // results to a WebLayer for compositing. |
72 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { | 70 class PLATFORM_EXPORT DrawingBuffer : public RefCounted<DrawingBuffer>, public W
ebExternalTextureLayerClient { |
73 WTF_MAKE_NONCOPYABLE(DrawingBuffer); | 71 WTF_MAKE_NONCOPYABLE(DrawingBuffer); |
74 public: | 72 public: |
75 enum PreserveDrawingBuffer { | 73 enum PreserveDrawingBuffer { |
76 Preserve, | 74 Preserve, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 bool discardFramebufferSupported() const { return m_discardFramebufferSuppor
ted; } | 152 bool discardFramebufferSupported() const { return m_discardFramebufferSuppor
ted; } |
155 | 153 |
156 void markContentsChanged(); | 154 void markContentsChanged(); |
157 void setBufferClearNeeded(bool); | 155 void setBufferClearNeeded(bool); |
158 bool bufferClearNeeded() const; | 156 bool bufferClearNeeded() const; |
159 void setIsHidden(bool); | 157 void setIsHidden(bool); |
160 void setFilterQuality(SkFilterQuality); | 158 void setFilterQuality(SkFilterQuality); |
161 | 159 |
162 WebLayer* platformLayer(); | 160 WebLayer* platformLayer(); |
163 | 161 |
164 WebGraphicsContext3D* context(); | |
165 gpu::gles2::GLES2Interface* contextGL(); | 162 gpu::gles2::GLES2Interface* contextGL(); |
166 WebGraphicsContext3DProvider* contextProvider(); | 163 WebGraphicsContext3DProvider* contextProvider(); |
167 | 164 |
168 // WebExternalTextureLayerClient implementation. | 165 // WebExternalTextureLayerClient implementation. |
169 bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override
; | 166 bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override
; |
170 void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource = f
alse) override; | 167 void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource = f
alse) override; |
171 | 168 |
172 // Destroys the TEXTURE_2D binding for the owned context | 169 // Destroys the TEXTURE_2D binding for the owned context |
173 bool copyToPlatformTexture(WebGraphicsContext3D*, gpu::gles2::GLES2Interface
*, GLuint texture, GLenum internalFormat, | 170 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, GLuint texture, GLen
um internalFormat, |
174 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD
rawingBuffer); | 171 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD
rawingBuffer); |
175 | 172 |
176 void setPackAlignment(GLint param); | 173 void setPackAlignment(GLint param); |
177 | 174 |
178 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF::
ArrayBufferContents&); | 175 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF::
ArrayBufferContents&); |
179 | 176 |
180 int sampleCount() const { return m_sampleCount; } | 177 int sampleCount() const { return m_sampleCount; } |
181 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode ==
MSAAExplicitResolve; } | 178 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode ==
MSAAExplicitResolve; } |
182 | 179 |
183 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not
0. | 180 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not
0. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 void attachColorBufferToCurrentFBO(); | 303 void attachColorBufferToCurrentFBO(); |
307 | 304 |
308 const PreserveDrawingBuffer m_preserveDrawingBuffer; | 305 const PreserveDrawingBuffer m_preserveDrawingBuffer; |
309 bool m_scissorEnabled; | 306 bool m_scissorEnabled; |
310 GLuint m_texture2DBinding; | 307 GLuint m_texture2DBinding; |
311 GLuint m_drawFramebufferBinding; | 308 GLuint m_drawFramebufferBinding; |
312 GLuint m_readFramebufferBinding; | 309 GLuint m_readFramebufferBinding; |
313 GLenum m_activeTextureUnit; | 310 GLenum m_activeTextureUnit; |
314 | 311 |
315 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; | 312 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; |
316 WebGraphicsContext3D* m_context; // Lifetime is tied to the m_contextProvide
r. | 313 // Lifetime is tied to the m_contextProvider. |
317 gpu::gles2::GLES2Interface* m_gl; // Lifetime is tied to the m_contextProvid
er. | 314 gpu::gles2::GLES2Interface* m_gl; |
318 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 315 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
319 IntSize m_size; | 316 IntSize m_size; |
320 const bool m_discardFramebufferSupported; | 317 const bool m_discardFramebufferSupported; |
321 const bool m_wantAlphaChannel; | 318 const bool m_wantAlphaChannel; |
322 const bool m_premultipliedAlpha; | 319 const bool m_premultipliedAlpha; |
323 bool m_hasImplicitStencilBuffer; | 320 bool m_hasImplicitStencilBuffer; |
324 GLuint m_fbo; | 321 GLuint m_fbo; |
325 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. | 322 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. |
326 TextureInfo m_colorBuffer; | 323 TextureInfo m_colorBuffer; |
327 struct FrontBufferInfo { | 324 struct FrontBufferInfo { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // used to resize the Canvas. | 373 // used to resize the Canvas. |
377 SkBitmap m_resizingBitmap; | 374 SkBitmap m_resizingBitmap; |
378 | 375 |
379 // Used to flip a bitmap vertically. | 376 // Used to flip a bitmap vertically. |
380 Vector<uint8_t> m_scanline; | 377 Vector<uint8_t> m_scanline; |
381 }; | 378 }; |
382 | 379 |
383 } // namespace blink | 380 } // namespace blink |
384 | 381 |
385 #endif // DrawingBuffer_h | 382 #endif // DrawingBuffer_h |
OLD | NEW |