Update metrics verification for dev-proxy.
[chromium-blink-merge.git] / ui / gl / gl_image_egl.cc
blobb8ee78c3a371575a33b9bbb8fa4d02678bf01333
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gl/gl_image_egl.h"
7 #include "ui/gl/gl_surface_egl.h"
9 namespace gfx {
11 GLImageEGL::GLImageEGL(const gfx::Size& size)
12 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {
15 GLImageEGL::~GLImageEGL() {
16 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
19 bool GLImageEGL::Initialize(EGLenum target,
20 EGLClientBuffer buffer,
21 const EGLint* attrs) {
22 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
23 egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
24 EGL_NO_CONTEXT,
25 target,
26 buffer,
27 attrs);
28 if (egl_image_ == EGL_NO_IMAGE_KHR) {
29 EGLint error = eglGetError();
30 LOG(ERROR) << "Error creating EGLImage: " << error;
31 return false;
34 return true;
37 void GLImageEGL::Destroy(bool have_context) {
38 if (egl_image_ != EGL_NO_IMAGE_KHR) {
39 eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image_);
40 egl_image_ = EGL_NO_IMAGE_KHR;
44 gfx::Size GLImageEGL::GetSize() { return size_; }
46 bool GLImageEGL::BindTexImage(unsigned target) {
47 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_);
48 glEGLImageTargetTexture2DOES(target, egl_image_);
49 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
50 return true;
53 bool GLImageEGL::CopyTexImage(unsigned target) {
54 return false;
57 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
58 int z_order,
59 OverlayTransform transform,
60 const Rect& bounds_rect,
61 const RectF& crop_rect) {
62 return false;
65 } // namespace gfx