| 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 | 7 |
| 8 // The "GPU plugin" is currently implemented as a special kind of | 8 // The "GPU plugin" is currently implemented as a special kind of |
| 9 // NPAPI plugin to provide high-performance on-screen 3D rendering for | 9 // NPAPI plugin to provide high-performance on-screen 3D rendering for |
| 10 // Pepper 3D. | 10 // Pepper 3D. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "gfx/rect.h" | 35 #include "gfx/rect.h" |
| 36 | 36 |
| 37 namespace webkit_glue { | 37 namespace webkit_glue { |
| 38 struct WebPluginGeometry; | 38 struct WebPluginGeometry; |
| 39 } | 39 } |
| 40 | 40 |
| 41 class AcceleratedSurfaceContainerManagerMac; | 41 class AcceleratedSurfaceContainerManagerMac; |
| 42 | 42 |
| 43 class AcceleratedSurfaceContainerMac { | 43 class AcceleratedSurfaceContainerMac { |
| 44 public: | 44 public: |
| 45 AcceleratedSurfaceContainerMac(); | 45 AcceleratedSurfaceContainerMac( |
| 46 AcceleratedSurfaceContainerManagerMac* manager); |
| 46 virtual ~AcceleratedSurfaceContainerMac(); | 47 virtual ~AcceleratedSurfaceContainerMac(); |
| 47 | 48 |
| 48 // Sets the backing store and size of this accelerated surface container. | 49 // Sets the backing store and size of this accelerated surface container. |
| 49 // There are two versions: the IOSurface version is used on systems where the | 50 // There are two versions: the IOSurface version is used on systems where the |
| 50 // IOSurface API is supported (Mac OS X 10.6 and later); the TransportDIB is | 51 // IOSurface API is supported (Mac OS X 10.6 and later); the TransportDIB is |
| 51 // used on Mac OS X 10.5 and earlier. | 52 // used on Mac OS X 10.5 and earlier. |
| 52 void SetSizeAndIOSurface(int32 width, | 53 void SetSizeAndIOSurface(int32 width, |
| 53 int32 height, | 54 int32 height, |
| 54 uint64 io_surface_identifier, | 55 uint64 io_surface_identifier); |
| 55 AcceleratedSurfaceContainerManagerMac* manager); | |
| 56 void SetSizeAndTransportDIB(int32 width, | 56 void SetSizeAndTransportDIB(int32 width, |
| 57 int32 height, | 57 int32 height, |
| 58 TransportDIB::Handle transport_dib, | 58 TransportDIB::Handle transport_dib); |
| 59 AcceleratedSurfaceContainerManagerMac* manager); | |
| 60 | 59 |
| 61 // Tells the accelerated surface container that it has moved relative to the | 60 // Tells the accelerated surface container that it has moved relative to the |
| 62 // origin of the window, for example because of a scroll event. | 61 // origin of the window, for example because of a scroll event. |
| 63 void MoveTo(const webkit_glue::WebPluginGeometry& geom); | 62 void MoveTo(const webkit_glue::WebPluginGeometry& geom); |
| 64 | 63 |
| 65 // Draws this accelerated surface's contents, texture mapped onto a quad in | 64 // Draws this accelerated surface's contents, texture mapped onto a quad in |
| 66 // the given OpenGL context. TODO(kbr): figure out and define exactly how the | 65 // the given OpenGL context. TODO(kbr): figure out and define exactly how the |
| 67 // coordinate system will work out. | 66 // coordinate system will work out. |
| 68 void Draw(CGLContextObj context); | 67 void Draw(CGLContextObj context); |
| 69 | 68 |
| 70 // Causes the next Draw call to trigger a texture upload. Should be called any | 69 // Causes the next Draw call to trigger a texture upload. Should be called any |
| 71 // time the drawing context has changed. | 70 // time the drawing context has changed. |
| 72 void ForceTextureReload() { texture_needs_upload_ = true; } | 71 void ForceTextureReload() { texture_needs_upload_ = true; } |
| 73 | 72 |
| 74 // Enqueue our texture for later deletion. Call this before deleting | 73 private: |
| 75 // this object. | 74 // The manager of this accelerated surface container. |
| 76 void EnqueueTextureForDeletion( | 75 AcceleratedSurfaceContainerManagerMac* manager_; |
| 77 AcceleratedSurfaceContainerManagerMac* manager); | |
| 78 | 76 |
| 79 private: | |
| 80 // The x and y coordinates of the plugin window on the web page. | 77 // The x and y coordinates of the plugin window on the web page. |
| 81 int x_; | 78 int x_; |
| 82 int y_; | 79 int y_; |
| 83 | 80 |
| 84 void ReleaseIOSurface(); | |
| 85 | |
| 86 // The IOSurfaceRef, if any, that has been handed from the GPU | 81 // The IOSurfaceRef, if any, that has been handed from the GPU |
| 87 // plugin process back to the browser process for drawing. | 82 // plugin process back to the browser process for drawing. |
| 88 // This is held as a CFTypeRef because we can't refer to the | 83 // This is held as a CFTypeRef because we can't refer to the |
| 89 // IOSurfaceRef type when building on 10.5. | 84 // IOSurfaceRef type when building on 10.5. |
| 90 CFTypeRef surface_; | 85 CFTypeRef surface_; |
| 91 | 86 |
| 92 // The TransportDIB which is used in pre-10.6 systems where the IOSurface | 87 // The TransportDIB which is used in pre-10.6 systems where the IOSurface |
| 93 // API is not supported. This is a weak reference to the actual TransportDIB | 88 // API is not supported. This is a weak reference to the actual TransportDIB |
| 94 // whic is owned by the GPU process. | 89 // whic is owned by the GPU process. |
| 95 scoped_ptr<TransportDIB> transport_dib_; | 90 scoped_ptr<TransportDIB> transport_dib_; |
| 96 | 91 |
| 97 // The width and height of the surface. | 92 // The width and height of the surface. |
| 98 int32 width_; | 93 int32 width_; |
| 99 int32 height_; | 94 int32 height_; |
| 100 | 95 |
| 101 // The clip rectangle, relative to the (x_, y_) origin. | 96 // The clip rectangle, relative to the (x_, y_) origin. |
| 102 gfx::Rect clipRect_; | 97 gfx::Rect clipRect_; |
| 103 | 98 |
| 104 // The "live" OpenGL texture referring to this IOSurfaceRef. Note | 99 // The "live" OpenGL texture referring to this IOSurfaceRef. Note |
| 105 // that per the CGLTexImageIOSurface2D API we do not need to | 100 // that per the CGLTexImageIOSurface2D API we do not need to |
| 106 // explicitly update this texture's contents once created. All we | 101 // explicitly update this texture's contents once created. All we |
| 107 // need to do is ensure it is re-bound before attempting to draw | 102 // need to do is ensure it is re-bound before attempting to draw |
| 108 // with it. | 103 // with it. |
| 109 GLuint texture_; | 104 GLuint texture_; |
| 110 | 105 |
| 111 // True if we need to upload the texture again during the next draw. | 106 // True if we need to upload the texture again during the next draw. |
| 112 bool texture_needs_upload_; | 107 bool texture_needs_upload_; |
| 113 | 108 |
| 109 // Releases the IOSurface reference, if any, retained by this object. |
| 110 void ReleaseIOSurface(); |
| 111 |
| 112 // Enqueue our texture for later deletion. |
| 113 void EnqueueTextureForDeletion(); |
| 114 |
| 114 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); | 115 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerMac); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ | 118 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MAC_H_ |
| 118 | 119 |
| OLD | NEW |