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

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

Issue 1066643003: Removed arbitrary 4096 size limit on WebGL canvas backbuffers, Take 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Only check if canvas area is > 4096 * 4096 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
1016 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]); 1013 GLint maxWidth = std::min(maxSize, m_maxViewportDims[0]);
1017 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]); 1014 GLint maxHeight = std::min(maxSize, m_maxViewportDims[1]);
1018 width = clamp(width, 1, maxWidth); 1015 width = clamp(width, 1, maxWidth);
1019 height = clamp(height, 1, maxHeight); 1016 height = clamp(height, 1, maxHeight);
1020 1017
1021 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off 1018 // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off
1022 // clear (and this matches what reshape will do). 1019 // clear (and this matches what reshape will do).
1023 drawingBuffer()->reset(IntSize(width, height)); 1020 drawingBuffer()->reset(IntSize(width, height));
1024 restoreStateAfterClear(); 1021 restoreStateAfterClear();
1025 1022
(...skipping 5033 matching lines...) Expand 10 before | Expand all | Expand 10 after
6059 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6056 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6060 } 6057 }
6061 #else 6058 #else
6062 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6059 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6063 { 6060 {
6064 return m_drawingBuffer.get(); 6061 return m_drawingBuffer.get();
6065 } 6062 }
6066 #endif 6063 #endif
6067 6064
6068 } // namespace blink 6065 } // 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