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 "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 gfx::RectF root_damage_rect; | 43 gfx::RectF root_damage_rect; |
44 | 44 |
45 gfx::Transform projection_matrix; | 45 gfx::Transform projection_matrix; |
46 gfx::Transform window_matrix; | 46 gfx::Transform window_matrix; |
47 bool flipped_y; | 47 bool flipped_y; |
48 }; | 48 }; |
49 | 49 |
50 void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); | 50 void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); |
51 | 51 |
52 protected: | 52 protected: |
53 DirectRenderer(RendererClient* client, ResourceProvider* resource_provider); | 53 DirectRenderer(RendererClient* client, |
| 54 OutputSurface* output_surface, |
| 55 ResourceProvider* resource_provider); |
54 | 56 |
55 class CachedResource : public ScopedResource { | 57 class CachedResource : public ScopedResource { |
56 public: | 58 public: |
57 static scoped_ptr<CachedResource> Create( | 59 static scoped_ptr<CachedResource> Create( |
58 ResourceProvider* resource_provider) { | 60 ResourceProvider* resource_provider) { |
59 return make_scoped_ptr(new CachedResource(resource_provider)); | 61 return make_scoped_ptr(new CachedResource(resource_provider)); |
60 } | 62 } |
61 virtual ~CachedResource() {} | 63 virtual ~CachedResource() {} |
62 | 64 |
63 bool is_complete() const { return is_complete_; } | 65 bool is_complete() const { return is_complete_; } |
64 void set_is_complete(bool is_complete) { is_complete_ = is_complete; } | 66 void set_is_complete(bool is_complete) { is_complete_ = is_complete; } |
65 | 67 |
66 protected: | 68 protected: |
67 explicit CachedResource(ResourceProvider* resource_provider) | 69 explicit CachedResource(ResourceProvider* resource_provider) |
68 : ScopedResource(resource_provider), | 70 : ScopedResource(resource_provider), |
69 is_complete_(false) {} | 71 is_complete_(false) {} |
70 | 72 |
71 private: | 73 private: |
72 bool is_complete_; | 74 bool is_complete_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(CachedResource); | 76 DISALLOW_COPY_AND_ASSIGN(CachedResource); |
75 }; | 77 }; |
76 | 78 |
77 static gfx::RectF QuadVertexRect(); | 79 static gfx::RectF QuadVertexRect(); |
78 static void QuadRectTransform(gfx::Transform* quad_rect_transform, | 80 static void QuadRectTransform(gfx::Transform* quad_rect_transform, |
79 const gfx::Transform& quad_transform, | 81 const gfx::Transform& quad_transform, |
80 const gfx::RectF& quad_rect); | 82 const gfx::RectF& quad_rect); |
81 static void InitializeMatrices(DrawingFrame* frame, | 83 static void InitializeMatrices(DrawingFrame* frame, |
82 gfx::Rect draw_rect, | 84 gfx::Rect draw_rect, |
| 85 gfx::Rect window_rect, |
83 bool flip_y); | 86 bool flip_y); |
84 static gfx::Rect MoveScissorToWindowSpace(const DrawingFrame* frame, | 87 gfx::Rect MoveScissorToWindowSpace(const DrawingFrame* frame, |
85 const gfx::RectF& scissor_rect); | 88 const gfx::RectF& scissor_rect); |
86 static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); | 89 static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); |
87 void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); | 90 void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); |
88 void SetScissorStateForQuadWithRenderPassScissor( | 91 void SetScissorStateForQuadWithRenderPassScissor( |
89 const DrawingFrame* frame, | 92 const DrawingFrame* frame, |
90 const DrawQuad& quad, | 93 const DrawQuad& quad, |
91 const gfx::RectF& render_pass_scissor, | 94 const gfx::RectF& render_pass_scissor, |
92 bool* should_skip_quad); | 95 bool* should_skip_quad); |
93 | 96 |
94 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); | 97 static gfx::Size RenderPassTextureSize(const RenderPass* render_pass); |
95 static GLenum RenderPassTextureFormat(const RenderPass* render_pass); | 98 static GLenum RenderPassTextureFormat(const RenderPass* render_pass); |
96 | 99 |
97 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 100 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
98 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 101 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
99 | 102 |
100 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 103 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
101 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 104 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
102 const ScopedResource* resource, | 105 const ScopedResource* resource, |
103 gfx::Rect framebuffer_rect) = 0; | 106 gfx::Rect framebuffer_rect) = 0; |
104 virtual void SetDrawViewportSize(gfx::Size viewport_size) = 0; | 107 virtual void SetDrawViewport(gfx::Rect viewport) = 0; |
105 virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; | 108 virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; |
106 virtual void ClearFramebuffer(DrawingFrame* frame) = 0; | 109 virtual void ClearFramebuffer(DrawingFrame* frame) = 0; |
107 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; | 110 virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; |
108 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; | 111 virtual void BeginDrawingFrame(DrawingFrame* frame) = 0; |
109 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; | 112 virtual void FinishDrawingFrame(DrawingFrame* frame) = 0; |
110 virtual void FinishDrawingQuadList(); | 113 virtual void FinishDrawingQuadList(); |
111 virtual bool FlippedFramebuffer() const = 0; | 114 virtual bool FlippedFramebuffer() const = 0; |
112 virtual void EnsureScissorTestEnabled() = 0; | 115 virtual void EnsureScissorTestEnabled() = 0; |
113 virtual void EnsureScissorTestDisabled() = 0; | 116 virtual void EnsureScissorTestDisabled() = 0; |
114 | 117 |
115 virtual void CopyCurrentRenderPassToBitmap( | 118 virtual void CopyCurrentRenderPassToBitmap( |
116 DrawingFrame* frame, | 119 DrawingFrame* frame, |
117 scoped_ptr<CopyOutputRequest> request) = 0; | 120 scoped_ptr<CopyOutputRequest> request) = 0; |
118 | 121 |
119 ScopedPtrHashMap<RenderPass::Id, CachedResource> render_pass_textures_; | 122 ScopedPtrHashMap<RenderPass::Id, CachedResource> render_pass_textures_; |
| 123 OutputSurface* output_surface_; |
120 ResourceProvider* resource_provider_; | 124 ResourceProvider* resource_provider_; |
121 | 125 |
122 private: | 126 private: |
123 gfx::Vector2d enlarge_pass_texture_amount_; | 127 gfx::Vector2d enlarge_pass_texture_amount_; |
124 | 128 |
125 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 129 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
126 }; | 130 }; |
127 | 131 |
128 } // namespace cc | 132 } // namespace cc |
129 | 133 |
130 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 134 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |