OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_OUTPUT_DIRECT_RENDERER_H_ | 5 #ifndef CC_OUTPUT_DIRECT_RENDERER_H_ |
6 #define CC_OUTPUT_DIRECT_RENDERER_H_ | 6 #define CC_OUTPUT_DIRECT_RENDERER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ResourceProvider* resource_provider() const { return resource_provider_; } | 27 ResourceProvider* resource_provider() const { return resource_provider_; } |
28 | 28 |
29 virtual bool CanReadPixels() const OVERRIDE; | 29 virtual bool CanReadPixels() const OVERRIDE; |
30 virtual void DecideRenderPassAllocationsForFrame( | 30 virtual void DecideRenderPassAllocationsForFrame( |
31 const RenderPassList& render_passes_in_draw_order) OVERRIDE; | 31 const RenderPassList& render_passes_in_draw_order) OVERRIDE; |
32 virtual bool HasAllocatedResourcesForTesting(RenderPass::Id id) const | 32 virtual bool HasAllocatedResourcesForTesting(RenderPass::Id id) const |
33 OVERRIDE; | 33 OVERRIDE; |
34 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, | 34 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, |
35 ContextProvider* offscreen_context_provider, | 35 ContextProvider* offscreen_context_provider, |
36 float device_scale_factor, | 36 float device_scale_factor, |
37 gfx::Rect device_viewport_rect, | 37 const gfx::Rect& device_viewport_rect, |
38 gfx::Rect device_clip_rect, | 38 const gfx::Rect& device_clip_rect, |
39 bool allow_partial_swap, | 39 bool allow_partial_swap, |
40 bool disable_picture_quad_image_filtering) OVERRIDE; | 40 bool disable_picture_quad_image_filtering) OVERRIDE; |
41 | 41 |
42 struct CC_EXPORT DrawingFrame { | 42 struct CC_EXPORT DrawingFrame { |
43 DrawingFrame(); | 43 DrawingFrame(); |
44 ~DrawingFrame(); | 44 ~DrawingFrame(); |
45 | 45 |
46 const RenderPass* root_render_pass; | 46 const RenderPass* root_render_pass; |
47 const RenderPass* current_render_pass; | 47 const RenderPass* current_render_pass; |
48 const ScopedResource* current_texture; | 48 const ScopedResource* current_texture; |
(...skipping 16 matching lines...) Expand all Loading... |
65 DirectRenderer(RendererClient* client, | 65 DirectRenderer(RendererClient* client, |
66 const LayerTreeSettings* settings, | 66 const LayerTreeSettings* settings, |
67 OutputSurface* output_surface, | 67 OutputSurface* output_surface, |
68 ResourceProvider* resource_provider); | 68 ResourceProvider* resource_provider); |
69 | 69 |
70 static gfx::RectF QuadVertexRect(); | 70 static gfx::RectF QuadVertexRect(); |
71 static void QuadRectTransform(gfx::Transform* quad_rect_transform, | 71 static void QuadRectTransform(gfx::Transform* quad_rect_transform, |
72 const gfx::Transform& quad_transform, | 72 const gfx::Transform& quad_transform, |
73 const gfx::RectF& quad_rect); | 73 const gfx::RectF& quad_rect); |
74 void InitializeViewport(DrawingFrame* frame, | 74 void InitializeViewport(DrawingFrame* frame, |
75 gfx::Rect draw_rect, | 75 const gfx::Rect& draw_rect, |
76 gfx::Rect viewport_rect, | 76 const gfx::Rect& viewport_rect, |
77 gfx::Size surface_size); | 77 gfx::Size surface_size); |
78 gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect) const; | 78 gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect) const; |
79 | 79 |
80 bool NeedDeviceClip(const DrawingFrame* frame) const; | 80 bool NeedDeviceClip(const DrawingFrame* frame) const; |
81 gfx::Rect DeviceClipRectInWindowSpace(const DrawingFrame* frame) const; | 81 gfx::Rect DeviceClipRectInWindowSpace(const DrawingFrame* frame) const; |
82 static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); | 82 static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); |
83 void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); | 83 void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); |
84 void SetScissorStateForQuadWithRenderPassScissor( | 84 void SetScissorStateForQuadWithRenderPassScissor( |
85 const DrawingFrame* frame, | 85 const DrawingFrame* frame, |
86 const DrawQuad& quad, | 86 const DrawQuad& quad, |
87 const gfx::RectF& render_pass_scissor, | 87 const gfx::RectF& render_pass_scissor, |
88 bool* should_skip_quad); | 88 bool* should_skip_quad); |
89 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, | 89 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, |
90 gfx::RectF draw_space_rect); | 90 const gfx::RectF& draw_space_rect); |
91 | 91 |
92 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); | 92 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); |
93 | 93 |
94 void DrawRenderPass(DrawingFrame* frame, | 94 void DrawRenderPass(DrawingFrame* frame, |
95 const RenderPass* render_pass, | 95 const RenderPass* render_pass, |
96 bool allow_partial_swap); | 96 bool allow_partial_swap); |
97 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 97 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
98 | 98 |
99 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 99 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
100 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 100 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
101 const ScopedResource* resource, | 101 const ScopedResource* resource, |
102 gfx::Rect target_rect) = 0; | 102 const gfx::Rect& target_rect) = 0; |
103 virtual void SetDrawViewport(gfx::Rect window_space_viewport) = 0; | 103 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) = 0; |
104 virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; | 104 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; |
105 virtual void DiscardPixels(bool has_external_stencil_test, | 105 virtual void DiscardPixels(bool has_external_stencil_test, |
106 bool draw_rect_covers_full_surface) = 0; | 106 bool draw_rect_covers_full_surface) = 0; |
107 virtual void ClearFramebuffer(DrawingFrame* frame, | 107 virtual void ClearFramebuffer(DrawingFrame* frame, |
108 bool has_external_stencil_test) = 0; | 108 bool has_external_stencil_test) = 0; |
109 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; | 109 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; |
110 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; | 110 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; |
111 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; | 111 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; |
112 virtual void FinishDrawingQuadList(); | 112 virtual void FinishDrawingQuadList(); |
113 virtual bool FlippedFramebuffer() const = 0; | 113 virtual bool FlippedFramebuffer() const = 0; |
114 virtual void EnsureScissorTestEnabled() = 0; | 114 virtual void EnsureScissorTestEnabled() = 0; |
(...skipping 20 matching lines...) Expand all Loading... |
135 | 135 |
136 private: | 136 private: |
137 gfx::Vector2d enlarge_pass_texture_amount_; | 137 gfx::Vector2d enlarge_pass_texture_amount_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 139 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace cc | 142 } // namespace cc |
143 | 143 |
144 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 144 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |