Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/gl/gl_image_native_pixmap.cc

Issue 2768343002: Change namespace from ui to gfx for NativePixmap related code (Closed)
Patch Set: Addressed sadrul's remark Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_image_native_pixmap.h ('k') | ui/ozone/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_native_pixmap.h" 5 #include "ui/gl/gl_image_native_pixmap.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ui/gfx/buffer_format_util.h" 9 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gl/gl_surface_egl.h" 10 #include "ui/gl/gl_surface_egl.h"
11 11
12 #define FOURCC(a, b, c, d) \ 12 #define FOURCC(a, b, c, d) \
13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ 13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \
14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) 14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24))
15 15
16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') 16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ')
17 #define DRM_FORMAT_GR88 FOURCC('G', 'R', '8', '8') 17 #define DRM_FORMAT_GR88 FOURCC('G', 'R', '8', '8')
18 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') 18 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6')
19 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') 19 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4')
20 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') 20 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4')
21 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') 21 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
22 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') 22 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4')
23 #define DRM_FORMAT_YVU420 FOURCC('Y', 'V', '1', '2') 23 #define DRM_FORMAT_YVU420 FOURCC('Y', 'V', '1', '2')
24 #define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2') 24 #define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2')
25 25
26 namespace ui { 26 namespace gl {
27 namespace { 27 namespace {
28 28
29 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) { 29 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) {
30 switch (internalformat) { 30 switch (internalformat) {
31 case GL_RGB: 31 case GL_RGB:
32 return format == gfx::BufferFormat::BGR_565 || 32 return format == gfx::BufferFormat::BGR_565 ||
33 format == gfx::BufferFormat::RGBX_8888 || 33 format == gfx::BufferFormat::RGBX_8888 ||
34 format == gfx::BufferFormat::BGRX_8888; 34 format == gfx::BufferFormat::BGRX_8888;
35 case GL_RGB_YCRCB_420_CHROMIUM: 35 case GL_RGB_YCRCB_420_CHROMIUM:
36 return format == gfx::BufferFormat::YVU_420; 36 return format == gfx::BufferFormat::YVU_420;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 GLImageNativePixmap::GLImageNativePixmap(const gfx::Size& size, 115 GLImageNativePixmap::GLImageNativePixmap(const gfx::Size& size,
116 unsigned internalformat) 116 unsigned internalformat)
117 : GLImageEGL(size), 117 : GLImageEGL(size),
118 internalformat_(internalformat), 118 internalformat_(internalformat),
119 has_image_flush_external_( 119 has_image_flush_external_(
120 gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_flush_external")) {} 120 gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_flush_external")) {}
121 121
122 GLImageNativePixmap::~GLImageNativePixmap() {} 122 GLImageNativePixmap::~GLImageNativePixmap() {}
123 123
124 bool GLImageNativePixmap::Initialize(NativePixmap* pixmap, 124 bool GLImageNativePixmap::Initialize(gfx::NativePixmap* pixmap,
125 gfx::BufferFormat format) { 125 gfx::BufferFormat format) {
126 DCHECK(!pixmap_); 126 DCHECK(!pixmap_);
127 if (pixmap->GetEGLClientBuffer()) { 127 if (pixmap->GetEGLClientBuffer()) {
128 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; 128 EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
129 if (!GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR, 129 if (!GLImageEGL::Initialize(EGL_NATIVE_PIXMAP_KHR,
130 pixmap->GetEGLClientBuffer(), attrs)) { 130 pixmap->GetEGLClientBuffer(), attrs)) {
131 return false; 131 return false;
132 } 132 }
133 } else if (pixmap->AreDmaBufFdsValid()) { 133 } else if (pixmap->AreDmaBufFdsValid()) {
134 if (!ValidFormat(format)) { 134 if (!ValidFormat(format)) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 case gfx::BufferFormat::RGBA_4444: 270 case gfx::BufferFormat::RGBA_4444:
271 case gfx::BufferFormat::UYVY_422: 271 case gfx::BufferFormat::UYVY_422:
272 NOTREACHED(); 272 NOTREACHED();
273 return GL_NONE; 273 return GL_NONE;
274 } 274 }
275 275
276 NOTREACHED(); 276 NOTREACHED();
277 return GL_NONE; 277 return GL_NONE;
278 } 278 }
279 279
280 } // namespace ui 280 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_native_pixmap.h ('k') | ui/ozone/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698