OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // The "GPU plugin" is currently implemented as a special kind of | 9 // The "GPU plugin" is currently implemented as a special kind of |
10 // NPAPI plugin to provide high-performance on-screen 3D rendering for | 10 // NPAPI plugin to provide high-performance on-screen 3D rendering for |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void Draw(CGLContextObj context); | 75 void Draw(CGLContextObj context); |
76 | 76 |
77 // Causes the next Draw call to trigger a texture upload. Should be called any | 77 // Causes the next Draw call to trigger a texture upload. Should be called any |
78 // time the drawing context has changed. | 78 // time the drawing context has changed. |
79 void ForceTextureReload() { texture_needs_upload_ = true; } | 79 void ForceTextureReload() { texture_needs_upload_ = true; } |
80 | 80 |
81 // Returns if the surface should be shown. | 81 // Returns if the surface should be shown. |
82 bool ShouldBeVisible() const; | 82 bool ShouldBeVisible() const; |
83 | 83 |
84 // Notifies the the container that its surface was painted to. | 84 // Notifies the the container that its surface was painted to. |
85 void set_was_painted_to(uint64 surface_id); | 85 void set_was_painted_to(uint64 surface_handle); |
86 void set_was_painted_to(uint64 surface_id, | 86 void set_was_painted_to(uint64 surface_handle, |
87 const gfx::Rect& update_rect); | 87 const gfx::Rect& update_rect); |
88 | 88 |
89 // Notifies the container that its surface is invalid. | 89 // Notifies the container that its surface is invalid. |
90 void set_surface_invalid() { was_painted_to_ = false; } | 90 void set_surface_invalid() { was_painted_to_ = false; } |
91 private: | 91 private: |
92 // Enqueue our texture for later deletion. | 92 // Enqueue our texture for later deletion. |
93 void EnqueueTextureForDeletion(); | 93 void EnqueueTextureForDeletion(); |
94 | 94 |
95 void set_was_painted_to_common(uint64 surface_id); | 95 void set_was_painted_to_common(uint64 surface_handle); |
96 | 96 |
97 // The manager of this accelerated surface container. | 97 // The manager of this accelerated surface container. |
98 AcceleratedSurfaceContainerManagerMac* manager_; | 98 AcceleratedSurfaceContainerManagerMac* manager_; |
99 | 99 |
100 // Whether this accelerated surface's content is supposed to be opaque. | 100 // Whether this accelerated surface's content is supposed to be opaque. |
101 bool opaque_; | 101 bool opaque_; |
102 | 102 |
103 // The IOSurfaceRef, if any, that has been handed from the GPU | 103 // The IOSurfaceRef, if any, that has been handed from the GPU |
104 // plugin process back to the browser process for drawing. | 104 // plugin process back to the browser process for drawing. |
105 // This is held as a CFTypeRef because we can't refer to the | 105 // This is held as a CFTypeRef because we can't refer to the |
106 // IOSurfaceRef type when building on 10.5. | 106 // IOSurfaceRef type when building on 10.5. |
107 base::mac::ScopedCFTypeRef<CFTypeRef> surface_; | 107 base::mac::ScopedCFTypeRef<CFTypeRef> surface_; |
108 | 108 |
109 // The id of |surface_|, or 0 if |surface_| is NULL. | 109 // The handle of |surface_|, or 0 if |surface_| is NULL. |
110 uint64 surface_id_; | 110 uint64 surface_handle_; |
111 | 111 |
112 // The width and height of the io surface. During resizing, this is different | 112 // The width and height of the io surface. During resizing, this is different |
113 // from |width_| and |height_|. | 113 // from |width_| and |height_|. |
114 int32 surface_width_; | 114 int32 surface_width_; |
115 int32 surface_height_; | 115 int32 surface_height_; |
116 | 116 |
117 // The TransportDIB which is used in pre-10.6 systems where the IOSurface | 117 // The TransportDIB which is used in pre-10.6 systems where the IOSurface |
118 // API is not supported. This is a weak reference to the actual TransportDIB | 118 // API is not supported. This is a weak reference to the actual TransportDIB |
119 // whic is owned by the GPU process. | 119 // whic is owned by the GPU process. |
120 scoped_ptr<TransportDIB> transport_dib_; | 120 scoped_ptr<TransportDIB> transport_dib_; |
(...skipping 27 matching lines...) Expand all Loading... |
148 bool visible_; | 148 bool visible_; |
149 | 149 |
150 // Stores if the plugin's IOSurface has been swapped before. Used to not show | 150 // Stores if the plugin's IOSurface has been swapped before. Used to not show |
151 // it before it hasn't been painted to at least once. | 151 // it before it hasn't been painted to at least once. |
152 bool was_painted_to_; | 152 bool was_painted_to_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); | 154 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); |
155 }; | 155 }; |
156 | 156 |
157 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ | 157 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ |
OLD | NEW |