| 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/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 #include "ui/gl/scoped_binders.h" | 10 #include "ui/gl/scoped_binders.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return false; | 219 return false; |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (!ValidFormat(format)) { | 222 if (!ValidFormat(format)) { |
| 223 LOG(ERROR) << "Invalid format: " << format; | 223 LOG(ERROR) << "Invalid format: " << format; |
| 224 return false; | 224 return false; |
| 225 } | 225 } |
| 226 | 226 |
| 227 DCHECK(memory); | 227 DCHECK(memory); |
| 228 DCHECK(!memory_); | 228 DCHECK(!memory_); |
| 229 DCHECK_IMPLIES(IsCompressedFormat(format), size_.width() % 4 == 0); | 229 DCHECK(!IsCompressedFormat(format) || (size_.width() % 4 == 0)); |
| 230 DCHECK_IMPLIES(IsCompressedFormat(format), size_.height() % 4 == 0); | 230 DCHECK(!IsCompressedFormat(format) || (size_.height() % 4 == 0)); |
| 231 memory_ = memory; | 231 memory_ = memory; |
| 232 format_ = format; | 232 format_ = format; |
| 233 return true; | 233 return true; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void GLImageMemory::Destroy(bool have_context) { | 236 void GLImageMemory::Destroy(bool have_context) { |
| 237 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ | 237 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| 238 defined(USE_OZONE) | 238 defined(USE_OZONE) |
| 239 if (egl_image_ != EGL_NO_IMAGE_KHR) { | 239 if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| 240 eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image_); | 240 eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image_); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 size_.width(), | 433 size_.width(), |
| 434 size_.height(), | 434 size_.height(), |
| 435 0, // border | 435 0, // border |
| 436 DataFormat(format_), | 436 DataFormat(format_), |
| 437 DataType(format_), | 437 DataType(format_), |
| 438 memory_); | 438 memory_); |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace gfx | 442 } // namespace gfx |
| OLD | NEW |