OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 CC_GL_RENDERER_H_ | 5 #ifndef CC_GL_RENDERER_H_ |
6 #define CC_GL_RENDERER_H_ | 6 #define CC_GL_RENDERER_H_ |
7 | 7 |
8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class StreamVideoDrawQuad; | 27 class StreamVideoDrawQuad; |
28 class TextureDrawQuad; | 28 class TextureDrawQuad; |
29 class GeometryBinding; | 29 class GeometryBinding; |
30 class ScopedEnsureFramebufferAllocation; | 30 class ScopedEnsureFramebufferAllocation; |
31 | 31 |
32 // Class that handles drawing of composited render layers using GL. | 32 // Class that handles drawing of composited render layers using GL. |
33 class CC_EXPORT GLRenderer : | 33 class CC_EXPORT GLRenderer : |
34 public DirectRenderer, | 34 public DirectRenderer, |
35 public NON_EXPORTED_BASE( | 35 public NON_EXPORTED_BASE( |
36 WebKit::WebGraphicsContext3D:: | 36 WebKit::WebGraphicsContext3D:: |
37 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), | 37 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM) { |
38 public NON_EXPORTED_BASE( | |
39 WebKit::WebGraphicsContext3D:: | |
40 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), | |
41 public NON_EXPORTED_BASE( | |
42 WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { | |
43 public: | 38 public: |
44 static scoped_ptr<GLRenderer> Create(RendererClient* client, | 39 static scoped_ptr<GLRenderer> Create(RendererClient* client, |
45 OutputSurface* output_surface, | 40 OutputSurface* output_surface, |
46 ResourceProvider* resource_provider); | 41 ResourceProvider* resource_provider); |
47 | 42 |
48 virtual ~GLRenderer(); | 43 virtual ~GLRenderer(); |
49 | 44 |
50 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 45 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
51 | 46 |
52 WebKit::WebGraphicsContext3D* Context(); | 47 WebKit::WebGraphicsContext3D* Context(); |
53 | 48 |
54 virtual void ViewportChanged() OVERRIDE; | 49 virtual void ViewportChanged() OVERRIDE; |
55 | 50 |
56 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) | |
57 OVERRIDE; | |
58 | |
59 // Waits for rendering to finish. | 51 // Waits for rendering to finish. |
60 virtual void Finish() OVERRIDE; | 52 virtual void Finish() OVERRIDE; |
61 | 53 |
62 virtual void DoNoOp() OVERRIDE; | 54 virtual void DoNoOp() OVERRIDE; |
63 // Puts backbuffer onscreen. | 55 // Puts backbuffer onscreen. |
64 virtual bool SwapBuffers() OVERRIDE; | 56 virtual bool SwapBuffers() OVERRIDE; |
65 | 57 |
66 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 58 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; |
67 | 59 |
68 virtual bool IsContextLost() OVERRIDE; | 60 virtual bool IsContextLost() OVERRIDE; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 bool UseScopedTexture(DrawingFrame& frame, | 147 bool UseScopedTexture(DrawingFrame& frame, |
156 const ScopedResource* resource, | 148 const ScopedResource* resource, |
157 gfx::Rect viewport_rect); | 149 gfx::Rect viewport_rect); |
158 | 150 |
159 bool MakeContextCurrent(); | 151 bool MakeContextCurrent(); |
160 | 152 |
161 bool InitializeSharedObjects(); | 153 bool InitializeSharedObjects(); |
162 void CleanupSharedObjects(); | 154 void CleanupSharedObjects(); |
163 | 155 |
164 // WebKit:: | 156 // WebKit:: |
165 // WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM | |
166 // implementation. | |
167 virtual void onSwapBuffersComplete() OVERRIDE; | |
168 | |
169 // WebKit:: | |
170 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM | 157 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM |
171 // implementation. | 158 // implementation. |
172 virtual void onMemoryAllocationChanged( | 159 virtual void onMemoryAllocationChanged( |
173 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; | 160 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
174 void DiscardBackbuffer(); | 161 void DiscardBackbuffer(); |
175 void EnsureBackbuffer(); | 162 void EnsureBackbuffer(); |
176 void EnforceMemoryPolicy(); | 163 void EnforceMemoryPolicy(); |
177 | 164 |
178 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | |
179 virtual void onContextLost() OVERRIDE; | |
180 | |
181 RendererCapabilities capabilities_; | 165 RendererCapabilities capabilities_; |
182 | 166 |
183 unsigned offscreen_framebuffer_id_; | 167 unsigned offscreen_framebuffer_id_; |
184 | 168 |
185 scoped_ptr<GeometryBinding> shared_geometry_; | 169 scoped_ptr<GeometryBinding> shared_geometry_; |
186 gfx::QuadF shared_geometry_quad_; | 170 gfx::QuadF shared_geometry_quad_; |
187 | 171 |
188 // This block of bindings defines all of the programs used by the compositor | 172 // This block of bindings defines all of the programs used by the compositor |
189 // itself. | 173 // itself. |
190 | 174 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 293 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
310 #define GLC(context, x) \ | 294 #define GLC(context, x) \ |
311 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) | 295 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) |
312 #else | 296 #else |
313 #define GLC(context, x) (x) | 297 #define GLC(context, x) (x) |
314 #endif | 298 #endif |
315 | 299 |
316 } | 300 } |
317 | 301 |
318 #endif // CC_GL_RENDERER_H_ | 302 #endif // CC_GL_RENDERER_H_ |
OLD | NEW |