OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "cc/render_pass.h" | 5 #include "cc/render_pass.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkImageFilter.h" | |
8 | |
9 using WebKit::WebTransformationMatrix; | 7 using WebKit::WebTransformationMatrix; |
10 | 8 |
11 namespace cc { | 9 namespace cc { |
12 | 10 |
13 scoped_ptr<RenderPass> RenderPass::Create() { | 11 scoped_ptr<RenderPass> RenderPass::Create() { |
14 return make_scoped_ptr(new RenderPass); | 12 return make_scoped_ptr(new RenderPass); |
15 } | 13 } |
16 | 14 |
17 RenderPass::RenderPass() | 15 RenderPass::RenderPass() |
18 : id(Id(-1, -1)), | 16 : id(Id(-1, -1)), |
19 has_transparent_background(true), | 17 has_transparent_background(true), |
20 has_occlusion_from_outside_target_surface(false), | 18 has_occlusion_from_outside_target_surface(false), |
21 filter(NULL) { | 19 filter(NULL) { |
22 } | 20 } |
23 | 21 |
24 RenderPass::~RenderPass() { | 22 RenderPass::~RenderPass() { |
25 SkSafeUnref(filter); | |
26 } | 23 } |
27 | 24 |
28 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const { | 25 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const { |
29 DCHECK(new_id != id); | 26 DCHECK(new_id != id); |
30 | 27 |
31 scoped_ptr<RenderPass> copy_pass(Create()); | 28 scoped_ptr<RenderPass> copy_pass(Create()); |
32 copy_pass->SetAll(new_id, | 29 copy_pass->SetAll(new_id, |
33 output_rect, | 30 output_rect, |
34 damage_rect, | 31 damage_rect, |
35 transform_to_root_target, | 32 transform_to_root_target, |
(...skipping 21 matching lines...) Expand all Loading... |
57 DCHECK(shared_quad_state_list.isEmpty()); | 54 DCHECK(shared_quad_state_list.isEmpty()); |
58 } | 55 } |
59 | 56 |
60 void RenderPass::SetAll(Id id, | 57 void RenderPass::SetAll(Id id, |
61 gfx::Rect output_rect, | 58 gfx::Rect output_rect, |
62 gfx::RectF damage_rect, | 59 gfx::RectF damage_rect, |
63 const WebKit::WebTransformationMatrix& transform_to_root
_target, | 60 const WebKit::WebTransformationMatrix& transform_to_root
_target, |
64 bool has_transparent_background, | 61 bool has_transparent_background, |
65 bool has_occlusion_from_outside_target_surface, | 62 bool has_occlusion_from_outside_target_surface, |
66 const WebKit::WebFilterOperations& filters, | 63 const WebKit::WebFilterOperations& filters, |
67 SkImageFilter* filter, | 64 const SkRefPtr<SkImageFilter>& filter, |
68 const WebKit::WebFilterOperations& background_filters) { | 65 const WebKit::WebFilterOperations& background_filters) { |
69 DCHECK_GT(id.layer_id, 0); | 66 DCHECK_GT(id.layer_id, 0); |
70 DCHECK_GE(id.index, 0); | 67 DCHECK_GE(id.index, 0); |
71 | 68 |
72 this->id = id; | 69 this->id = id; |
73 this->output_rect = output_rect; | 70 this->output_rect = output_rect; |
74 this->damage_rect = damage_rect; | 71 this->damage_rect = damage_rect; |
75 this->transform_to_root_target = transform_to_root_target; | 72 this->transform_to_root_target = transform_to_root_target; |
76 this->has_transparent_background = has_transparent_background; | 73 this->has_transparent_background = has_transparent_background; |
77 this->has_occlusion_from_outside_target_surface = | 74 this->has_occlusion_from_outside_target_surface = |
78 has_occlusion_from_outside_target_surface; | 75 has_occlusion_from_outside_target_surface; |
79 this->filters = filters; | 76 this->filters = filters; |
80 SkRefCnt_SafeAssign(this->filter, filter); | 77 this->filter = filter; |
81 this->background_filters = background_filters; | 78 this->background_filters = background_filters; |
82 | 79 |
83 DCHECK(quad_list.isEmpty()); | 80 DCHECK(quad_list.isEmpty()); |
84 DCHECK(shared_quad_state_list.isEmpty()); | 81 DCHECK(shared_quad_state_list.isEmpty()); |
85 } | 82 } |
86 | 83 |
87 } // namespace cc | 84 } // namespace cc |
OLD | NEW |