blob: 214241396becbf60949ed713278eb9ee3323c782 [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"
tfarina3b0452d2014-12-31 15:20:099#include "ui/gfx/geometry/rect.h"
10#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3211#include "ui/gfx/geometry/size.h"
[email protected]5e57db72014-08-01 21:50:1712#include "ui/gfx/native_widget_types.h"
13#include "ui/gfx/overlay_transform.h"
[email protected]09d50362012-10-18 20:54:3714#include "ui/gl/gl_export.h"
15
16namespace gfx {
17
[email protected]09d50362012-10-18 20:54:3718// Encapsulates an image that can be bound to a texture, hiding platform
19// specific management.
20class GL_EXPORT GLImage : public base::RefCounted<GLImage> {
21 public:
revemanc0c002b2014-09-29 21:46:2322 GLImage() {}
[email protected]09d50362012-10-18 20:54:3723
24 // Destroys the image.
[email protected]d2eaf52f2014-07-31 15:01:2425 virtual void Destroy(bool have_context) = 0;
[email protected]09d50362012-10-18 20:54:3726
27 // Get the size of the image.
28 virtual gfx::Size GetSize() = 0;
29
[email protected]3c580122013-11-22 07:52:2630 // Bind image to texture currently bound to |target|.
[email protected]463c12b2014-03-15 00:25:4931 virtual bool BindTexImage(unsigned target) = 0;
[email protected]09d50362012-10-18 20:54:3732
[email protected]3c580122013-11-22 07:52:2633 // Release image from texture currently bound to |target|.
[email protected]463c12b2014-03-15 00:25:4934 virtual void ReleaseTexImage(unsigned target) = 0;
[email protected]09d50362012-10-18 20:54:3735
revemance8fbe82014-09-05 02:19:5236 // Copy image to texture currently bound to |target|.
37 virtual bool CopyTexImage(unsigned target) = 0;
38
[email protected]91c94eb2013-10-22 10:32:5439 // Called before the texture is used for drawing.
[email protected]463c12b2014-03-15 00:25:4940 virtual void WillUseTexImage() = 0;
[email protected]91c94eb2013-10-22 10:32:5441
42 // Called after the texture has been used for drawing.
[email protected]463c12b2014-03-15 00:25:4943 virtual void DidUseTexImage() = 0;
[email protected]91c94eb2013-10-22 10:32:5444
[email protected]00c2cf92014-03-14 00:08:3745 // Called before the texture image data will be modified.
[email protected]463c12b2014-03-15 00:25:4946 virtual void WillModifyTexImage() = 0;
[email protected]00c2cf92014-03-14 00:08:3747
48 // Called after the texture image data has been modified.
[email protected]463c12b2014-03-15 00:25:4949 virtual void DidModifyTexImage() = 0;
[email protected]00c2cf92014-03-14 00:08:3750
[email protected]5e57db72014-08-01 21:50:1751 // Schedule image as an overlay plane to be shown at swap time for |widget|.
52 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
53 int z_order,
54 OverlayTransform transform,
55 const Rect& bounds_rect,
56 const RectF& crop_rect) = 0;
57
[email protected]09d50362012-10-18 20:54:3758 protected:
revemanc0c002b2014-09-29 21:46:2359 virtual ~GLImage() {}
[email protected]09d50362012-10-18 20:54:3760
61 private:
62 friend class base::RefCounted<GLImage>;
63
64 DISALLOW_COPY_AND_ASSIGN(GLImage);
65};
66
67} // namespace gfx
68
69#endif // UI_GL_GL_IMAGE_H_