Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 1022113002: Revert of Removed arbitrary 4096 size limit on WebGL canvas backbuffers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 } 1004 }
1005 1005
1006 void WebGLRenderingContextBase::reshape(int width, int height) 1006 void WebGLRenderingContextBase::reshape(int width, int height)
1007 { 1007 {
1008 if (isContextLost()) 1008 if (isContextLost())
1009 return; 1009 return;
1010 1010
1011 // This is an approximation because at WebGLRenderingContextBase level we do n't 1011 // This is an approximation because at WebGLRenderingContextBase level we do n't
1012 // know if the underlying FBO uses textures or renderbuffers. 1012 // know if the underlying FBO uses textures or renderbuffers.
1013 GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize); 1013 GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize);
1014 // Limit drawing buffer size to 4k to avoid memory exhaustion.
1015 const int sizeUpperLimit = 4096;
1016 maxSize = std::min(maxSize, sizeUpperLimit);
1014 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); 1017 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]);
1015 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); 1018 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]);
1016 width = clamp(width, 1, maxWidth); 1019 width = clamp(width, 1, maxWidth);
1017 height = clamp(height, 1, maxHeight); 1020 height = clamp(height, 1, maxHeight);
1018 1021
1019 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off 1022 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off
1020 // clear (and this matches what reshape will do). 1023 // clear (and this matches what reshape will do).
1021 drawingBuffer()->reset(IntSize(width, height)); 1024 drawingBuffer()->reset(IntSize(width, height));
1022 restoreStateAfterClear(); 1025 restoreStateAfterClear();
1023 1026
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after
6022 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6025 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6023 } 6026 }
6024 #else 6027 #else
6025 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6028 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6026 { 6029 {
6027 return m_drawingBuffer.get(); 6030 return m_drawingBuffer.get();
6028 } 6031 }
6029 #endif 6032 #endif
6030 6033
6031 } // namespace blink 6034 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698