1 // Copyright 2014 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 #ifndef UI_GL_GL_IMAGE_MEMORY_H_
6 #define UI_GL_GL_IMAGE_MEMORY_H_
8 #include "ui/gl/gl_image.h"
10 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
13 #include <EGL/eglext.h>
18 class GL_EXPORT GLImageMemory
: public GLImage
{
20 GLImageMemory(const gfx::Size
& size
, unsigned internalformat
);
22 bool Initialize(const unsigned char* memory
);
24 // Overridden from GLImage:
25 virtual void Destroy(bool have_context
) OVERRIDE
;
26 virtual gfx::Size
GetSize() OVERRIDE
;
27 virtual bool BindTexImage(unsigned target
) OVERRIDE
;
28 virtual void ReleaseTexImage(unsigned target
) OVERRIDE
{}
29 virtual bool CopyTexImage(unsigned target
) OVERRIDE
;
30 virtual void WillUseTexImage() OVERRIDE
;
31 virtual void DidUseTexImage() OVERRIDE
;
32 virtual void WillModifyTexImage() OVERRIDE
{}
33 virtual void DidModifyTexImage() OVERRIDE
{}
34 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget
,
36 OverlayTransform transform
,
37 const Rect
& bounds_rect
,
38 const RectF
& crop_rect
) OVERRIDE
;
41 virtual ~GLImageMemory();
43 bool HasValidFormat() const;
47 void DoBindTexImage(unsigned target
);
49 const unsigned char* memory_
;
50 const gfx::Size size_
;
51 const unsigned internalformat_
;
54 bool need_do_bind_tex_image_
;
55 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
57 unsigned egl_texture_id_
;
58 EGLImageKHR egl_image_
;
61 DISALLOW_COPY_AND_ASSIGN(GLImageMemory
);
66 #endif // UI_GL_GL_IMAGE_MEMORY_H_