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 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 } else { | 2239 } else { |
2240 return back_buffer_color_format_; | 2240 return back_buffer_color_format_; |
2241 } | 2241 } |
2242 } | 2242 } |
2243 | 2243 |
2244 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { | 2244 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { |
2245 if (offscreen_size_ == pending_offscreen_size_) | 2245 if (offscreen_size_ == pending_offscreen_size_) |
2246 return true; | 2246 return true; |
2247 | 2247 |
2248 offscreen_size_ = pending_offscreen_size_; | 2248 offscreen_size_ = pending_offscreen_size_; |
| 2249 int w = offscreen_size_.width(); |
| 2250 int h = offscreen_size_.height(); |
| 2251 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { |
| 2252 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " |
| 2253 << "to allocate storage due to excessive dimensions."; |
| 2254 return false; |
| 2255 } |
2249 | 2256 |
2250 // Reallocate the offscreen target buffers. | 2257 // Reallocate the offscreen target buffers. |
2251 DCHECK(offscreen_target_color_format_); | 2258 DCHECK(offscreen_target_color_format_); |
2252 if (IsOffscreenBufferMultisampled()) { | 2259 if (IsOffscreenBufferMultisampled()) { |
2253 if (!offscreen_target_color_render_buffer_->AllocateStorage( | 2260 if (!offscreen_target_color_render_buffer_->AllocateStorage( |
2254 pending_offscreen_size_, offscreen_target_color_format_, | 2261 pending_offscreen_size_, offscreen_target_color_format_, |
2255 offscreen_target_samples_)) { | 2262 offscreen_target_samples_)) { |
2256 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " | 2263 LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " |
2257 << "to allocate storage for offscreen target color buffer."; | 2264 << "to allocate storage for offscreen target color buffer."; |
2258 return false; | 2265 return false; |
(...skipping 3886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6145 return error::kNoError; | 6152 return error::kNoError; |
6146 } | 6153 } |
6147 | 6154 |
6148 // Include the auto-generated part of this file. We split this because it means | 6155 // Include the auto-generated part of this file. We split this because it means |
6149 // we can easily edit the non-auto generated parts right here in this file | 6156 // we can easily edit the non-auto generated parts right here in this file |
6150 // instead of having to edit some template or the code generator. | 6157 // instead of having to edit some template or the code generator. |
6151 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6158 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6152 | 6159 |
6153 } // namespace gles2 | 6160 } // namespace gles2 |
6154 } // namespace gpu | 6161 } // namespace gpu |
OLD | NEW |