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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 DCHECK(!IsCompressedFormat(format) || size_.height() % 4 == 0); | 264 DCHECK(!IsCompressedFormat(format) || size_.height() % 4 == 0); |
265 memory_ = memory; | 265 memory_ = memory; |
266 format_ = format; | 266 format_ = format; |
267 return true; | 267 return true; |
268 } | 268 } |
269 | 269 |
270 void GLImageMemory::Destroy(bool have_context) { | 270 void GLImageMemory::Destroy(bool have_context) { |
271 memory_ = nullptr; | 271 memory_ = nullptr; |
272 } | 272 } |
273 | 273 |
| 274 bool GLImageMemory::IsValid() { |
| 275 return memory_ != nullptr; |
| 276 } |
| 277 |
274 gfx::Size GLImageMemory::GetSize() { | 278 gfx::Size GLImageMemory::GetSize() { |
275 return size_; | 279 return size_; |
276 } | 280 } |
277 | 281 |
278 unsigned GLImageMemory::GetInternalFormat() { | 282 unsigned GLImageMemory::GetInternalFormat() { |
279 return internalformat_; | 283 return internalformat_; |
280 } | 284 } |
281 | 285 |
282 bool GLImageMemory::BindTexImage(unsigned target) { | 286 bool GLImageMemory::BindTexImage(unsigned target) { |
283 return false; | 287 return false; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 return false; | 368 return false; |
365 } | 369 } |
366 | 370 |
367 // static | 371 // static |
368 unsigned GLImageMemory::GetInternalFormatForTesting(BufferFormat format) { | 372 unsigned GLImageMemory::GetInternalFormatForTesting(BufferFormat format) { |
369 DCHECK(ValidFormat(format)); | 373 DCHECK(ValidFormat(format)); |
370 return TextureFormat(format); | 374 return TextureFormat(format); |
371 } | 375 } |
372 | 376 |
373 } // namespace gl | 377 } // namespace gl |
OLD | NEW |