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/gl/gl_surface.h" |
18 #include "ui/gfx/surface/surface_export.h" | |
19 #include "ui/gfx/surface/transport_dib.h" | 18 #include "ui/gfx/surface/transport_dib.h" |
20 | 19 |
21 // 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 |
22 // instead. | 21 // instead. |
23 typedef struct _CGLContextObject* CGLContextObj; | 22 typedef struct _CGLContextObject* CGLContextObj; |
24 typedef unsigned int GLenum; | 23 typedef unsigned int GLenum; |
25 typedef unsigned int GLuint; | 24 typedef unsigned int GLuint; |
26 | 25 |
27 namespace gfx { | 26 namespace gfx { |
28 class Rect; | 27 class Rect; |
29 } | 28 } |
30 | 29 |
31 // Encapsulates an accelerated GL surface that can be shared across processes | 30 // Encapsulates an accelerated GL surface that can be shared across processes |
32 // on systems that support it (10.6 and above). For systems that do not, it | 31 // on systems that support it (10.6 and above). For systems that do not, it |
33 // uses a regular dib. There will either be an IOSurface or a TransportDIB, | 32 // uses a regular dib. There will either be an IOSurface or a TransportDIB, |
34 // never both. | 33 // never both. |
35 | 34 |
36 class SURFACE_EXPORT AcceleratedSurface { | 35 class AcceleratedSurface { |
37 public: | 36 public: |
38 AcceleratedSurface(); | 37 AcceleratedSurface(); |
39 virtual ~AcceleratedSurface(); | 38 virtual ~AcceleratedSurface(); |
40 | 39 |
41 // Set up internal buffers. |share_context|, if non-NULL, is a context | 40 // Set up internal buffers. |share_context|, if non-NULL, is a context |
42 // with which the internally created OpenGL context shares textures and | 41 // with which the internally created OpenGL context shares textures and |
43 // other resources. |allocate_fbo| indicates whether or not this surface | 42 // other resources. |allocate_fbo| indicates whether or not this surface |
44 // should allocate an offscreen frame buffer object (FBO) internally. If | 43 // should allocate an offscreen frame buffer object (FBO) internally. If |
45 // not, then the user is expected to allocate one. NOTE that allocating | 44 // not, then the user is expected to allocate one. NOTE that allocating |
46 // an FBO internally does NOT work properly with client code which uses | 45 // an FBO internally does NOT work properly with client code which uses |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // true. | 167 // true. |
169 GLuint fbo_; | 168 GLuint fbo_; |
170 GLuint depth_stencil_renderbuffer_; | 169 GLuint depth_stencil_renderbuffer_; |
171 // Allocate a TransportDIB in the renderer. | 170 // Allocate a TransportDIB in the renderer. |
172 scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> | 171 scoped_ptr<Callback2<size_t, TransportDIB::Handle*>::Type> |
173 dib_alloc_callback_; | 172 dib_alloc_callback_; |
174 scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_; | 173 scoped_ptr<Callback1<TransportDIB::Id>::Type> dib_free_callback_; |
175 }; | 174 }; |
176 | 175 |
177 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 176 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
OLD | NEW |