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_OUTPUT_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
7 | 7 |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/base/scoped_ptr_vector.h" | 10 #include "cc/base/scoped_ptr_vector.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool Initialize(); | 90 bool Initialize(); |
91 void InitializeGrContext(); | 91 void InitializeGrContext(); |
92 | 92 |
93 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 93 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
94 const GeometryBinding* SharedGeometry() const { | 94 const GeometryBinding* SharedGeometry() const { |
95 return shared_geometry_.get(); | 95 return shared_geometry_.get(); |
96 } | 96 } |
97 | 97 |
98 void GetFramebufferPixelsAsync(gfx::Rect rect, | 98 void GetFramebufferPixelsAsync(gfx::Rect rect, |
99 bool flipped_y, | 99 bool flipped_y, |
100 CopyRenderPassCallback callback); | 100 scoped_ptr<CopyOutputRequest> request); |
101 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); | 101 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); |
102 void ReleaseRenderPassTextures(); | 102 void ReleaseRenderPassTextures(); |
103 | 103 |
104 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; | 104 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; |
105 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 105 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
106 const ScopedResource* resource, | 106 const ScopedResource* resource, |
107 gfx::Rect framebuffer_rect) OVERRIDE; | 107 gfx::Rect framebuffer_rect) OVERRIDE; |
108 virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; | 108 virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; |
109 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; | 109 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; |
110 virtual void ClearFramebuffer(DrawingFrame* frame) OVERRIDE; | 110 virtual void ClearFramebuffer(DrawingFrame* frame) OVERRIDE; |
111 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; | 111 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; |
112 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; | 112 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; |
113 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; | 113 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; |
114 virtual bool FlippedFramebuffer() const OVERRIDE; | 114 virtual bool FlippedFramebuffer() const OVERRIDE; |
115 virtual void EnsureScissorTestEnabled() OVERRIDE; | 115 virtual void EnsureScissorTestEnabled() OVERRIDE; |
116 virtual void EnsureScissorTestDisabled() OVERRIDE; | 116 virtual void EnsureScissorTestDisabled() OVERRIDE; |
117 virtual void CopyCurrentRenderPassToBitmap( | 117 virtual void CopyCurrentRenderPassToBitmap( |
118 DrawingFrame* frame, | 118 DrawingFrame* frame, |
119 const CopyRenderPassCallback& callback) OVERRIDE; | 119 scoped_ptr<CopyOutputRequest> request) OVERRIDE; |
120 virtual void FinishDrawingQuadList() OVERRIDE; | 120 virtual void FinishDrawingQuadList() OVERRIDE; |
121 | 121 |
122 private: | 122 private: |
123 friend class GLRendererShaderPixelTest; | 123 friend class GLRendererShaderPixelTest; |
124 friend class GLRendererShaderTest; | 124 friend class GLRendererShaderTest; |
125 | 125 |
126 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); | 126 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); |
127 static ManagedMemoryPolicy::PriorityCutoff PriorityCutoff( | 127 static ManagedMemoryPolicy::PriorityCutoff PriorityCutoff( |
128 WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff); | 128 WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff); |
129 | 129 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 bool UseScopedTexture(DrawingFrame* frame, | 187 bool UseScopedTexture(DrawingFrame* frame, |
188 const ScopedResource* resource, | 188 const ScopedResource* resource, |
189 gfx::Rect viewport_rect); | 189 gfx::Rect viewport_rect); |
190 | 190 |
191 bool MakeContextCurrent(); | 191 bool MakeContextCurrent(); |
192 | 192 |
193 bool InitializeSharedObjects(); | 193 bool InitializeSharedObjects(); |
194 void CleanupSharedObjects(); | 194 void CleanupSharedObjects(); |
195 | 195 |
196 typedef base::Callback<void(bool success)> | 196 typedef base::Callback<void(scoped_ptr<CopyOutputRequest> copy_request, |
| 197 bool success)> |
197 AsyncGetFramebufferPixelsCleanupCallback; | 198 AsyncGetFramebufferPixelsCleanupCallback; |
198 void DoGetFramebufferPixels( | 199 void DoGetFramebufferPixels( |
199 uint8* pixels, | 200 uint8* pixels, |
200 gfx::Rect rect, | 201 gfx::Rect rect, |
201 bool flipped_y, | 202 bool flipped_y, |
202 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); | 203 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); |
203 void FinishedReadback( | 204 void FinishedReadback( |
204 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, | 205 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, |
205 unsigned source_buffer, | 206 unsigned source_buffer, |
206 uint8_t* dest_pixels, | 207 uint8_t* dest_pixels, |
207 gfx::Size size, | 208 gfx::Size size, |
208 bool flipped_y); | 209 bool flipped_y); |
209 void PassOnSkBitmap( | 210 void PassOnSkBitmap( |
210 scoped_ptr<SkBitmap> bitmap, | 211 scoped_ptr<SkBitmap> bitmap, |
211 scoped_ptr<SkAutoLockPixels> lock, | 212 scoped_ptr<SkAutoLockPixels> lock, |
212 const CopyRenderPassCallback& callback, | 213 scoped_ptr<CopyOutputRequest> request, |
213 bool success); | 214 bool success); |
214 | 215 |
215 void ReinitializeGrCanvas(); | 216 void ReinitializeGrCanvas(); |
216 void ReinitializeGLState(); | 217 void ReinitializeGLState(); |
217 | 218 |
218 // WebKit:: | 219 // WebKit:: |
219 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM | 220 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM |
220 // implementation. | 221 // implementation. |
221 virtual void onMemoryAllocationChanged( | 222 virtual void onMemoryAllocationChanged( |
222 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; | 223 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 441 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
441 #define GLC(context, x) \ | 442 #define GLC(context, x) \ |
442 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) | 443 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) |
443 #else | 444 #else |
444 #define GLC(context, x) (x) | 445 #define GLC(context, x) (x) |
445 #endif | 446 #endif |
446 | 447 |
447 } // namespace cc | 448 } // namespace cc |
448 | 449 |
449 #endif // CC_OUTPUT_GL_RENDERER_H_ | 450 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |