| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ozone_native_pixmap.h" | 5 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
| 6 | 6 |
| 7 #define FOURCC(a, b, c, d) \ | 7 #define FOURCC(a, b, c, d) \ |
| 8 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ | 8 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ |
| 9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) | 9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return 0; | 68 return 0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 GLImageOzoneNativePixmap::GLImageOzoneNativePixmap(const Size& size, | 73 GLImageOzoneNativePixmap::GLImageOzoneNativePixmap(const Size& size, |
| 74 unsigned internalformat) | 74 unsigned internalformat) |
| 75 : GLImageEGL(size), internalformat_(internalformat) {} | 75 : GLImageEGL(size), internalformat_(internalformat) {} |
| 76 | 76 |
| 77 GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() { | 77 GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() { |
| 78 DCHECK(!pixmap_); | |
| 79 } | 78 } |
| 80 | 79 |
| 81 bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap, | 80 bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap, |
| 82 GpuMemoryBuffer::Format format) { | 81 GpuMemoryBuffer::Format format) { |
| 83 DCHECK(!pixmap_); | 82 DCHECK(!pixmap_); |
| 84 | 83 |
| 85 bool result = true; | 84 bool result = true; |
| 86 if (pixmap->GetEGLClientBuffer()) { | 85 if (pixmap->GetEGLClientBuffer()) { |
| 87 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; | 86 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; |
| 88 result = GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, | 87 result = GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 pixmap_ = pixmap; | 120 pixmap_ = pixmap; |
| 122 return result; | 121 return result; |
| 123 } | 122 } |
| 124 | 123 |
| 125 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { | 124 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { |
| 126 return internalformat_; | 125 return internalformat_; |
| 127 } | 126 } |
| 128 | 127 |
| 129 void GLImageOzoneNativePixmap::Destroy(bool have_context) { | 128 void GLImageOzoneNativePixmap::Destroy(bool have_context) { |
| 130 GLImageEGL::Destroy(have_context); | 129 GLImageEGL::Destroy(have_context); |
| 131 pixmap_ = nullptr; | |
| 132 } | 130 } |
| 133 | 131 |
| 134 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane(AcceleratedWidget widget, | 132 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane(AcceleratedWidget widget, |
| 135 int z_order, | 133 int z_order, |
| 136 OverlayTransform transform, | 134 OverlayTransform transform, |
| 137 const Rect& bounds_rect, | 135 const Rect& bounds_rect, |
| 138 const RectF& crop_rect) { | 136 const RectF& crop_rect) { |
| 139 DCHECK(pixmap_); | 137 DCHECK(pixmap_); |
| 140 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect, | 138 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect, |
| 141 crop_rect); | 139 crop_rect); |
| 142 } | 140 } |
| 143 | 141 |
| 144 } // namespace gfx | 142 } // namespace gfx |
| OLD | NEW |