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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 GLImageOzoneNativePixmap::GLImageOzoneNativePixmap(const Size& size, | 82 GLImageOzoneNativePixmap::GLImageOzoneNativePixmap(const Size& size, |
83 unsigned internalformat) | 83 unsigned internalformat) |
84 : gl::GLImageEGL(size), internalformat_(internalformat) {} | 84 : gl::GLImageEGL(size), internalformat_(internalformat) {} |
85 | 85 |
86 GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() { | 86 GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() { |
87 } | 87 } |
88 | 88 |
89 bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap, | 89 bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap) { |
90 BufferFormat format) { | |
91 DCHECK(!pixmap_); | 90 DCHECK(!pixmap_); |
| 91 BufferFormat format = pixmap->GetBufferFormat(); |
92 if (pixmap->GetEGLClientBuffer()) { | 92 if (pixmap->GetEGLClientBuffer()) { |
93 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; | 93 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; |
94 if (!gl::GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, | 94 if (!gl::GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, |
95 pixmap->GetEGLClientBuffer(), attrs)) { | 95 pixmap->GetEGLClientBuffer(), attrs)) { |
96 return false; | 96 return false; |
97 } | 97 } |
98 } else if (pixmap->GetDmaBufFd() >= 0) { | 98 } else if (pixmap->GetDmaBufFd() >= 0) { |
99 if (!ValidInternalFormat(internalformat_)) { | 99 if (!ValidInternalFormat(internalformat_)) { |
100 LOG(ERROR) << "Invalid internalformat: " << internalformat_; | 100 LOG(ERROR) << "Invalid internalformat: " << internalformat_; |
101 return false; | 101 return false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 void GLImageOzoneNativePixmap::OnMemoryDump( | 153 void GLImageOzoneNativePixmap::OnMemoryDump( |
154 base::trace_event::ProcessMemoryDump* pmd, | 154 base::trace_event::ProcessMemoryDump* pmd, |
155 uint64_t process_tracing_id, | 155 uint64_t process_tracing_id, |
156 const std::string& dump_name) { | 156 const std::string& dump_name) { |
157 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 | 157 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 |
158 } | 158 } |
159 | 159 |
160 } // namespace gfx | 160 } // namespace gfx |
OLD | NEW |