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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_id); |
| 86 void set_was_painted_to(uint64 surface_id, |
| 87 const gfx::Rect& update_rect); |
86 | 88 |
87 // Notifies the container that its surface is invalid. | 89 // Notifies the container that its surface is invalid. |
88 void set_surface_invalid() { was_painted_to_ = false; } | 90 void set_surface_invalid() { was_painted_to_ = false; } |
89 private: | 91 private: |
| 92 // Enqueue our texture for later deletion. |
| 93 void EnqueueTextureForDeletion(); |
| 94 |
| 95 void set_was_painted_to_common(uint64 surface_id); |
| 96 |
90 // The manager of this accelerated surface container. | 97 // The manager of this accelerated surface container. |
91 AcceleratedSurfaceContainerManagerMac* manager_; | 98 AcceleratedSurfaceContainerManagerMac* manager_; |
92 | 99 |
93 // Whether this accelerated surface's content is supposed to be opaque. | 100 // Whether this accelerated surface's content is supposed to be opaque. |
94 bool opaque_; | 101 bool opaque_; |
95 | 102 |
96 // The IOSurfaceRef, if any, that has been handed from the GPU | 103 // The IOSurfaceRef, if any, that has been handed from the GPU |
97 // plugin process back to the browser process for drawing. | 104 // plugin process back to the browser process for drawing. |
98 // 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 |
99 // IOSurfaceRef type when building on 10.5. | 106 // IOSurfaceRef type when building on 10.5. |
(...skipping 22 matching lines...) Expand all Loading... |
122 // The "live" OpenGL texture referring to this IOSurfaceRef. Note | 129 // The "live" OpenGL texture referring to this IOSurfaceRef. Note |
123 // that per the CGLTexImageIOSurface2D API we do not need to | 130 // that per the CGLTexImageIOSurface2D API we do not need to |
124 // explicitly update this texture's contents once created. All we | 131 // explicitly update this texture's contents once created. All we |
125 // need to do is ensure it is re-bound before attempting to draw | 132 // need to do is ensure it is re-bound before attempting to draw |
126 // with it. | 133 // with it. |
127 GLuint texture_; | 134 GLuint texture_; |
128 | 135 |
129 // True if we need to upload the texture again during the next draw. | 136 // True if we need to upload the texture again during the next draw. |
130 bool texture_needs_upload_; | 137 bool texture_needs_upload_; |
131 | 138 |
| 139 // The region that was updated via a partial update. |update_rect_.IsEmpty()| |
| 140 // indicates that the whole region was updated. |
| 141 gfx::Rect update_rect_; |
| 142 |
132 // This may refer to an old version of the texture if the container is | 143 // This may refer to an old version of the texture if the container is |
133 // resized, for example. | 144 // resized, for example. |
134 GLuint texture_pending_deletion_; | 145 GLuint texture_pending_deletion_; |
135 | 146 |
136 // Stores if the plugin has a visible state. | 147 // Stores if the plugin has a visible state. |
137 bool visible_; | 148 bool visible_; |
138 | 149 |
139 // 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 |
140 // it before it hasn't been painted to at least once. | 151 // it before it hasn't been painted to at least once. |
141 bool was_painted_to_; | 152 bool was_painted_to_; |
142 | 153 |
143 // Releases the IOSurface reference, if any, retained by this object. | |
144 void ReleaseIOSurface(); | |
145 | |
146 // Enqueue our texture for later deletion. | |
147 void EnqueueTextureForDeletion(); | |
148 | |
149 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); | 154 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); |
150 }; | 155 }; |
151 | 156 |
152 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ | 157 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MAC_H_ |
OLD | NEW |