| 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/callback_old.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/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 16 #include "ui/gfx/gl/gl_context.h" | 16 #include "ui/gfx/gl/gl_context.h" |
| 17 #include "ui/gfx/gl/gl_surface.h" |
| 17 #include "ui/gfx/surface/transport_dib.h" | 18 #include "ui/gfx/surface/transport_dib.h" |
| 18 | 19 |
| 19 // Should not include GL headers in a header file. Forward declare these types | 20 // Should not include GL headers in a header file. Forward declare these types |
| 20 // instead. | 21 // instead. |
| 21 typedef struct _CGLContextObject* CGLContextObj; | 22 typedef struct _CGLContextObject* CGLContextObj; |
| 22 typedef unsigned int GLenum; | 23 typedef unsigned int GLenum; |
| 23 typedef unsigned int GLuint; | 24 typedef unsigned int GLuint; |
| 24 | 25 |
| 25 namespace gfx { | 26 namespace gfx { |
| 26 class Rect; | 27 class Rect; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // rendering. |target| must be the same value as used in the call to | 122 // rendering. |target| must be the same value as used in the call to |
| 122 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer | 123 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer |
| 123 // object is valid. | 124 // object is valid. |
| 124 bool SetupFrameBufferObject(GLenum target); | 125 bool SetupFrameBufferObject(GLenum target); |
| 125 | 126 |
| 126 // The OpenGL context, and pbuffer drawable, used to transfer data | 127 // The OpenGL context, and pbuffer drawable, used to transfer data |
| 127 // to the shared region (IOSurface or TransportDIB). Strictly | 128 // to the shared region (IOSurface or TransportDIB). Strictly |
| 128 // speaking, we do not need to allocate a GL context all of the | 129 // speaking, we do not need to allocate a GL context all of the |
| 129 // time. We only need one if (a) we are using the IOSurface code | 130 // time. We only need one if (a) we are using the IOSurface code |
| 130 // path, or (b) if we are allocating an FBO internally. | 131 // path, or (b) if we are allocating an FBO internally. |
| 132 scoped_ptr<gfx::GLSurface> gl_surface_; |
| 131 scoped_ptr<gfx::GLContext> gl_context_; | 133 scoped_ptr<gfx::GLContext> gl_context_; |
| 132 // Either |io_surface_| or |transport_dib_| is a valid pointer, but not both. | 134 // Either |io_surface_| or |transport_dib_| is a valid pointer, but not both. |
| 133 // |io_surface_| is non-NULL if the IOSurface APIs are supported (Mac OS X | 135 // |io_surface_| is non-NULL if the IOSurface APIs are supported (Mac OS X |
| 134 // 10.6 and later). | 136 // 10.6 and later). |
| 135 // TODO(dspringer,kbr): Should the GPU backing store be encapsulated in its | 137 // TODO(dspringer,kbr): Should the GPU backing store be encapsulated in its |
| 136 // own class so all this implementation detail is hidden? | 138 // own class so all this implementation detail is hidden? |
| 137 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; | 139 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; |
| 138 | 140 |
| 139 // The id of |io_surface_| or 0 if that's NULL. | 141 // The id of |io_surface_| or 0 if that's NULL. |
| 140 uint64 io_surface_id_; | 142 uint64 io_surface_id_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 158 // true. | 160 // true. |
| 159 GLuint fbo_; | 161 GLuint fbo_; |
| 160 GLuint depth_stencil_renderbuffer_; | 162 GLuint depth_stencil_renderbuffer_; |
| 161 // Allocate a TransportDIB in the renderer. | 163 // Allocate a TransportDIB in the renderer. |
| 162 scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> | 164 scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> |
| 163 dib_alloc_callback_; | 165 dib_alloc_callback_; |
| 164 scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_; | 166 scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_; |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 169 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
| OLD | NEW |