1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/quads/render_pass.h"
7 #include "cc/output/copy_output_request.h"
8 #include "cc/quads/draw_quad.h"
9 #include "cc/quads/shared_quad_state.h"
13 scoped_ptr
<RenderPass
> RenderPass::Create() {
14 return make_scoped_ptr(new RenderPass
);
17 RenderPass::RenderPass()
19 has_transparent_background(true),
20 has_occlusion_from_outside_target_surface(false) {}
22 RenderPass::~RenderPass() {}
24 scoped_ptr
<RenderPass
> RenderPass::Copy(Id new_id
) const {
25 scoped_ptr
<RenderPass
> copy_pass(Create());
26 copy_pass
->SetAll(new_id
,
29 transform_to_root_target
,
30 has_transparent_background
,
31 has_occlusion_from_outside_target_surface
);
32 return copy_pass
.Pass();
35 void RenderPass::SetNew(Id id
,
36 gfx::Rect output_rect
,
37 gfx::RectF damage_rect
,
38 const gfx::Transform
& transform_to_root_target
) {
39 DCHECK_GT(id
.layer_id
, 0);
40 DCHECK_GE(id
.index
, 0);
43 this->output_rect
= output_rect
;
44 this->damage_rect
= damage_rect
;
45 this->transform_to_root_target
= transform_to_root_target
;
47 DCHECK(quad_list
.empty());
48 DCHECK(shared_quad_state_list
.empty());
51 void RenderPass::SetAll(Id id
,
52 gfx::Rect output_rect
,
53 gfx::RectF damage_rect
,
54 const gfx::Transform
& transform_to_root_target
,
55 bool has_transparent_background
,
56 bool has_occlusion_from_outside_target_surface
) {
57 DCHECK_GT(id
.layer_id
, 0);
58 DCHECK_GE(id
.index
, 0);
61 this->output_rect
= output_rect
;
62 this->damage_rect
= damage_rect
;
63 this->transform_to_root_target
= transform_to_root_target
;
64 this->has_transparent_background
= has_transparent_background
;
65 this->has_occlusion_from_outside_target_surface
=
66 has_occlusion_from_outside_target_surface
;
68 DCHECK(quad_list
.empty());
69 DCHECK(shared_quad_state_list
.empty());