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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 bool disable_picture_quad_image_filtering; | 57 bool disable_picture_quad_image_filtering; |
58 | 58 |
59 OverlayCandidateList overlay_list; | 59 OverlayCandidateList overlay_list; |
60 }; | 60 }; |
61 | 61 |
62 void SetEnlargePassTextureAmountForTesting(const gfx::Vector2d& amount); | 62 void SetEnlargePassTextureAmountForTesting(const gfx::Vector2d& amount); |
63 void DoDrawPolygon(const DrawPolygon& poly, | 63 void DoDrawPolygon(const DrawPolygon& poly, |
64 DrawingFrame* frame, | 64 DrawingFrame* frame, |
65 const gfx::Rect& render_pass_scissor, | 65 const gfx::Rect& render_pass_scissor, |
66 bool using_scissor_as_optimization); | 66 bool use_render_pass_scissor); |
67 | 67 |
68 protected: | 68 protected: |
| 69 enum SurfaceInitializationMode { |
| 70 SURFACE_INITIALIZATION_MODE_PRESERVE, |
| 71 SURFACE_INITIALIZATION_MODE_SCISSORED_CLEAR, |
| 72 SURFACE_INITIALIZATION_MODE_FULL_SURFACE_CLEAR, |
| 73 }; |
| 74 |
69 DirectRenderer(RendererClient* client, | 75 DirectRenderer(RendererClient* client, |
70 const RendererSettings* settings, | 76 const RendererSettings* settings, |
71 OutputSurface* output_surface, | 77 OutputSurface* output_surface, |
72 ResourceProvider* resource_provider); | 78 ResourceProvider* resource_provider); |
73 | 79 |
74 static gfx::RectF QuadVertexRect(); | 80 static gfx::RectF QuadVertexRect(); |
75 static void QuadRectTransform(gfx::Transform* quad_rect_transform, | 81 static void QuadRectTransform(gfx::Transform* quad_rect_transform, |
76 const gfx::Transform& quad_transform, | 82 const gfx::Transform& quad_transform, |
77 const gfx::RectF& quad_rect); | 83 const gfx::RectF& quad_rect); |
78 void InitializeViewport(DrawingFrame* frame, | 84 void InitializeViewport(DrawingFrame* frame, |
79 const gfx::Rect& draw_rect, | 85 const gfx::Rect& draw_rect, |
80 const gfx::Rect& viewport_rect, | 86 const gfx::Rect& viewport_rect, |
81 const gfx::Size& surface_size); | 87 const gfx::Size& surface_size); |
82 gfx::Rect MoveFromDrawToWindowSpace(const DrawingFrame* frame, | 88 gfx::Rect MoveFromDrawToWindowSpace(const DrawingFrame* frame, |
83 const gfx::Rect& draw_rect) const; | 89 const gfx::Rect& draw_rect) const; |
84 | 90 |
85 bool NeedDeviceClip(const DrawingFrame* frame) const; | 91 bool NeedDeviceClip(const DrawingFrame* frame) const; |
86 gfx::Rect DeviceClipRectInWindowSpace(const DrawingFrame* frame) const; | 92 gfx::Rect DeviceClipRectInDrawSpace(const DrawingFrame* frame) const; |
| 93 gfx::Rect DeviceViewportRectInDrawSpace(const DrawingFrame* frame) const; |
| 94 gfx::Rect OutputSurfaceRectInDrawSpace(const DrawingFrame* frame) const; |
87 static gfx::Rect ComputeScissorRectForRenderPass(const DrawingFrame* frame); | 95 static gfx::Rect ComputeScissorRectForRenderPass(const DrawingFrame* frame); |
88 void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); | 96 void SetScissorStateForQuad(const DrawingFrame* frame, |
| 97 const DrawQuad& quad, |
| 98 const gfx::Rect& render_pass_scissor, |
| 99 bool use_render_pass_scissor); |
89 bool ShouldSkipQuad(const DrawQuad& quad, | 100 bool ShouldSkipQuad(const DrawQuad& quad, |
90 const gfx::Rect& render_pass_scissor); | 101 const gfx::Rect& render_pass_scissor); |
91 void SetScissorStateForQuadWithRenderPassScissor( | |
92 const DrawingFrame* frame, | |
93 const DrawQuad& quad, | |
94 const gfx::Rect& render_pass_scissor); | |
95 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, | 102 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, |
96 const gfx::Rect& draw_space_rect); | 103 const gfx::Rect& draw_space_rect); |
97 | 104 |
98 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); | 105 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); |
99 | 106 |
100 void FlushPolygons(ScopedPtrDeque<DrawPolygon>* poly_list, | 107 void FlushPolygons(ScopedPtrDeque<DrawPolygon>* poly_list, |
101 DrawingFrame* frame, | 108 DrawingFrame* frame, |
102 const gfx::Rect& render_pass_scissor, | 109 const gfx::Rect& render_pass_scissor, |
103 bool using_scissor_as_optimization); | 110 bool use_render_pass_scissor); |
104 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 111 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
105 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 112 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
106 | 113 |
107 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 114 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
108 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 115 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
109 const ScopedResource* resource, | 116 const ScopedResource* resource, |
110 const gfx::Rect& target_rect) = 0; | 117 const gfx::Rect& target_rect) = 0; |
111 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) = 0; | 118 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) = 0; |
112 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; | 119 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; |
113 virtual void DiscardPixels(bool has_external_stencil_test, | 120 virtual void PrepareSurfaceForPass( |
114 bool draw_rect_covers_full_surface) = 0; | 121 DrawingFrame* frame, |
115 virtual void ClearFramebuffer(DrawingFrame* frame, | 122 SurfaceInitializationMode initialization_mode, |
116 bool has_external_stencil_test) = 0; | 123 const gfx::Rect& render_pass_scissor) = 0; |
117 // clip_region is a (possibly null) pointer to a quad in the same | 124 // clip_region is a (possibly null) pointer to a quad in the same |
118 // space as the quad. When non-null only the area of the quad that overlaps | 125 // space as the quad. When non-null only the area of the quad that overlaps |
119 // with clip_region will be drawn. | 126 // with clip_region will be drawn. |
120 virtual void DoDrawQuad(DrawingFrame* frame, | 127 virtual void DoDrawQuad(DrawingFrame* frame, |
121 const DrawQuad* quad, | 128 const DrawQuad* quad, |
122 const gfx::QuadF* clip_region) = 0; | 129 const gfx::QuadF* clip_region) = 0; |
123 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; | 130 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; |
124 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; | 131 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; |
125 virtual void FinishDrawingQuadList(); | 132 virtual void FinishDrawingQuadList(); |
126 virtual bool FlippedFramebuffer(const DrawingFrame* frame) const = 0; | 133 virtual bool FlippedFramebuffer(const DrawingFrame* frame) const = 0; |
(...skipping 22 matching lines...) Expand all Loading... |
149 | 156 |
150 private: | 157 private: |
151 gfx::Vector2d enlarge_pass_texture_amount_; | 158 gfx::Vector2d enlarge_pass_texture_amount_; |
152 | 159 |
153 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 160 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
154 }; | 161 }; |
155 | 162 |
156 } // namespace cc | 163 } // namespace cc |
157 | 164 |
158 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 165 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |