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 CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 // Disassociate the GL context with the NSView and unref the IOSurface. Do | 48 // Disassociate the GL context with the NSView and unref the IOSurface. Do |
49 // this to switch to software drawing mode. | 49 // this to switch to software drawing mode. |
50 void ClearDrawable(); | 50 void ClearDrawable(); |
51 | 51 |
52 bool HasIOSurface() { return !!io_surface_.get(); } | 52 bool HasIOSurface() { return !!io_surface_.get(); } |
53 | 53 |
54 const gfx::Size& pixel_io_surface_size() const { | 54 const gfx::Size& pixel_io_surface_size() const { |
55 return pixel_io_surface_size_; | 55 return pixel_io_surface_size_; |
56 } | 56 } |
57 const gfx::Size& io_surface_size() const { return io_surface_size_; } | |
jbates
2012/06/12 17:11:13
I think this should be renamed so that it's clear
| |
57 | 58 |
58 bool is_vsync_disabled() const { return is_vsync_disabled_; } | 59 bool is_vsync_disabled() const { return is_vsync_disabled_; } |
59 | 60 |
60 private: | 61 private: |
61 // Vertex structure for use in glDraw calls. | 62 // Vertex structure for use in glDraw calls. |
62 struct SurfaceVertex { | 63 struct SurfaceVertex { |
63 SurfaceVertex() : x_(0.0f), y_(0.0f), tx_(0.0f), ty_(0.0f) { } | 64 SurfaceVertex() : x_(0.0f), y_(0.0f), tx_(0.0f), ty_(0.0f) { } |
64 // Currently the texture coords are always the same as vertex coords. | 65 // Currently the texture coords are always the same as vertex coords. |
65 void set(float x, float y, float tx, float ty) { | 66 void set(float x, float y, float tx, float ty) { |
66 x_ = x; | 67 x_ = x; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 122 |
122 // GL context | 123 // GL context |
123 scoped_nsobject<NSOpenGLContext> glContext_; | 124 scoped_nsobject<NSOpenGLContext> glContext_; |
124 CGLContextObj cglContext_; // weak, backed by |glContext_|. | 125 CGLContextObj cglContext_; // weak, backed by |glContext_|. |
125 | 126 |
126 // IOSurface data. | 127 // IOSurface data. |
127 uint64 io_surface_handle_; | 128 uint64 io_surface_handle_; |
128 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; | 129 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; |
129 | 130 |
130 // The width and height of the io surface. | 131 // The width and height of the io surface. |
131 gfx::Size pixel_io_surface_size_; | 132 gfx::Size pixel_io_surface_size_; // In pixels. |
133 gfx::Size io_surface_size_; // In view units. | |
132 | 134 |
133 // The "live" OpenGL texture referring to this IOSurfaceRef. Note | 135 // The "live" OpenGL texture referring to this IOSurfaceRef. Note |
134 // that per the CGLTexImageIOSurface2D API we do not need to | 136 // that per the CGLTexImageIOSurface2D API we do not need to |
135 // explicitly update this texture's contents once created. All we | 137 // explicitly update this texture's contents once created. All we |
136 // need to do is ensure it is re-bound before attempting to draw | 138 // need to do is ensure it is re-bound before attempting to draw |
137 // with it. | 139 // with it. |
138 GLuint texture_; | 140 GLuint texture_; |
139 | 141 |
140 // Shader parameters. | 142 // Shader parameters. |
141 GLuint shader_program_blit_rgb_; | 143 GLuint shader_program_blit_rgb_; |
142 GLint blit_rgb_sampler_location_; | 144 GLint blit_rgb_sampler_location_; |
143 GLuint shader_program_white_; | 145 GLuint shader_program_white_; |
144 | 146 |
145 SurfaceQuad quad_; | 147 SurfaceQuad quad_; |
146 | 148 |
147 bool is_vsync_disabled_; | 149 bool is_vsync_disabled_; |
148 }; | 150 }; |
149 | 151 |
150 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 152 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
OLD | NEW |