| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 59 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
| 60 | 60 |
| 61 blink::WebGraphicsContext3D* Context(); | 61 blink::WebGraphicsContext3D* Context(); |
| 62 | 62 |
| 63 // Waits for rendering to finish. | 63 // Waits for rendering to finish. |
| 64 virtual void Finish() OVERRIDE; | 64 virtual void Finish() OVERRIDE; |
| 65 | 65 |
| 66 virtual void DoNoOp() OVERRIDE; | 66 virtual void DoNoOp() OVERRIDE; |
| 67 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; | 67 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; |
| 68 | 68 |
| 69 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 69 virtual void GetFramebufferPixels(void* pixels, |
| 70 const gfx::Rect& rect) OVERRIDE; |
| 70 | 71 |
| 71 virtual bool IsContextLost() OVERRIDE; | 72 virtual bool IsContextLost() OVERRIDE; |
| 72 | 73 |
| 73 virtual void SetVisible(bool visible) OVERRIDE; | 74 virtual void SetVisible(bool visible) OVERRIDE; |
| 74 | 75 |
| 75 virtual void SendManagedMemoryStats(size_t bytes_visible, | 76 virtual void SendManagedMemoryStats(size_t bytes_visible, |
| 76 size_t bytes_visible_and_nearby, | 77 size_t bytes_visible_and_nearby, |
| 77 size_t bytes_allocated) OVERRIDE; | 78 size_t bytes_allocated) OVERRIDE; |
| 78 | 79 |
| 79 static void DebugGLCall(gpu::gles2::GLES2Interface* gl, | 80 static void DebugGLCall(gpu::gles2::GLES2Interface* gl, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 int highp_threshold_min); | 91 int highp_threshold_min); |
| 91 | 92 |
| 92 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } | 93 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } |
| 93 void InitializeGrContext(); | 94 void InitializeGrContext(); |
| 94 | 95 |
| 95 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 96 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
| 96 const GeometryBinding* SharedGeometry() const { | 97 const GeometryBinding* SharedGeometry() const { |
| 97 return shared_geometry_.get(); | 98 return shared_geometry_.get(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void GetFramebufferPixelsAsync(gfx::Rect rect, | 101 void GetFramebufferPixelsAsync(const gfx::Rect& rect, |
| 101 scoped_ptr<CopyOutputRequest> request); | 102 scoped_ptr<CopyOutputRequest> request); |
| 102 void GetFramebufferTexture(unsigned texture_id, | 103 void GetFramebufferTexture(unsigned texture_id, |
| 103 ResourceFormat texture_format, | 104 ResourceFormat texture_format, |
| 104 gfx::Rect device_rect); | 105 const gfx::Rect& device_rect); |
| 105 void ReleaseRenderPassTextures(); | 106 void ReleaseRenderPassTextures(); |
| 106 | 107 |
| 107 void SetStencilEnabled(bool enabled); | 108 void SetStencilEnabled(bool enabled); |
| 108 bool stencil_enabled() const { return stencil_shadow_; } | 109 bool stencil_enabled() const { return stencil_shadow_; } |
| 109 void SetBlendEnabled(bool enabled); | 110 void SetBlendEnabled(bool enabled); |
| 110 bool blend_enabled() const { return blend_shadow_; } | 111 bool blend_enabled() const { return blend_shadow_; } |
| 111 | 112 |
| 112 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; | 113 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; |
| 113 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 114 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
| 114 const ScopedResource* resource, | 115 const ScopedResource* resource, |
| 115 gfx::Rect target_rect) OVERRIDE; | 116 const gfx::Rect& target_rect) OVERRIDE; |
| 116 virtual void SetDrawViewport(gfx::Rect window_space_viewport) OVERRIDE; | 117 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; |
| 117 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; | 118 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; |
| 118 virtual void DiscardPixels(bool has_external_stencil_test, | 119 virtual void DiscardPixels(bool has_external_stencil_test, |
| 119 bool draw_rect_covers_full_surface) OVERRIDE; | 120 bool draw_rect_covers_full_surface) OVERRIDE; |
| 120 virtual void ClearFramebuffer(DrawingFrame* frame, | 121 virtual void ClearFramebuffer(DrawingFrame* frame, |
| 121 bool has_external_stencil_test) OVERRIDE; | 122 bool has_external_stencil_test) OVERRIDE; |
| 122 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; | 123 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; |
| 123 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; | 124 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; |
| 124 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; | 125 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; |
| 125 virtual bool FlippedFramebuffer() const OVERRIDE; | 126 virtual bool FlippedFramebuffer() const OVERRIDE; |
| 126 virtual void EnsureScissorTestEnabled() OVERRIDE; | 127 virtual void EnsureScissorTestEnabled() OVERRIDE; |
| 127 virtual void EnsureScissorTestDisabled() OVERRIDE; | 128 virtual void EnsureScissorTestDisabled() OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void SetShaderOpacity(float opacity, int alpha_location); | 180 void SetShaderOpacity(float opacity, int alpha_location); |
| 180 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); | 181 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); |
| 181 void DrawQuadGeometry(const DrawingFrame* frame, | 182 void DrawQuadGeometry(const DrawingFrame* frame, |
| 182 const gfx::Transform& draw_transform, | 183 const gfx::Transform& draw_transform, |
| 183 const gfx::RectF& quad_rect, | 184 const gfx::RectF& quad_rect, |
| 184 int matrix_location); | 185 int matrix_location); |
| 185 void SetUseProgram(unsigned program); | 186 void SetUseProgram(unsigned program); |
| 186 | 187 |
| 187 void CopyTextureToFramebuffer(const DrawingFrame* frame, | 188 void CopyTextureToFramebuffer(const DrawingFrame* frame, |
| 188 int texture_id, | 189 int texture_id, |
| 189 gfx::Rect rect, | 190 const gfx::Rect& rect, |
| 190 const gfx::Transform& draw_matrix, | 191 const gfx::Transform& draw_matrix, |
| 191 bool flip_vertically); | 192 bool flip_vertically); |
| 192 | 193 |
| 193 bool UseScopedTexture(DrawingFrame* frame, | 194 bool UseScopedTexture(DrawingFrame* frame, |
| 194 const ScopedResource* resource, | 195 const ScopedResource* resource, |
| 195 gfx::Rect viewport_rect); | 196 const gfx::Rect& viewport_rect); |
| 196 | 197 |
| 197 bool MakeContextCurrent(); | 198 bool MakeContextCurrent(); |
| 198 | 199 |
| 199 void InitializeSharedObjects(); | 200 void InitializeSharedObjects(); |
| 200 void CleanupSharedObjects(); | 201 void CleanupSharedObjects(); |
| 201 | 202 |
| 202 typedef base::Callback<void(scoped_ptr<CopyOutputRequest> copy_request, | 203 typedef base::Callback<void(scoped_ptr<CopyOutputRequest> copy_request, |
| 203 bool success)> | 204 bool success)> |
| 204 AsyncGetFramebufferPixelsCleanupCallback; | 205 AsyncGetFramebufferPixelsCleanupCallback; |
| 205 void DoGetFramebufferPixels( | 206 void DoGetFramebufferPixels( |
| 206 uint8* pixels, | 207 uint8* pixels, |
| 207 gfx::Rect window_rect, | 208 const gfx::Rect& window_rect, |
| 208 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); | 209 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); |
| 209 void FinishedReadback( | 210 void FinishedReadback( |
| 210 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, | 211 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, |
| 211 unsigned source_buffer, | 212 unsigned source_buffer, |
| 212 unsigned query, | 213 unsigned query, |
| 213 uint8_t* dest_pixels, | 214 uint8_t* dest_pixels, |
| 214 gfx::Size size); | 215 gfx::Size size); |
| 215 void PassOnSkBitmap(scoped_ptr<SkBitmap> bitmap, | 216 void PassOnSkBitmap(scoped_ptr<SkBitmap> bitmap, |
| 216 scoped_ptr<SkAutoLockPixels> lock, | 217 scoped_ptr<SkAutoLockPixels> lock, |
| 217 scoped_ptr<CopyOutputRequest> request, | 218 scoped_ptr<CopyOutputRequest> request, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 445 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
| 445 #define GLC(context, x) \ | 446 #define GLC(context, x) \ |
| 446 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) | 447 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) |
| 447 #else | 448 #else |
| 448 #define GLC(context, x) (x) | 449 #define GLC(context, x) (x) |
| 449 #endif | 450 #endif |
| 450 | 451 |
| 451 } // namespace cc | 452 } // namespace cc |
| 452 | 453 |
| 453 #endif // CC_OUTPUT_GL_RENDERER_H_ | 454 #endif // CC_OUTPUT_GL_RENDERER_H_ |
| OLD | NEW |