| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // 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 |
| 70 // 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 |
| 71 // coordinate system will work out. | 71 // coordinate system will work out. |
| 72 void Draw(CGLContextObj context); | 72 void Draw(CGLContextObj context); |
| 73 | 73 |
| 74 // 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 |
| 75 // time the drawing context has changed. | 75 // time the drawing context has changed. |
| 76 void ForceTextureReload() { texture_needs_upload_ = true; } | 76 void ForceTextureReload() { texture_needs_upload_ = true; } |
| 77 | 77 |
| 78 // Notifies the surface that it was painted to. |
| 79 void set_was_painted_to() { was_painted_to_ = true; } |
| 80 |
| 81 // Returns if the surface should be shown. |
| 82 bool should_be_visible() const { return visible_ && was_painted_to_; } |
| 78 private: | 83 private: |
| 79 // The manager of this accelerated surface container. | 84 // The manager of this accelerated surface container. |
| 80 AcceleratedSurfaceContainerManagerMac* manager_; | 85 AcceleratedSurfaceContainerManagerMac* manager_; |
| 81 | 86 |
| 82 // Whether this accelerated surface's content is supposed to be opaque. | 87 // Whether this accelerated surface's content is supposed to be opaque. |
| 83 bool opaque_; | 88 bool opaque_; |
| 84 | 89 |
| 85 // The IOSurfaceRef, if any, that has been handed from the GPU | 90 // The IOSurfaceRef, if any, that has been handed from the GPU |
| 86 // plugin process back to the browser process for drawing. | 91 // plugin process back to the browser process for drawing. |
| 87 // This is held as a CFTypeRef because we can't refer to the | 92 // This is held as a CFTypeRef because we can't refer to the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 107 // with it. | 112 // with it. |
| 108 GLuint texture_; | 113 GLuint texture_; |
| 109 | 114 |
| 110 // True if we need to upload the texture again during the next draw. | 115 // True if we need to upload the texture again during the next draw. |
| 111 bool texture_needs_upload_; | 116 bool texture_needs_upload_; |
| 112 | 117 |
| 113 // This may refer to an old version of the texture if the container is | 118 // This may refer to an old version of the texture if the container is |
| 114 // resized, for example. | 119 // resized, for example. |
| 115 GLuint texture_pending_deletion_; | 120 GLuint texture_pending_deletion_; |
| 116 | 121 |
| 122 // Stores if the plugin has a visible state. |
| 123 bool visible_; |
| 124 |
| 125 // Stores if the plugin's IOSurface has been swapped before. Used to not show |
| 126 // it before it hasn't been painted to at least once. |
| 127 bool was_painted_to_; |
| 128 |
| 117 // Releases the IOSurface reference, if any, retained by this object. | 129 // Releases the IOSurface reference, if any, retained by this object. |
| 118 void ReleaseIOSurface(); | 130 void ReleaseIOSurface(); |
| 119 | 131 |
| 120 // Enqueue our texture for later deletion. | 132 // Enqueue our texture for later deletion. |
| 121 void EnqueueTextureForDeletion(); | 133 void EnqueueTextureForDeletion(); |
| 122 | 134 |
| 123 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); | 135 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ | 138 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ |
| 127 | 139 |
| OLD | NEW |