Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebGLRenderingContext_h | 26 #ifndef WebGLRenderingContext_h |
| 27 #define WebGLRenderingContext_h | 27 #define WebGLRenderingContext_h |
| 28 | 28 |
| 29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
| 30 #include "core/html/canvas/CanvasRenderingContext.h" | 30 #include "core/html/canvas/CanvasRenderingContext.h" |
| 31 #include "core/html/canvas/WebGLGetInfo.h" | 31 #include "core/html/canvas/WebGLGetInfo.h" |
| 32 #include "core/page/Page.h" | |
| 32 #include "core/platform/Timer.h" | 33 #include "core/platform/Timer.h" |
| 33 #include "core/platform/graphics/GraphicsContext3D.h" | 34 #include "core/platform/graphics/GraphicsContext3D.h" |
| 34 #include "core/platform/graphics/ImageBuffer.h" | 35 #include "core/platform/graphics/ImageBuffer.h" |
| 35 | 36 |
| 36 #include <wtf/Float32Array.h> | 37 #include <wtf/Float32Array.h> |
| 37 #include <wtf/Int32Array.h> | 38 #include <wtf/Int32Array.h> |
| 38 #include <wtf/OwnArrayPtr.h> | 39 #include <wtf/OwnArrayPtr.h> |
| 39 #include <wtf/text/WTFString.h> | 40 #include <wtf/text/WTFString.h> |
| 40 #include <wtf/Uint8Array.h> | 41 #include <wtf/Uint8Array.h> |
| 41 | 42 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 GC3Dsizei stride, long long offset, ExceptionCode&) ; | 288 GC3Dsizei stride, long long offset, ExceptionCode&) ; |
| 288 | 289 |
| 289 void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height); | 290 void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height); |
| 290 | 291 |
| 291 // WEBKIT_lose_context support | 292 // WEBKIT_lose_context support |
| 292 enum LostContextMode { | 293 enum LostContextMode { |
| 293 // Lost context occurred at the graphics system level. | 294 // Lost context occurred at the graphics system level. |
| 294 RealLostContext, | 295 RealLostContext, |
| 295 | 296 |
| 296 // Lost context provoked by WEBKIT_lose_context. | 297 // Lost context provoked by WEBKIT_lose_context. |
| 297 SyntheticLostContext | 298 SyntheticLostContext, |
| 299 | |
| 300 // A synthetic lost context that should attempt to recover automatically | |
| 301 AutoRecoverSyntheticLostContext | |
| 298 }; | 302 }; |
| 299 void forceLostContext(LostContextMode); | 303 void forceLostContext(LostContextMode); |
| 300 void forceRestoreContext(); | 304 void forceRestoreContext(); |
| 301 void loseContextImpl(LostContextMode); | 305 void loseContextImpl(LostContextMode); |
| 302 | 306 |
| 303 GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } | 307 GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } |
| 304 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } | 308 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } |
| 305 virtual PlatformLayer* platformLayer() const; | 309 virtual PlatformLayer* platformLayer() const; |
| 306 | 310 |
| 307 void reshape(int width, int height); | 311 void reshape(int width, int height); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 324 friend class WebGLFramebuffer; | 328 friend class WebGLFramebuffer; |
| 325 friend class WebGLObject; | 329 friend class WebGLObject; |
| 326 friend class OESVertexArrayObject; | 330 friend class OESVertexArrayObject; |
| 327 friend class WebGLDebugShaders; | 331 friend class WebGLDebugShaders; |
| 328 friend class WebGLCompressedTextureATC; | 332 friend class WebGLCompressedTextureATC; |
| 329 friend class WebGLCompressedTexturePVRTC; | 333 friend class WebGLCompressedTexturePVRTC; |
| 330 friend class WebGLCompressedTextureS3TC; | 334 friend class WebGLCompressedTextureS3TC; |
| 331 friend class WebGLRenderingContextErrorMessageCallback; | 335 friend class WebGLRenderingContextErrorMessageCallback; |
| 332 friend class WebGLVertexArrayObjectOES; | 336 friend class WebGLVertexArrayObjectOES; |
| 333 | 337 |
| 334 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, Gra phicsContext3D::Attributes); | 338 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, Gra phicsContext3D::Attributes, GraphicsContext3D::Attributes); |
| 335 void initializeNewContext(); | 339 void initializeNewContext(); |
| 336 void setupFlags(); | 340 void setupFlags(); |
| 337 | 341 |
| 338 void addSharedObject(WebGLSharedObject*); | 342 void addSharedObject(WebGLSharedObject*); |
| 339 void addContextObject(WebGLContextObject*); | 343 void addContextObject(WebGLContextObject*); |
| 340 void detachAndRemoveAllObjects(); | 344 void detachAndRemoveAllObjects(); |
| 341 | 345 |
| 342 void destroyGraphicsContext3D(); | 346 void destroyGraphicsContext3D(); |
| 343 void markContextChanged(); | 347 void markContextChanged(); |
| 344 | 348 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 bool m_drawBuffersSupported; | 490 bool m_drawBuffersSupported; |
| 487 | 491 |
| 488 GC3Dint m_packAlignment; | 492 GC3Dint m_packAlignment; |
| 489 GC3Dint m_unpackAlignment; | 493 GC3Dint m_unpackAlignment; |
| 490 bool m_unpackFlipY; | 494 bool m_unpackFlipY; |
| 491 bool m_unpackPremultiplyAlpha; | 495 bool m_unpackPremultiplyAlpha; |
| 492 GC3Denum m_unpackColorspaceConversion; | 496 GC3Denum m_unpackColorspaceConversion; |
| 493 bool m_contextLost; | 497 bool m_contextLost; |
| 494 LostContextMode m_contextLostMode; | 498 LostContextMode m_contextLostMode; |
| 495 GraphicsContext3D::Attributes m_attributes; | 499 GraphicsContext3D::Attributes m_attributes; |
| 500 GraphicsContext3D::Attributes m_requestedAttributes; | |
| 496 | 501 |
| 497 bool m_layerCleared; | 502 bool m_layerCleared; |
| 498 GC3Dfloat m_clearColor[4]; | 503 GC3Dfloat m_clearColor[4]; |
| 499 bool m_scissorEnabled; | 504 bool m_scissorEnabled; |
| 500 GC3Dfloat m_clearDepth; | 505 GC3Dfloat m_clearDepth; |
| 501 GC3Dint m_clearStencil; | 506 GC3Dint m_clearStencil; |
| 502 GC3Dboolean m_colorMask[4]; | 507 GC3Dboolean m_colorMask[4]; |
| 503 GC3Dboolean m_depthMask; | 508 GC3Dboolean m_depthMask; |
| 504 | 509 |
| 505 bool m_stencilEnabled; | 510 bool m_stencilEnabled; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 762 // First time called, if EXT_draw_buffers is supported, query the value; oth erwise return 0. | 767 // First time called, if EXT_draw_buffers is supported, query the value; oth erwise return 0. |
| 763 // Later, return the cached value. | 768 // Later, return the cached value. |
| 764 GC3Dint getMaxDrawBuffers(); | 769 GC3Dint getMaxDrawBuffers(); |
| 765 GC3Dint getMaxColorAttachments(); | 770 GC3Dint getMaxColorAttachments(); |
| 766 | 771 |
| 767 void setBackDrawBuffer(GC3Denum); | 772 void setBackDrawBuffer(GC3Denum); |
| 768 | 773 |
| 769 void restoreCurrentFramebuffer(); | 774 void restoreCurrentFramebuffer(); |
| 770 void restoreCurrentTexture2D(); | 775 void restoreCurrentTexture2D(); |
| 771 | 776 |
| 777 class WebGLSettingsChangedObserver : public Page::SettingsChangedObserver, p ublic RefCounted<WebGLSettingsChangedObserver> { | |
| 778 public: | |
| 779 WebGLSettingsChangedObserver(WebGLRenderingContext*, Page*); | |
| 780 virtual void settingsChanged(Settings*); | |
| 781 virtual ~WebGLSettingsChangedObserver(); | |
| 782 | |
| 783 private: | |
| 784 WebGLRenderingContext* m_context; | |
| 785 Page* m_page; | |
|
abarth-chromium
2013/05/06 21:58:30
This object is RefCounted but it holds raw pointer
| |
| 786 bool m_multisamplingAllowed; | |
| 787 }; | |
| 788 | |
| 789 RefPtr<WebGLSettingsChangedObserver> m_settingsChangedObserver; | |
| 790 | |
| 772 friend class WebGLStateRestorer; | 791 friend class WebGLStateRestorer; |
| 773 friend class WebGLRenderingContextEvictionManager; | 792 friend class WebGLRenderingContextEvictionManager; |
| 774 | 793 |
| 775 static Vector<WebGLRenderingContext*>& activeContexts(); | 794 static Vector<WebGLRenderingContext*>& activeContexts(); |
| 776 static Vector<WebGLRenderingContext*>& forciblyEvictedContexts(); | 795 static Vector<WebGLRenderingContext*>& forciblyEvictedContexts(); |
| 777 | 796 |
| 778 static void activateContext(WebGLRenderingContext*); | 797 static void activateContext(WebGLRenderingContext*); |
| 779 static void deactivateContext(WebGLRenderingContext*, bool addToInactiveList ); | 798 static void deactivateContext(WebGLRenderingContext*, bool addToInactiveList ); |
| 780 static void willDestroyContext(WebGLRenderingContext*); | 799 static void willDestroyContext(WebGLRenderingContext*); |
| 781 static void forciblyLoseOldestContext(const String& reason); | 800 static void forciblyLoseOldestContext(const String& reason); |
| 782 static IntSize oldestContextSize(); | 801 static IntSize oldestContextSize(); |
| 783 }; | 802 }; |
| 784 | 803 |
| 785 } // namespace WebCore | 804 } // namespace WebCore |
| 786 | 805 |
| 787 #endif | 806 #endif |
| OLD | NEW |