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_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ | 5 #ifndef UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ |
6 #define UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ | 6 #define UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 class IOSurfaceContext; | 33 class IOSurfaceContext; |
34 class RenderWidgetHostViewFrameSubscriber; | 34 class RenderWidgetHostViewFrameSubscriber; |
35 class RenderWidgetHostViewMac; | 35 class RenderWidgetHostViewMac; |
36 | 36 |
37 // This class manages an OpenGL context and IOSurfaceTexture for the accelerated | 37 // This class manages an OpenGL context and IOSurfaceTexture for the accelerated |
38 // compositing code path. The GL context is attached to | 38 // compositing code path. The GL context is attached to |
39 // RenderWidgetHostViewCocoa for blitting the IOSurfaceTexture. | 39 // RenderWidgetHostViewCocoa for blitting the IOSurfaceTexture. |
40 class IOSurfaceTexture | 40 class IOSurfaceTexture |
41 : public base::RefCounted<IOSurfaceTexture> { | 41 : public base::RefCounted<IOSurfaceTexture> { |
42 public: | 42 public: |
43 // Returns NULL if IOSurfaceTexture or GL API calls fail. | |
44 static scoped_refptr<IOSurfaceTexture> Create( | 43 static scoped_refptr<IOSurfaceTexture> Create( |
45 bool needs_gl_finish_workaround); | 44 bool needs_gl_finish_workaround); |
46 | 45 |
47 // Set IOSurfaceTexture that will be drawn on the next NSView drawRect. | 46 // Set IOSurfaceTexture that will be drawn on the next NSView drawRect. |
48 bool SetIOSurface( | 47 bool SetIOSurface( |
49 IOSurfaceID io_surface_id, | 48 IOSurfaceID io_surface_id, |
50 const gfx::Size& pixel_size) WARN_UNUSED_RESULT; | 49 const gfx::Size& pixel_size) WARN_UNUSED_RESULT; |
51 | 50 |
52 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs, | 51 // Blit the IOSurface to the rectangle specified by |window_rect| in DIPs, |
53 // with the origin in the lower left corner. If the window rect's size is | 52 // with the origin in the lower left corner. If the window rect's size is |
54 // larger than the IOSurface, the remaining right and bottom edges will be | 53 // larger than the IOSurface, the remaining right and bottom edges will be |
55 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. | 54 // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. |
56 bool DrawIOSurface() WARN_UNUSED_RESULT; | 55 bool DrawIOSurface() WARN_UNUSED_RESULT; |
| 56 bool DrawIOSurfaceWithDamageRect(gfx::Rect damage_rect) WARN_UNUSED_RESULT; |
57 | 57 |
58 // Returns true if the offscreen context used by this surface has been | 58 // Returns true if the offscreen context used by this surface has been |
59 // poisoned. | 59 // poisoned. |
60 bool HasBeenPoisoned() const; | 60 bool HasBeenPoisoned() const; |
61 | 61 |
62 private: | 62 private: |
63 friend class base::RefCounted<IOSurfaceTexture>; | 63 friend class base::RefCounted<IOSurfaceTexture>; |
64 | 64 |
65 IOSurfaceTexture( | 65 IOSurfaceTexture( |
66 const scoped_refptr<IOSurfaceContext>& context, | 66 const scoped_refptr<IOSurfaceContext>& context, |
67 bool needs_gl_finish_workaround); | 67 bool needs_gl_finish_workaround); |
68 ~IOSurfaceTexture(); | 68 ~IOSurfaceTexture(); |
69 | 69 |
| 70 // Draw the sepecified rect of the IOSurface. If |draw_boundary| is true, |
| 71 // clear any overflow regions with white. |
| 72 bool DrawIOSurfaceInternal(gfx::Rect damage_rect, bool draw_boundary); |
| 73 |
70 // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU | 74 // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU |
71 // process is no longer referencing it, this will delete the IOSurface. | 75 // process is no longer referencing it, this will delete the IOSurface. |
72 void ReleaseIOSurfaceAndTexture(); | 76 void ReleaseIOSurfaceAndTexture(); |
73 | 77 |
74 // Check for GL errors and store the result in error_. Only return new | 78 // Check for GL errors and store the result in error_. Only return new |
75 // errors | 79 // errors |
76 GLenum GetAndSaveGLError(); | 80 GLenum GetAndSaveGLError(); |
77 | 81 |
78 // Offscreen context used for all operations other than drawing to the | 82 // Offscreen context used for all operations other than drawing to the |
79 // screen. This is in the same share group as the contexts used for | 83 // screen. This is in the same share group as the contexts used for |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 116 |
113 static void EvictionScheduleDoEvict(); | 117 static void EvictionScheduleDoEvict(); |
114 static void EvictionDoEvict(); | 118 static void EvictionDoEvict(); |
115 static base::LazyInstance<EvictionQueue> eviction_queue_; | 119 static base::LazyInstance<EvictionQueue> eviction_queue_; |
116 static bool eviction_scheduled_; | 120 static bool eviction_scheduled_; |
117 }; | 121 }; |
118 | 122 |
119 } // namespace ui | 123 } // namespace ui |
120 | 124 |
121 #endif // UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ | 125 #endif // UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_TEXTURE_H_ |
OLD | NEW |