blob: ba8b39a11fbe562a976026ed545db29105928ea5 [file] [log] [blame]
[email protected]09d50362012-10-18 20:54:371// Copyright (c) 2012 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.
4
5#ifndef UI_GL_GL_IMAGE_H_
6#define UI_GL_GL_IMAGE_H_
7
8#include "base/memory/ref_counted.h"
9#include "ui/gfx/native_widget_types.h"
10#include "ui/gfx/size.h"
[email protected]09d50362012-10-18 20:54:3711#include "ui/gl/gl_export.h"
12
13namespace gfx {
14
15class GLSurface;
16
17// Encapsulates an image that can be bound to a texture, hiding platform
18// specific management.
19class GL_EXPORT GLImage : public base::RefCounted<GLImage> {
20 public:
21 GLImage();
22
23 // Destroys the image.
24 virtual void Destroy() = 0;
25
26 // Get the size of the image.
27 virtual gfx::Size GetSize() = 0;
28
29 // Bind image to texture currently bound to GL_TEXTURE_2D target.
30 virtual bool BindTexImage();
31
32 // Release image from texture currently bound to GL_TEXTURE_2D target.
33 virtual void ReleaseTexImage();
34
35 // Create a GL image for a window.
36 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window);
37
[email protected]b8160812013-04-09 00:41:0438 // Create a GL image for a GPU Memory buffer.
39 static scoped_refptr<GLImage> CreateGLImageForGpuMemoryBuffer(
40 gfx::GpuMemoryBufferHandle buffer, gfx::Size size);
41
[email protected]09d50362012-10-18 20:54:3742 protected:
43 virtual ~GLImage();
44
45 private:
46 friend class base::RefCounted<GLImage>;
47
48 DISALLOW_COPY_AND_ASSIGN(GLImage);
49};
50
51} // namespace gfx
52
53#endif // UI_GL_GL_IMAGE_H_