OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gl/gl_image_memory.h" | 5 #include "ui/gl/gl_image_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return false; | 251 return false; |
252 } | 252 } |
253 | 253 |
254 if (!ValidFormat(format)) { | 254 if (!ValidFormat(format)) { |
255 LOG(ERROR) << "Invalid format: " << static_cast<int>(format); | 255 LOG(ERROR) << "Invalid format: " << static_cast<int>(format); |
256 return false; | 256 return false; |
257 } | 257 } |
258 | 258 |
259 DCHECK(memory); | 259 DCHECK(memory); |
260 DCHECK(!memory_); | 260 DCHECK(!memory_); |
261 DCHECK(!IsCompressedFormat(format) || size_.width() % 4 == 0); | 261 DCHECK_IMPLIES(IsCompressedFormat(format), size_.width() % 4 == 0); |
262 DCHECK(!IsCompressedFormat(format) || size_.height() % 4 == 0); | 262 DCHECK_IMPLIES(IsCompressedFormat(format), size_.height() % 4 == 0); |
263 memory_ = memory; | 263 memory_ = memory; |
264 format_ = format; | 264 format_ = format; |
265 return true; | 265 return true; |
266 } | 266 } |
267 | 267 |
268 void GLImageMemory::Destroy(bool have_context) { | 268 void GLImageMemory::Destroy(bool have_context) { |
269 memory_ = nullptr; | 269 memory_ = nullptr; |
270 } | 270 } |
271 | 271 |
272 Size GLImageMemory::GetSize() { | 272 Size GLImageMemory::GetSize() { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 return false; | 362 return false; |
363 } | 363 } |
364 | 364 |
365 // static | 365 // static |
366 unsigned GLImageMemory::GetInternalFormatForTesting(BufferFormat format) { | 366 unsigned GLImageMemory::GetInternalFormatForTesting(BufferFormat format) { |
367 DCHECK(ValidFormat(format)); | 367 DCHECK(ValidFormat(format)); |
368 return TextureFormat(format); | 368 return TextureFormat(format); |
369 } | 369 } |
370 | 370 |
371 } // namespace gfx | 371 } // namespace gfx |
OLD | NEW |