OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // There are two versions: the IOSurface version is used on systems where the | 52 // There are two versions: the IOSurface version is used on systems where the |
53 // IOSurface API is supported (Mac OS X 10.6 and later); the TransportDIB is | 53 // IOSurface API is supported (Mac OS X 10.6 and later); the TransportDIB is |
54 // used on Mac OS X 10.5 and earlier. | 54 // used on Mac OS X 10.5 and earlier. |
55 void SetSizeAndIOSurface(int32 width, | 55 void SetSizeAndIOSurface(int32 width, |
56 int32 height, | 56 int32 height, |
57 uint64 io_surface_identifier); | 57 uint64 io_surface_identifier); |
58 void SetSizeAndTransportDIB(int32 width, | 58 void SetSizeAndTransportDIB(int32 width, |
59 int32 height, | 59 int32 height, |
60 TransportDIB::Handle transport_dib); | 60 TransportDIB::Handle transport_dib); |
61 | 61 |
62 // Tells the accelerated surface container that it has moved relative to the | 62 // Tells the accelerated surface container that its geometry has changed, |
63 // origin of the window, for example because of a scroll event. | 63 // for example because of a scroll event. (Note that the container |
64 void MoveTo(const webkit_glue::WebPluginGeometry& geom); | 64 // currently only pays attention to the clip width and height, since the |
| 65 // view in which it is hosted is responsible for positioning it on the |
| 66 // page.) |
| 67 void SetGeometry(const webkit_glue::WebPluginGeometry& geom); |
65 | 68 |
66 // Draws this accelerated surface's contents, texture mapped onto a quad in | 69 // Draws this accelerated surface's contents, texture mapped onto a quad in |
67 // the given OpenGL context. TODO(kbr): figure out and define exactly how the | 70 // the given OpenGL context. TODO(kbr): figure out and define exactly how the |
68 // coordinate system will work out. | 71 // coordinate system will work out. |
69 void Draw(CGLContextObj context); | 72 void Draw(CGLContextObj context); |
70 | 73 |
71 // Causes the next Draw call to trigger a texture upload. Should be called any | 74 // Causes the next Draw call to trigger a texture upload. Should be called any |
72 // time the drawing context has changed. | 75 // time the drawing context has changed. |
73 void ForceTextureReload() { texture_needs_upload_ = true; } | 76 void ForceTextureReload() { texture_needs_upload_ = true; } |
74 | 77 |
(...skipping 25 matching lines...) Expand all Loading... |
100 // The "live" OpenGL texture referring to this IOSurfaceRef. Note | 103 // The "live" OpenGL texture referring to this IOSurfaceRef. Note |
101 // that per the CGLTexImageIOSurface2D API we do not need to | 104 // that per the CGLTexImageIOSurface2D API we do not need to |
102 // explicitly update this texture's contents once created. All we | 105 // explicitly update this texture's contents once created. All we |
103 // need to do is ensure it is re-bound before attempting to draw | 106 // need to do is ensure it is re-bound before attempting to draw |
104 // with it. | 107 // with it. |
105 GLuint texture_; | 108 GLuint texture_; |
106 | 109 |
107 // True if we need to upload the texture again during the next draw. | 110 // True if we need to upload the texture again during the next draw. |
108 bool texture_needs_upload_; | 111 bool texture_needs_upload_; |
109 | 112 |
| 113 // This may refer to an old version of the texture if the container is |
| 114 // resized, for example. |
| 115 GLuint texture_pending_deletion_; |
| 116 |
110 // Releases the IOSurface reference, if any, retained by this object. | 117 // Releases the IOSurface reference, if any, retained by this object. |
111 void ReleaseIOSurface(); | 118 void ReleaseIOSurface(); |
112 | 119 |
113 // Enqueue our texture for later deletion. | 120 // Enqueue our texture for later deletion. |
114 void EnqueueTextureForDeletion(); | 121 void EnqueueTextureForDeletion(); |
115 | 122 |
116 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); | 123 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); |
117 }; | 124 }; |
118 | 125 |
119 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ | 126 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ |
120 | 127 |
OLD | NEW |