WebKit Roll 139512:139548
[chromium-blink-merge.git] / cc / render_pass.cc
blob24f1cd51b0e3fb0b044385ab93c82f2109cf560d
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/render_pass.h"
7 namespace cc {
9 scoped_ptr<RenderPass> RenderPass::Create() {
10 return make_scoped_ptr(new RenderPass);
13 RenderPass::RenderPass()
14 : id(Id(-1, -1)),
15 has_transparent_background(true),
16 has_occlusion_from_outside_target_surface(false) {
19 RenderPass::~RenderPass() {
22 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const {
23 DCHECK(new_id != id);
25 scoped_ptr<RenderPass> copy_pass(Create());
26 copy_pass->SetAll(new_id,
27 output_rect,
28 damage_rect,
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);
42 this->id = id;
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);
60 this->id = id;
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());
72 } // namespace cc