OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
6 #define UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 6 #define UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
7 | 7 |
8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer | 111 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer |
112 // object is valid. | 112 // object is valid. |
113 bool SetupFrameBufferObject(GLenum target); | 113 bool SetupFrameBufferObject(GLenum target); |
114 | 114 |
115 gfx::Size ClampToValidDimensions(const gfx::Size& size); | 115 gfx::Size ClampToValidDimensions(const gfx::Size& size); |
116 | 116 |
117 // The OpenGL context, and pbuffer drawable, used to transfer data | 117 // The OpenGL context, and pbuffer drawable, used to transfer data |
118 // to the shared region (IOSurface). | 118 // to the shared region (IOSurface). |
119 scoped_refptr<gfx::GLSurface> gl_surface_; | 119 scoped_refptr<gfx::GLSurface> gl_surface_; |
120 scoped_refptr<gfx::GLContext> gl_context_; | 120 scoped_refptr<gfx::GLContext> gl_context_; |
121 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; | 121 base::ScopedCFTypeRef<CFTypeRef> io_surface_; |
122 | 122 |
123 // The id of |io_surface_| or 0 if that's NULL. | 123 // The id of |io_surface_| or 0 if that's NULL. |
124 uint32 io_surface_id_; | 124 uint32 io_surface_id_; |
125 | 125 |
126 gfx::Size surface_size_; | 126 gfx::Size surface_size_; |
127 // It's important to avoid allocating zero-width or zero-height | 127 // It's important to avoid allocating zero-width or zero-height |
128 // IOSurfaces and textures on the Mac, so we clamp each to a minimum | 128 // IOSurfaces and textures on the Mac, so we clamp each to a minimum |
129 // of 1. This is the real size of the surface; surface_size_ is what | 129 // of 1. This is the real size of the surface; surface_size_ is what |
130 // the user requested. | 130 // the user requested. |
131 gfx::Size real_surface_size_; | 131 gfx::Size real_surface_size_; |
132 // TODO(kbr): the FBO management should not be in this class at all. | 132 // TODO(kbr): the FBO management should not be in this class at all. |
133 // However, if it is factored out, care needs to be taken to not | 133 // However, if it is factored out, care needs to be taken to not |
134 // introduce another copy of the color data on the GPU; the direct | 134 // introduce another copy of the color data on the GPU; the direct |
135 // binding of the internal texture to the IOSurface saves a copy. | 135 // binding of the internal texture to the IOSurface saves a copy. |
136 bool allocate_fbo_; | 136 bool allocate_fbo_; |
137 // This texture object is always allocated, regardless of whether | 137 // This texture object is always allocated, regardless of whether |
138 // the user requests an FBO be allocated. | 138 // the user requests an FBO be allocated. |
139 GLuint texture_; | 139 GLuint texture_; |
140 // The FBO and renderbuffer are only allocated if allocate_fbo_ is | 140 // The FBO and renderbuffer are only allocated if allocate_fbo_ is |
141 // true. | 141 // true. |
142 GLuint fbo_; | 142 GLuint fbo_; |
143 }; | 143 }; |
144 | 144 |
145 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 145 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
OLD | NEW |