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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 // Restore as soon as possible, but only when | 533 // Restore as soon as possible, but only when |
534 // the canvas is visible. | 534 // the canvas is visible. |
535 Auto | 535 Auto |
536 }; | 536 }; |
537 void loseContext(LostContextMode) override; | 537 void loseContext(LostContextMode) override; |
538 void forceLostContext(LostContextMode, AutoRecoveryMethod); | 538 void forceLostContext(LostContextMode, AutoRecoveryMethod); |
539 void forceRestoreContext(); | 539 void forceRestoreContext(); |
540 void loseContextImpl(LostContextMode, AutoRecoveryMethod); | 540 void loseContextImpl(LostContextMode, AutoRecoveryMethod); |
541 | 541 |
| 542 // Utilities to restore GL state to match the rendering context's |
| 543 // saved state. Use these after contextGL()-based state changes that |
| 544 // bypass the rendering context. |
| 545 void restoreScissorEnabled(); |
| 546 void restoreScissorBox(); |
| 547 void restoreClearColor(); |
| 548 void restoreClearDepthf(); |
| 549 void restoreClearStencil(); |
| 550 void restoreStencilMaskSeparate(); |
| 551 void restoreColorMask(); |
| 552 void restoreDepthMask(); |
| 553 |
542 gpu::gles2::GLES2Interface* contextGL() const { | 554 gpu::gles2::GLES2Interface* contextGL() const { |
543 DrawingBuffer* d = drawingBuffer(); | 555 DrawingBuffer* d = drawingBuffer(); |
544 if (!d) | 556 if (!d) |
545 return nullptr; | 557 return nullptr; |
546 return d->contextGL(); | 558 return d->contextGL(); |
547 } | 559 } |
548 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } | 560 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } |
549 Extensions3DUtil* extensionsUtil(); | 561 Extensions3DUtil* extensionsUtil(); |
550 | 562 |
551 void reshape(int width, int height) override; | 563 void reshape(int width, int height) override; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 GLenum m_readBufferOfDefaultFramebuffer; | 767 GLenum m_readBufferOfDefaultFramebuffer; |
756 | 768 |
757 GLint m_packAlignment; | 769 GLint m_packAlignment; |
758 GLint m_unpackAlignment; | 770 GLint m_unpackAlignment; |
759 bool m_unpackFlipY; | 771 bool m_unpackFlipY; |
760 bool m_unpackPremultiplyAlpha; | 772 bool m_unpackPremultiplyAlpha; |
761 GLenum m_unpackColorspaceConversion; | 773 GLenum m_unpackColorspaceConversion; |
762 | 774 |
763 GLfloat m_clearColor[4]; | 775 GLfloat m_clearColor[4]; |
764 bool m_scissorEnabled; | 776 bool m_scissorEnabled; |
| 777 GLint m_scissorBox[4]; |
765 GLfloat m_clearDepth; | 778 GLfloat m_clearDepth; |
766 GLint m_clearStencil; | 779 GLint m_clearStencil; |
767 GLboolean m_colorMask[4]; | 780 GLboolean m_colorMask[4]; |
768 GLboolean m_depthMask; | 781 GLboolean m_depthMask; |
769 | 782 |
770 bool m_stencilEnabled; | 783 bool m_stencilEnabled; |
771 GLuint m_stencilMask, m_stencilMaskBack; | 784 GLuint m_stencilMask, m_stencilMaskBack; |
772 GLint m_stencilFuncRef, | 785 GLint m_stencilFuncRef, |
773 m_stencilFuncRefBack; // Note that these are the user specified values, | 786 m_stencilFuncRefBack; // Note that these are the user specified values, |
774 // not the internal clamped value. | 787 // not the internal clamped value. |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 context, | 1548 context, |
1536 context->is3d(), | 1549 context->is3d(), |
1537 context.is3d()); | 1550 context.is3d()); |
1538 | 1551 |
1539 } // namespace blink | 1552 } // namespace blink |
1540 | 1553 |
1541 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1554 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
1542 blink::WebGLRenderingContextBase::TextureUnitState); | 1555 blink::WebGLRenderingContextBase::TextureUnitState); |
1543 | 1556 |
1544 #endif // WebGLRenderingContextBase_h | 1557 #endif // WebGLRenderingContextBase_h |
OLD | NEW |