blob: b48b687957c2fae695e31f55554e599a821dd53d [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"
reveman6b683f22015-05-22 02:38:329#include "ui/gfx/geometry/point.h"
tfarina3b0452d2014-12-31 15:20:0910#include "ui/gfx/geometry/rect.h"
11#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3212#include "ui/gfx/geometry/size.h"
[email protected]5e57db72014-08-01 21:50:1713#include "ui/gfx/native_widget_types.h"
14#include "ui/gfx/overlay_transform.h"
[email protected]09d50362012-10-18 20:54:3715#include "ui/gl/gl_export.h"
16
17namespace gfx {
18
[email protected]09d50362012-10-18 20:54:3719// Encapsulates an image that can be bound to a texture, hiding platform
20// specific management.
21class GL_EXPORT GLImage : public base::RefCounted<GLImage> {
22 public:
revemanc0c002b2014-09-29 21:46:2323 GLImage() {}
[email protected]09d50362012-10-18 20:54:3724
25 // Destroys the image.
[email protected]d2eaf52f2014-07-31 15:01:2426 virtual void Destroy(bool have_context) = 0;
[email protected]09d50362012-10-18 20:54:3727
28 // Get the size of the image.
29 virtual gfx::Size GetSize() = 0;
30
christiank55ddebb2015-05-18 08:56:3231 // Get the internal format of the image.
32 virtual unsigned GetInternalFormat() = 0;
33
[email protected]3c580122013-11-22 07:52:2634 // Bind image to texture currently bound to |target|.
[email protected]463c12b2014-03-15 00:25:4935 virtual bool BindTexImage(unsigned target) = 0;
[email protected]09d50362012-10-18 20:54:3736
[email protected]3c580122013-11-22 07:52:2637 // Release image from texture currently bound to |target|.
[email protected]463c12b2014-03-15 00:25:4938 virtual void ReleaseTexImage(unsigned target) = 0;
[email protected]09d50362012-10-18 20:54:3739
reveman6b683f22015-05-22 02:38:3240 // Copy |rect| of image to |offset| in texture currently bound to |target|.
41 virtual bool CopyTexSubImage(unsigned target,
42 const Point& offset,
43 const Rect& rect) = 0;
revemance8fbe82014-09-05 02:19:5244
[email protected]91c94eb2013-10-22 10:32:5445 // Called before the texture is used for drawing.
[email protected]463c12b2014-03-15 00:25:4946 virtual void WillUseTexImage() = 0;
[email protected]91c94eb2013-10-22 10:32:5447
48 // Called after the texture has been used for drawing.
[email protected]463c12b2014-03-15 00:25:4949 virtual void DidUseTexImage() = 0;
[email protected]91c94eb2013-10-22 10:32:5450
[email protected]00c2cf92014-03-14 00:08:3751 // Called before the texture image data will be modified.
[email protected]463c12b2014-03-15 00:25:4952 virtual void WillModifyTexImage() = 0;
[email protected]00c2cf92014-03-14 00:08:3753
54 // Called after the texture image data has been modified.
[email protected]463c12b2014-03-15 00:25:4955 virtual void DidModifyTexImage() = 0;
[email protected]00c2cf92014-03-14 00:08:3756
[email protected]5e57db72014-08-01 21:50:1757 // Schedule image as an overlay plane to be shown at swap time for |widget|.
58 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
59 int z_order,
60 OverlayTransform transform,
61 const Rect& bounds_rect,
62 const RectF& crop_rect) = 0;
63
[email protected]09d50362012-10-18 20:54:3764 protected:
revemanc0c002b2014-09-29 21:46:2365 virtual ~GLImage() {}
[email protected]09d50362012-10-18 20:54:3766
67 private:
68 friend class base::RefCounted<GLImage>;
69
70 DISALLOW_COPY_AND_ASSIGN(GLImage);
71};
72
73} // namespace gfx
74
75#endif // UI_GL_GL_IMAGE_H_