| 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 void WebGLRenderingContextBase::reshape(int width, int height) | 1005 void WebGLRenderingContextBase::reshape(int width, int height) |
| 1006 { | 1006 { |
| 1007 if (isContextLost()) | 1007 if (isContextLost()) |
| 1008 return; | 1008 return; |
| 1009 | 1009 |
| 1010 // This is an approximation because at WebGLRenderingContextBase level we do
n't | 1010 // This is an approximation because at WebGLRenderingContextBase level we do
n't |
| 1011 // know if the underlying FBO uses textures or renderbuffers. | 1011 // know if the underlying FBO uses textures or renderbuffers. |
| 1012 GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize); | 1012 GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize); |
| 1013 // Limit drawing buffer size to 4k to avoid memory exhaustion. |
| 1014 const int sizeUpperLimit = 4096; |
| 1015 maxSize = std::min(maxSize, sizeUpperLimit); |
| 1013 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); | 1016 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); |
| 1014 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); | 1017 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); |
| 1015 width = clamp(width, 1, maxWidth); | 1018 width = clamp(width, 1, maxWidth); |
| 1016 height = clamp(height, 1, maxHeight); | 1019 height = clamp(height, 1, maxHeight); |
| 1017 | 1020 |
| 1018 // We don't have to mark the canvas as dirty, since the newly created image
buffer will also start off | 1021 // We don't have to mark the canvas as dirty, since the newly created image
buffer will also start off |
| 1019 // clear (and this matches what reshape will do). | 1022 // clear (and this matches what reshape will do). |
| 1020 drawingBuffer()->reset(IntSize(width, height)); | 1023 drawingBuffer()->reset(IntSize(width, height)); |
| 1021 restoreStateAfterClear(); | 1024 restoreStateAfterClear(); |
| 1022 | 1025 |
| (...skipping 5033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6056 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; | 6059 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; |
| 6057 } | 6060 } |
| 6058 #else | 6061 #else |
| 6059 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6062 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6060 { | 6063 { |
| 6061 return m_drawingBuffer.get(); | 6064 return m_drawingBuffer.get(); |
| 6062 } | 6065 } |
| 6063 #endif | 6066 #endif |
| 6064 | 6067 |
| 6065 } // namespace blink | 6068 } // namespace blink |
| OLD | NEW |