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

Unified Diff: ui/ozone/gl/gl_image_ozone_native_pixmap.cc

Issue 2102443003: Break //ui/gl/ dependency on //ui/ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_bindings
Patch Set: GYP again. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/gl/gl_image_ozone_native_pixmap.cc
diff --git a/ui/gl/gl_image_ozone_native_pixmap.cc b/ui/ozone/gl/gl_image_ozone_native_pixmap.cc
similarity index 93%
rename from ui/gl/gl_image_ozone_native_pixmap.cc
rename to ui/ozone/gl/gl_image_ozone_native_pixmap.cc
index 0475abf9c6af5bd6278824a1dc5cb18848b238f2..55a85b98709f2a8875d8b844a77636ed2ed36691 100644
--- a/ui/gl/gl_image_ozone_native_pixmap.cc
+++ b/ui/ozone/gl/gl_image_ozone_native_pixmap.cc
@@ -1,9 +1,12 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
+
+#include <vector>
+
#include "ui/gfx/buffer_format_util.h"
-#include "ui/gl/gl_image_ozone_native_pixmap.h"
#include "ui/gl/gl_surface_egl.h"
#define FOURCC(a, b, c, d) \
@@ -18,7 +21,7 @@
#define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4')
#define DRM_FORMAT_YV12 FOURCC('Y', 'V', '1', '2')
-namespace gl {
+namespace ui {
namespace {
bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) {
@@ -103,10 +106,9 @@ GLImageOzoneNativePixmap::GLImageOzoneNativePixmap(const gfx::Size& size,
unsigned internalformat)
: GLImageEGL(size), internalformat_(internalformat) {}
-GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() {
-}
+GLImageOzoneNativePixmap::~GLImageOzoneNativePixmap() {}
-bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap,
+bool GLImageOzoneNativePixmap::Initialize(NativePixmap* pixmap,
gfx::BufferFormat format) {
DCHECK(!pixmap_);
if (pixmap->GetEGLClientBuffer()) {
@@ -116,7 +118,6 @@ bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap,
return false;
}
} else if (pixmap->AreDmaBufFdsValid()) {
-
if (!ValidFormat(format)) {
LOG(ERROR) << "Invalid format: " << static_cast<int>(format);
return false;
@@ -141,8 +142,8 @@ bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap,
const EGLint kLinuxDrmModifiers[] = {EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT,
EGL_LINUX_DRM_PLANE1_MODIFIER0_EXT,
EGL_LINUX_DRM_PLANE2_MODIFIER0_EXT};
- bool has_dma_buf_import_modifier =
- GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_dma_buf_import_modifiers");
+ bool has_dma_buf_import_modifier = gl::GLSurfaceEGL::HasEGLExtension(
+ "EGL_EXT_image_dma_buf_import_modifiers");
for (size_t plane = 0;
plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat());
@@ -189,9 +190,8 @@ bool GLImageOzoneNativePixmap::CopyTexImage(unsigned target) {
// Pass-through image type fails to bind and copy; make sure we
// don't draw with uninitialized texture.
std::vector<unsigned char> data(size_.width() * size_.height() * 4);
- glTexImage2D(target, 0, GL_RGBA, size_.width(),
- size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
- data.data());
+ glTexImage2D(target, 0, GL_RGBA, size_.width(), size_.height(), 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, data.data());
return true;
}
return GLImageEGL::CopyTexImage(target);
@@ -247,4 +247,4 @@ unsigned GLImageOzoneNativePixmap::GetInternalFormatForTesting(
return GL_NONE;
}
-} // namespace gl
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698