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 14 matching lines...) Expand all Loading... |
25 virtual ~DirectRenderer(); | 25 virtual ~DirectRenderer(); |
26 | 26 |
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 HaveCachedResourcesForRenderPassId(RenderPass::Id id) const | 32 virtual bool HaveCachedResourcesForRenderPassId(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) OVERRIDE; | 35 ContextProvider* offscreen_context_provider, |
| 36 float device_scale_factor, |
| 37 bool allow_partial_swap) OVERRIDE; |
36 | 38 |
37 struct CC_EXPORT DrawingFrame { | 39 struct CC_EXPORT DrawingFrame { |
38 DrawingFrame(); | 40 DrawingFrame(); |
39 ~DrawingFrame(); | 41 ~DrawingFrame(); |
40 | 42 |
41 const RenderPass* root_render_pass; | 43 const RenderPass* root_render_pass; |
42 const RenderPass* current_render_pass; | 44 const RenderPass* current_render_pass; |
43 const ScopedResource* current_texture; | 45 const ScopedResource* current_texture; |
44 | 46 |
45 gfx::RectF root_damage_rect; | 47 gfx::RectF root_damage_rect; |
46 | 48 |
47 gfx::Transform projection_matrix; | 49 gfx::Transform projection_matrix; |
48 gfx::Transform window_matrix; | 50 gfx::Transform window_matrix; |
49 | 51 |
50 ContextProvider* offscreen_context_provider; | 52 ContextProvider* offscreen_context_provider; |
51 }; | 53 }; |
52 | 54 |
53 void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); | 55 void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); |
54 | 56 |
55 protected: | 57 protected: |
56 DirectRenderer(RendererClient* client, | 58 DirectRenderer(RendererClient* client, |
| 59 const LayerTreeSettings* settings, |
57 OutputSurface* output_surface, | 60 OutputSurface* output_surface, |
58 ResourceProvider* resource_provider); | 61 ResourceProvider* resource_provider); |
59 | 62 |
60 class CachedResource : public ScopedResource { | 63 class CachedResource : public ScopedResource { |
61 public: | 64 public: |
62 static scoped_ptr<CachedResource> Create( | 65 static scoped_ptr<CachedResource> Create( |
63 ResourceProvider* resource_provider) { | 66 ResourceProvider* resource_provider) { |
64 return make_scoped_ptr(new CachedResource(resource_provider)); | 67 return make_scoped_ptr(new CachedResource(resource_provider)); |
65 } | 68 } |
66 virtual ~CachedResource() {} | 69 virtual ~CachedResource() {} |
(...skipping 30 matching lines...) Expand all Loading... |
97 const DrawingFrame* frame, | 100 const DrawingFrame* frame, |
98 const DrawQuad& quad, | 101 const DrawQuad& quad, |
99 const gfx::RectF& render_pass_scissor, | 102 const gfx::RectF& render_pass_scissor, |
100 bool* should_skip_quad); | 103 bool* should_skip_quad); |
101 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, | 104 void SetScissorTestRectInDrawSpace(const DrawingFrame* frame, |
102 gfx::RectF draw_space_rect); | 105 gfx::RectF draw_space_rect); |
103 | 106 |
104 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); | 107 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); |
105 static GLenum RenderPassTextureFormat(const RenderPass* render_pass); | 108 static GLenum RenderPassTextureFormat(const RenderPass* render_pass); |
106 | 109 |
107 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 110 void DrawRenderPass(DrawingFrame* frame, |
| 111 const RenderPass* render_pass, |
| 112 bool allow_partial_swap); |
108 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 113 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
109 | 114 |
110 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 115 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
111 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 116 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
112 const ScopedResource* resource, | 117 const ScopedResource* resource, |
113 gfx::Rect target_rect) = 0; | 118 gfx::Rect target_rect) = 0; |
114 virtual void SetDrawViewport(gfx::Rect window_space_viewport) = 0; | 119 virtual void SetDrawViewport(gfx::Rect window_space_viewport) = 0; |
115 virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; | 120 virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; |
116 virtual void ClearFramebuffer(DrawingFrame* frame) = 0; | 121 virtual void ClearFramebuffer(DrawingFrame* frame) = 0; |
117 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; | 122 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
143 | 148 |
144 private: | 149 private: |
145 gfx::Vector2d enlarge_pass_texture_amount_; | 150 gfx::Vector2d enlarge_pass_texture_amount_; |
146 | 151 |
147 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 152 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
148 }; | 153 }; |
149 | 154 |
150 } // namespace cc | 155 } // namespace cc |
151 | 156 |
152 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 157 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |