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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 m_gl->ClearStencil(0); | 961 m_gl->ClearStencil(0); |
962 clearMask |= GL_STENCIL_BUFFER_BIT; | 962 clearMask |= GL_STENCIL_BUFFER_BIT; |
963 m_gl->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); | 963 m_gl->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); |
964 } | 964 } |
965 | 965 |
966 clearFramebuffersInternal(clearMask); | 966 clearFramebuffersInternal(clearMask); |
967 return true; | 967 return true; |
968 } | 968 } |
969 | 969 |
970 void DrawingBuffer::resolveAndBindForReadAndDraw() { | 970 void DrawingBuffer::resolveAndBindForReadAndDraw() { |
971 { | 971 if (m_contentsChanged) { |
dshwang
2017/04/08 02:16:32
I think it's better to change
m_antiAliasingMode !
Zhenyao Mo
2017/04/12 23:38:08
I agree !m_contentsChangeResolved is a better cond
xinghua.cao
2017/04/13 10:50:24
It seems a repeating condition here, thank you.
| |
972 ScopedStateRestorer scopedStateRestorer(this); | 972 ScopedStateRestorer scopedStateRestorer(this); |
973 resolveIfNeeded(); | 973 resolveIfNeeded(); |
974 } | 974 } |
975 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 975 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
976 } | 976 } |
977 | 977 |
978 void DrawingBuffer::resolveMultisampleFramebufferInternal() { | 978 void DrawingBuffer::resolveMultisampleFramebufferInternal() { |
979 DCHECK(m_stateRestorer); | 979 DCHECK(m_stateRestorer); |
980 m_stateRestorer->setFramebufferBindingDirty(); | 980 m_stateRestorer->setFramebufferBindingDirty(); |
981 if (wantExplicitResolve() && !m_contentsChangeResolved) { | 981 if (wantExplicitResolve() && !m_contentsChangeResolved) { |
(...skipping 17 matching lines...) Expand all Loading... | |
999 contextProvider() | 999 contextProvider() |
1000 ->getCapabilities() | 1000 ->getCapabilities() |
1001 .disable_multisampling_color_mask_usage) { | 1001 .disable_multisampling_color_mask_usage) { |
1002 m_gl->ClearColor(0, 0, 0, 1); | 1002 m_gl->ClearColor(0, 0, 0, 1); |
1003 m_gl->ColorMask(false, false, false, true); | 1003 m_gl->ColorMask(false, false, false, true); |
1004 m_gl->Clear(GL_COLOR_BUFFER_BIT); | 1004 m_gl->Clear(GL_COLOR_BUFFER_BIT); |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
1008 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 1008 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
1009 if (m_antiAliasingMode == ScreenSpaceAntialiasing) | 1009 if (m_antiAliasingMode == ScreenSpaceAntialiasing && |
1010 !m_contentsChangeResolved) | |
1010 m_gl->ApplyScreenSpaceAntialiasingCHROMIUM(); | 1011 m_gl->ApplyScreenSpaceAntialiasingCHROMIUM(); |
1011 } | 1012 } |
1012 | 1013 |
1013 void DrawingBuffer::resolveIfNeeded() { | 1014 void DrawingBuffer::resolveIfNeeded() { |
1014 if (m_antiAliasingMode != None) | 1015 if (m_antiAliasingMode != None) |
1015 resolveMultisampleFramebufferInternal(); | 1016 resolveMultisampleFramebufferInternal(); |
1016 m_contentsChangeResolved = true; | 1017 m_contentsChangeResolved = true; |
1017 } | 1018 } |
1018 | 1019 |
1019 void DrawingBuffer::restoreFramebufferBindings() { | 1020 void DrawingBuffer::restoreFramebufferBindings() { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1296 if (m_pixelUnpackBufferBindingDirty) | 1297 if (m_pixelUnpackBufferBindingDirty) |
1297 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); | 1298 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); |
1298 } | 1299 } |
1299 | 1300 |
1300 bool DrawingBuffer::shouldUseChromiumImage() { | 1301 bool DrawingBuffer::shouldUseChromiumImage() { |
1301 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && | 1302 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && |
1302 m_chromiumImageUsage == AllowChromiumImage; | 1303 m_chromiumImageUsage == AllowChromiumImage; |
1303 } | 1304 } |
1304 | 1305 |
1305 } // namespace blink | 1306 } // namespace blink |
OLD | NEW |