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

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

Issue 1040153002: Removed arbitrary 4096 size limit on WebGL canvas backbuffers, Take 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added suggested ASSERT Created 5 years, 8 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
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);
1017 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); 1014 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]);
1018 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); 1015 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]);
1019 width = clamp(width, 1, maxWidth); 1016 width = clamp(width, 1, maxWidth);
1020 height = clamp(height, 1, maxHeight); 1017 height = clamp(height, 1, maxHeight);
1021 1018
1022 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off 1019 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off
1023 // clear (and this matches what reshape will do). 1020 // clear (and this matches what reshape will do).
1024 drawingBuffer()->reset(IntSize(width, height)); 1021 drawingBuffer()->reset(IntSize(width, height));
1025 restoreStateAfterClear(); 1022 restoreStateAfterClear();
1026 1023
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after
6025 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6022 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6026 } 6023 }
6027 #else 6024 #else
6028 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6025 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6029 { 6026 {
6030 return m_drawingBuffer.get(); 6027 return m_drawingBuffer.get();
6031 } 6028 }
6032 #endif 6029 #endif
6033 6030
6034 } // namespace blink 6031 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/gpu/DrawingBuffer.h » ('j') | Source/platform/graphics/gpu/DrawingBuffer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698