| 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 UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 5 #ifndef UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
| 6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
| 10 | 10 |
| 11 #include "base/callback_old.h" | 11 #include "base/bind.h" |
| 12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ui/gfx/gl/gl_context.h" | 14 #include "ui/gfx/gl/gl_context.h" |
| 15 #include "ui/gfx/gl/gl_surface.h" | 15 #include "ui/gfx/gl/gl_surface.h" |
| 16 #include "ui/gfx/gl/gpu_preference.h" | 16 #include "ui/gfx/gl/gpu_preference.h" |
| 17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
| 19 #include "ui/gfx/surface/surface_export.h" | 19 #include "ui/gfx/surface/surface_export.h" |
| 20 #include "ui/gfx/surface/transport_dib.h" | 20 #include "ui/gfx/surface/transport_dib.h" |
| 21 | 21 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // These methods are only used when there is a transport DIB. | 105 // These methods are only used when there is a transport DIB. |
| 106 | 106 |
| 107 // Sets the transport DIB to the given size, creating a new one if the | 107 // Sets the transport DIB to the given size, creating a new one if the |
| 108 // height or width changes. Returns a handle to the new DIB, or a default | 108 // height or width changes. Returns a handle to the new DIB, or a default |
| 109 // handle if no changes were made. Assumes the caller has already called | 109 // handle if no changes were made. Assumes the caller has already called |
| 110 // MakeCurrent(). | 110 // MakeCurrent(). |
| 111 TransportDIB::Handle SetTransportDIBSize(const gfx::Size& size); | 111 TransportDIB::Handle SetTransportDIBSize(const gfx::Size& size); |
| 112 // Sets the methods to use for allocating and freeing memory for the | 112 // Sets the methods to use for allocating and freeing memory for the |
| 113 // transport DIB. | 113 // transport DIB. |
| 114 void SetTransportDIBAllocAndFree( | 114 void SetTransportDIBAllocAndFree( |
| 115 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, | 115 const base::Callback<void(size_t, TransportDIB::Handle*)>& allocator, |
| 116 Callback1<TransportDIB::Id>::Type* deallocator); | 116 const base::Callback<void(TransportDIB::Id)>& deallocator); |
| 117 | 117 |
| 118 // Get the accelerated surface size. | 118 // Get the accelerated surface size. |
| 119 gfx::Size GetSize() const { return surface_size_; } | 119 gfx::Size GetSize() const { return surface_size_; } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 // Helper function to generate names for the backing texture, render buffers | 122 // Helper function to generate names for the backing texture, render buffers |
| 123 // and FBO. On return, the resulting buffer names can be attached to |fbo_|. | 123 // and FBO. On return, the resulting buffer names can be attached to |fbo_|. |
| 124 // |target| is the target type for the color buffer. | 124 // |target| is the target type for the color buffer. |
| 125 void AllocateRenderBuffers(GLenum target, const gfx::Size& size); | 125 void AllocateRenderBuffers(GLenum target, const gfx::Size& size); |
| 126 | 126 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool allocate_fbo_; | 168 bool allocate_fbo_; |
| 169 // If the IOSurface code path is being used, then this texture | 169 // If the IOSurface code path is being used, then this texture |
| 170 // object is always allocated. Otherwise, it is only allocated if | 170 // object is always allocated. Otherwise, it is only allocated if |
| 171 // the user requests an FBO be allocated. | 171 // the user requests an FBO be allocated. |
| 172 GLuint texture_; | 172 GLuint texture_; |
| 173 // The FBO and renderbuffer are only allocated if allocate_fbo_ is | 173 // The FBO and renderbuffer are only allocated if allocate_fbo_ is |
| 174 // true. | 174 // true. |
| 175 GLuint fbo_; | 175 GLuint fbo_; |
| 176 GLuint depth_stencil_renderbuffer_; | 176 GLuint depth_stencil_renderbuffer_; |
| 177 // Allocate a TransportDIB in the renderer. | 177 // Allocate a TransportDIB in the renderer. |
| 178 scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> | 178 base::Callback<void(size_t, TransportDIB::Handle*)> dib_alloc_callback_; |
| 179 dib_alloc_callback_; | 179 base::Callback<void(TransportDIB::Id)> dib_free_callback_; |
| 180 scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_; | |
| 181 }; | 180 }; |
| 182 | 181 |
| 183 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 182 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
| OLD | NEW |