OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_GL_IMAGE_H_ | 5 #ifndef UI_GL_GL_IMAGE_H_ |
6 #define UI_GL_GL_IMAGE_H_ | 6 #define UI_GL_GL_IMAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gfx/overlay_transform.h" | 16 #include "ui/gfx/overlay_transform.h" |
17 #include "ui/gl/gl_export.h" | 17 #include "ui/gl/gl_export.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 namespace trace_event { | 20 namespace trace_event { |
21 class ProcessMemoryDump; | 21 class ProcessMemoryDump; |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gl { |
26 | 26 |
27 // Encapsulates an image that can be bound and/or copied to a texture, hiding | 27 // Encapsulates an image that can be bound and/or copied to a texture, hiding |
28 // platform specific management. | 28 // platform specific management. |
29 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { | 29 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { |
30 public: | 30 public: |
31 GLImage() {} | 31 GLImage() {} |
32 | 32 |
33 // Destroys the image. | 33 // Destroys the image. |
34 virtual void Destroy(bool have_context) = 0; | 34 virtual void Destroy(bool have_context) = 0; |
35 | 35 |
36 // Get the size of the image. | 36 // Get the size of the image. |
37 virtual Size GetSize() = 0; | 37 virtual gfx::Size GetSize() = 0; |
38 | 38 |
39 // Get the internal format of the image. | 39 // Get the internal format of the image. |
40 virtual unsigned GetInternalFormat() = 0; | 40 virtual unsigned GetInternalFormat() = 0; |
41 | 41 |
42 // Bind image to texture currently bound to |target|. Returns true on success. | 42 // Bind image to texture currently bound to |target|. Returns true on success. |
43 // It is valid for an implementation to always return false. | 43 // It is valid for an implementation to always return false. |
44 virtual bool BindTexImage(unsigned target) = 0; | 44 virtual bool BindTexImage(unsigned target) = 0; |
45 | 45 |
46 // Release image from texture currently bound to |target|. | 46 // Release image from texture currently bound to |target|. |
47 virtual void ReleaseTexImage(unsigned target) = 0; | 47 virtual void ReleaseTexImage(unsigned target) = 0; |
48 | 48 |
49 // Define texture currently bound to |target| by copying image into it. | 49 // Define texture currently bound to |target| by copying image into it. |
50 // Returns true on success. It is valid for an implementation to always | 50 // Returns true on success. It is valid for an implementation to always |
51 // return false. | 51 // return false. |
52 virtual bool CopyTexImage(unsigned target) = 0; | 52 virtual bool CopyTexImage(unsigned target) = 0; |
53 | 53 |
54 // Copy |rect| of image to |offset| in texture currently bound to |target|. | 54 // Copy |rect| of image to |offset| in texture currently bound to |target|. |
55 // Returns true on success. It is valid for an implementation to always | 55 // Returns true on success. It is valid for an implementation to always |
56 // return false. | 56 // return false. |
57 virtual bool CopyTexSubImage(unsigned target, | 57 virtual bool CopyTexSubImage(unsigned target, |
58 const Point& offset, | 58 const gfx::Point& offset, |
59 const Rect& rect) = 0; | 59 const gfx::Rect& rect) = 0; |
60 | 60 |
61 // Schedule image as an overlay plane to be shown at swap time for |widget|. | 61 // Schedule image as an overlay plane to be shown at swap time for |widget|. |
62 virtual bool ScheduleOverlayPlane(AcceleratedWidget widget, | 62 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
63 int z_order, | 63 int z_order, |
64 OverlayTransform transform, | 64 gfx::OverlayTransform transform, |
65 const Rect& bounds_rect, | 65 const gfx::Rect& bounds_rect, |
66 const RectF& crop_rect) = 0; | 66 const gfx::RectF& crop_rect) = 0; |
67 | 67 |
68 // Dumps information about the memory backing the GLImage to a dump named | 68 // Dumps information about the memory backing the GLImage to a dump named |
69 // |dump_name|. | 69 // |dump_name|. |
70 virtual void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 70 virtual void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
71 uint64_t process_tracing_id, | 71 uint64_t process_tracing_id, |
72 const std::string& dump_name) = 0; | 72 const std::string& dump_name) = 0; |
73 | 73 |
74 protected: | 74 protected: |
75 virtual ~GLImage() {} | 75 virtual ~GLImage() {} |
76 | 76 |
77 private: | 77 private: |
78 friend class base::RefCounted<GLImage>; | 78 friend class base::RefCounted<GLImage>; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(GLImage); | 80 DISALLOW_COPY_AND_ASSIGN(GLImage); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace gfx | 83 } // namespace gl |
84 | 84 |
85 #endif // UI_GL_GL_IMAGE_H_ | 85 #endif // UI_GL_GL_IMAGE_H_ |
OLD | NEW |