Index: cc/output/direct_renderer.h |
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h |
index 4baadeecbfbfd34f7312747441ae2abda5f3c2d8..864ce91b8df75e82f65e4a5e58c0c482371ae820 100644 |
--- a/cc/output/direct_renderer.h |
+++ b/cc/output/direct_renderer.h |
@@ -50,7 +50,9 @@ class CC_EXPORT DirectRenderer : public Renderer { |
void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); |
protected: |
- DirectRenderer(RendererClient* client, ResourceProvider* resource_provider); |
+ DirectRenderer(RendererClient* client, |
+ OutputSurface* output_surface, |
+ ResourceProvider* resource_provider); |
class CachedResource : public ScopedResource { |
public: |
@@ -78,11 +80,14 @@ class CC_EXPORT DirectRenderer : public Renderer { |
static void QuadRectTransform(gfx::Transform* quad_rect_transform, |
const gfx::Transform& quad_transform, |
const gfx::RectF& quad_rect); |
- static void InitializeMatrices(DrawingFrame* frame, |
- gfx::Rect draw_rect, |
- bool flip_y); |
- static gfx::Rect MoveScissorToWindowSpace(const DrawingFrame* frame, |
- const gfx::RectF& scissor_rect); |
+ void InitializeViewport(DrawingFrame* frame, |
+ gfx::Rect draw_rect, |
+ gfx::Rect viewport_rect, |
+ gfx::Size surface_size, |
+ bool flip_y); |
+ gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect, |
+ bool flip_y) const; |
+ |
static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); |
void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); |
void SetScissorStateForQuadWithRenderPassScissor( |
@@ -100,8 +105,8 @@ class CC_EXPORT DirectRenderer : public Renderer { |
virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
const ScopedResource* resource, |
- gfx::Rect framebuffer_rect) = 0; |
- virtual void SetDrawViewportSize(gfx::Size viewport_size) = 0; |
+ gfx::Rect target_rect) = 0; |
+ virtual void SetDrawViewport(gfx::Rect window_space_viewport) = 0; |
virtual void SetScissorTestRect(gfx::Rect scissor_rect) = 0; |
virtual void ClearFramebuffer(DrawingFrame* frame) = 0; |
virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) = 0; |
@@ -117,8 +122,18 @@ class CC_EXPORT DirectRenderer : public Renderer { |
scoped_ptr<CopyOutputRequest> request) = 0; |
ScopedPtrHashMap<RenderPass::Id, CachedResource> render_pass_textures_; |
+ OutputSurface* output_surface_; |
ResourceProvider* resource_provider_; |
+ // For use in coordinate conversion, this stores the output rect, viewport |
+ // rect (= unflipped version of glViewport rect), and the size of target |
+ // framebuffer. During a draw, this stores the values for the current render |
+ // pass; in between draws, they retain the values for the root render pass of |
+ // the last draw. |
+ gfx::Rect current_draw_rect_; |
+ gfx::Rect current_viewport_rect_; |
+ gfx::Size current_surface_size_; |
+ |
private: |
gfx::Vector2d enlarge_pass_texture_amount_; |