Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / gl / gl_image_egl.cc
blobdf4ce31d5af0ec9c3ea10df1c9e85b24b543d4c2
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/egl_util.h"
8 #include "ui/gl/gl_surface_egl.h"
10 namespace gfx {
12 GLImageEGL::GLImageEGL(const gfx::Size& size)
13 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {
16 GLImageEGL::~GLImageEGL() {
17 DCHECK(thread_checker_.CalledOnValidThread());
18 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
21 bool GLImageEGL::Initialize(EGLenum target,
22 EGLClientBuffer buffer,
23 const EGLint* attrs) {
24 DCHECK(thread_checker_.CalledOnValidThread());
25 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
26 egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
27 EGL_NO_CONTEXT,
28 target,
29 buffer,
30 attrs);
31 if (egl_image_ == EGL_NO_IMAGE_KHR) {
32 DLOG(ERROR) << "Error creating EGLImage: " << ui::GetLastEGLErrorString();
33 return false;
36 return true;
39 void GLImageEGL::Destroy(bool have_context) {
40 DCHECK(thread_checker_.CalledOnValidThread());
41 if (egl_image_ != EGL_NO_IMAGE_KHR) {
42 EGLBoolean result =
43 eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image_);
44 if (result == EGL_FALSE) {
45 DLOG(ERROR) << "Error destroying EGLImage: "
46 << ui::GetLastEGLErrorString();
48 egl_image_ = EGL_NO_IMAGE_KHR;
52 gfx::Size GLImageEGL::GetSize() { return size_; }
54 bool GLImageEGL::BindTexImage(unsigned target) {
55 DCHECK(thread_checker_.CalledOnValidThread());
56 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_);
57 glEGLImageTargetTexture2DOES(target, egl_image_);
58 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
59 return true;
62 bool GLImageEGL::CopyTexImage(unsigned target) {
63 return false;
66 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
67 int z_order,
68 OverlayTransform transform,
69 const Rect& bounds_rect,
70 const RectF& crop_rect) {
71 return false;
74 } // namespace gfx