OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 } else { | 2235 } else { |
2236 return back_buffer_color_format_; | 2236 return back_buffer_color_format_; |
2237 } | 2237 } |
2238 } | 2238 } |
2239 | 2239 |
2240 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { | 2240 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { |
2241 if (offscreen_size_ == pending_offscreen_size_) | 2241 if (offscreen_size_ == pending_offscreen_size_) |
2242 return true; | 2242 return true; |
2243 | 2243 |
2244 offscreen_size_ = pending_offscreen_size_; | 2244 offscreen_size_ = pending_offscreen_size_; |
| 2245 int w = offscreen_size_.width(); |
| 2246 int h = offscreen_size_.height(); |
| 2247 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { |
| 2248 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " |
| 2249 << "to allocate storage due to excessive dimensions."; |
| 2250 return false; |
| 2251 } |
2245 | 2252 |
2246 // Reallocate the offscreen target buffers. | 2253 // Reallocate the offscreen target buffers. |
2247 DCHECK(offscreen_target_color_format_); | 2254 DCHECK(offscreen_target_color_format_); |
2248 if (IsOffscreenBufferMultisampled()) { | 2255 if (IsOffscreenBufferMultisampled()) { |
2249 if (!offscreen_target_color_render_buffer_->AllocateStorage( | 2256 if (!offscreen_target_color_render_buffer_->AllocateStorage( |
2250 pending_offscreen_size_, offscreen_target_color_format_, | 2257 pending_offscreen_size_, offscreen_target_color_format_, |
2251 offscreen_target_samples_)) { | 2258 offscreen_target_samples_)) { |
2252 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " | 2259 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " |
2253 << "to allocate storage for offscreen target color buffer."; | 2260 << "to allocate storage for offscreen target color buffer."; |
2254 return false; | 2261 return false; |
(...skipping 3847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6102 return error::kNoError; | 6109 return error::kNoError; |
6103 } | 6110 } |
6104 | 6111 |
6105 // Include the auto-generated part of this file. We split this because it means | 6112 // Include the auto-generated part of this file. We split this because it means |
6106 // we can easily edit the non-auto generated parts right here in this file | 6113 // we can easily edit the non-auto generated parts right here in this file |
6107 // instead of having to edit some template or the code generator. | 6114 // instead of having to edit some template or the code generator. |
6108 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6115 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6109 | 6116 |
6110 } // namespace gles2 | 6117 } // namespace gles2 |
6111 } // namespace gpu | 6118 } // namespace gpu |
OLD | NEW |