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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 class WebGLShaderPrecisionFormat; | 103 class WebGLShaderPrecisionFormat; |
| 104 class WebGLSharedObject; | 104 class WebGLSharedObject; |
| 105 class WebGLUniformLocation; | 105 class WebGLUniformLocation; |
| 106 class WebGLVertexArrayObjectBase; | 106 class WebGLVertexArrayObjectBase; |
| 107 | 107 |
| 108 class WebGLRenderingContextErrorMessageCallback; | 108 class WebGLRenderingContextErrorMessageCallback; |
| 109 | 109 |
| 110 // This class uses the color mask to prevent drawing to the alpha channel, if | 110 // This class uses the color mask to prevent drawing to the alpha channel, if |
| 111 // the DrawingBuffer requires RGB emulation. | 111 // the DrawingBuffer requires RGB emulation. |
| 112 class ScopedRGBEmulationColorMask { | 112 class ScopedRGBEmulationColorMask { |
| 113 STACK_ALLOCATED(); | |
| 114 | |
| 113 public: | 115 public: |
| 114 ScopedRGBEmulationColorMask(gpu::gles2::GLES2Interface*, | 116 ScopedRGBEmulationColorMask(WebGLRenderingContextBase*, |
| 115 GLboolean* colorMask, | 117 GLboolean* colorMask, |
| 116 DrawingBuffer*); | 118 DrawingBuffer*); |
| 117 ~ScopedRGBEmulationColorMask(); | 119 ~ScopedRGBEmulationColorMask(); |
| 118 | 120 |
| 119 private: | 121 private: |
| 120 gpu::gles2::GLES2Interface* m_contextGL; | 122 Member<WebGLRenderingContextBase> m_context; |
| 121 GLboolean m_colorMask[4]; | 123 GLboolean m_colorMask[4]; |
| 122 const bool m_requiresEmulation; | 124 const bool m_requiresEmulation; |
| 123 }; | 125 }; |
| 124 | 126 |
| 125 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, | 127 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, |
| 126 public DrawingBuffer::Client { | 128 public DrawingBuffer::Client { |
| 127 WTF_MAKE_NONCOPYABLE(WebGLRenderingContextBase); | 129 WTF_MAKE_NONCOPYABLE(WebGLRenderingContextBase); |
| 128 | 130 |
| 129 public: | 131 public: |
| 130 ~WebGLRenderingContextBase() override; | 132 ~WebGLRenderingContextBase() override; |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1526 static void addToEvictedList(WebGLRenderingContextBase*); | 1528 static void addToEvictedList(WebGLRenderingContextBase*); |
| 1527 static void removeFromEvictedList(WebGLRenderingContextBase*); | 1529 static void removeFromEvictedList(WebGLRenderingContextBase*); |
| 1528 static void willDestroyContext(WebGLRenderingContextBase*); | 1530 static void willDestroyContext(WebGLRenderingContextBase*); |
| 1529 static void forciblyLoseOldestContext(const String& reason); | 1531 static void forciblyLoseOldestContext(const String& reason); |
| 1530 // Return the least recently used context's position in the active context | 1532 // Return the least recently used context's position in the active context |
| 1531 // vector. If the vector is empty, return the maximum allowed active context | 1533 // vector. If the vector is empty, return the maximum allowed active context |
| 1532 // number. | 1534 // number. |
| 1533 static WebGLRenderingContextBase* oldestContext(); | 1535 static WebGLRenderingContextBase* oldestContext(); |
| 1534 static WebGLRenderingContextBase* oldestEvictedContext(); | 1536 static WebGLRenderingContextBase* oldestEvictedContext(); |
| 1535 | 1537 |
| 1538 friend class ScopedRGBEmulationColorMask; | |
| 1539 std::list<ScopedRGBEmulationColorMask*> activeScopedRGBEmulationColorMasks; | |
| 1540 void pushActiveScopedRGBEmulationColorMask(ScopedRGBEmulationColorMask* val) { | |
| 1541 activeScopedRGBEmulationColorMasks.push_back(val); | |
| 1542 } | |
| 1543 ScopedRGBEmulationColorMask* popActiveScopedRGBEmulationColorMask() { | |
|
Ken Russell (switch to Gerrit)
2016/12/01 23:45:30
It occurs to me that since the WebGLRenderingConte
Kai Ninomiya
2016/12/02 00:05:27
Great point, thanks. I was thinking of trying to s
| |
| 1544 auto removed = activeScopedRGBEmulationColorMasks.back(); | |
| 1545 activeScopedRGBEmulationColorMasks.pop_back(); | |
| 1546 return removed; | |
| 1547 } | |
| 1548 | |
| 1536 ImageBitmap* transferToImageBitmapBase(ScriptState*); | 1549 ImageBitmap* transferToImageBitmapBase(ScriptState*); |
| 1537 | 1550 |
| 1538 // Helper functions for tex(Sub)Image2D && texSubImage3D | 1551 // Helper functions for tex(Sub)Image2D && texSubImage3D |
| 1539 void texImageHelperDOMArrayBufferView(TexImageFunctionID, | 1552 void texImageHelperDOMArrayBufferView(TexImageFunctionID, |
| 1540 GLenum, | 1553 GLenum, |
| 1541 GLint, | 1554 GLint, |
| 1542 GLint, | 1555 GLint, |
| 1543 GLsizei, | 1556 GLsizei, |
| 1544 GLsizei, | 1557 GLsizei, |
| 1545 GLsizei, | 1558 GLsizei, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1668 context, | 1681 context, |
| 1669 context->is3d(), | 1682 context->is3d(), |
| 1670 context.is3d()); | 1683 context.is3d()); |
| 1671 | 1684 |
| 1672 } // namespace blink | 1685 } // namespace blink |
| 1673 | 1686 |
| 1674 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1687 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
| 1675 blink::WebGLRenderingContextBase::TextureUnitState); | 1688 blink::WebGLRenderingContextBase::TextureUnitState); |
| 1676 | 1689 |
| 1677 #endif // WebGLRenderingContextBase_h | 1690 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |