| 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 #include <IOSurface/IOSurfaceAPI.h> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 15 #include "ui/gl/gl_context.h" | 16 #include "ui/gl/gl_context.h" |
| 16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 17 #include "ui/gl/gpu_preference.h" | 18 #include "ui/gl/gpu_preference.h" |
| 18 #include "ui/surface/surface_export.h" | 19 #include "ui/surface/surface_export.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer | 112 // AllocateRenderBuffers(). Returns |true| if the resulting framebuffer |
| 112 // object is valid. | 113 // object is valid. |
| 113 bool SetupFrameBufferObject(GLenum target); | 114 bool SetupFrameBufferObject(GLenum target); |
| 114 | 115 |
| 115 gfx::Size ClampToValidDimensions(const gfx::Size& size); | 116 gfx::Size ClampToValidDimensions(const gfx::Size& size); |
| 116 | 117 |
| 117 // The OpenGL context, and pbuffer drawable, used to transfer data | 118 // The OpenGL context, and pbuffer drawable, used to transfer data |
| 118 // to the shared region (IOSurface). | 119 // to the shared region (IOSurface). |
| 119 scoped_refptr<gfx::GLSurface> gl_surface_; | 120 scoped_refptr<gfx::GLSurface> gl_surface_; |
| 120 scoped_refptr<gfx::GLContext> gl_context_; | 121 scoped_refptr<gfx::GLContext> gl_context_; |
| 121 base::ScopedCFTypeRef<CFTypeRef> io_surface_; | 122 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 122 | 123 |
| 123 // The id of |io_surface_| or 0 if that's NULL. | 124 // The id of |io_surface_| or 0 if that's NULL. |
| 124 uint32 io_surface_id_; | 125 uint32 io_surface_id_; |
| 125 | 126 |
| 126 gfx::Size surface_size_; | 127 gfx::Size surface_size_; |
| 127 // It's important to avoid allocating zero-width or zero-height | 128 // 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 | 129 // 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 | 130 // of 1. This is the real size of the surface; surface_size_ is what |
| 130 // the user requested. | 131 // the user requested. |
| 131 gfx::Size real_surface_size_; | 132 gfx::Size real_surface_size_; |
| 132 // TODO(kbr): the FBO management should not be in this class at all. | 133 // 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 | 134 // 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 | 135 // introduce another copy of the color data on the GPU; the direct |
| 135 // binding of the internal texture to the IOSurface saves a copy. | 136 // binding of the internal texture to the IOSurface saves a copy. |
| 136 bool allocate_fbo_; | 137 bool allocate_fbo_; |
| 137 // This texture object is always allocated, regardless of whether | 138 // This texture object is always allocated, regardless of whether |
| 138 // the user requests an FBO be allocated. | 139 // the user requests an FBO be allocated. |
| 139 GLuint texture_; | 140 GLuint texture_; |
| 140 // The FBO and renderbuffer are only allocated if allocate_fbo_ is | 141 // The FBO and renderbuffer are only allocated if allocate_fbo_ is |
| 141 // true. | 142 // true. |
| 142 GLuint fbo_; | 143 GLuint fbo_; |
| 143 }; | 144 }; |
| 144 | 145 |
| 145 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ | 146 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ |
| OLD | NEW |