| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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. | |
| 4 | |
| 5 #include "cc/layers/quad_sink.h" | |
| 6 | |
| 7 #include "cc/debug/debug_colors.h" | |
| 8 #include "cc/layers/append_quads_data.h" | |
| 9 #include "cc/layers/layer_impl.h" | |
| 10 #include "cc/quads/debug_border_draw_quad.h" | |
| 11 #include "cc/quads/render_pass.h" | |
| 12 #include "cc/quads/render_pass_draw_quad.h" | |
| 13 #include "cc/trees/occlusion_tracker.h" | |
| 14 #include "third_party/skia/include/core/SkColor.h" | |
| 15 #include "ui/gfx/transform.h" | |
| 16 | |
| 17 namespace cc { | |
| 18 | |
| 19 QuadSink::QuadSink(RenderPass* render_pass, | |
| 20 const OcclusionTracker<LayerImpl>* occlusion_tracker) | |
| 21 : render_pass_(render_pass), | |
| 22 current_shared_quad_state_(NULL), | |
| 23 occlusion_tracker_(occlusion_tracker) { | |
| 24 } | |
| 25 | |
| 26 SharedQuadState* QuadSink::CreateSharedQuadState() { | |
| 27 current_shared_quad_state_ = render_pass_->CreateAndAppendSharedQuadState(); | |
| 28 return current_shared_quad_state_; | |
| 29 } | |
| 30 | |
| 31 gfx::Rect QuadSink::UnoccludedContentRect( | |
| 32 const LayerImpl* layer, | |
| 33 const gfx::Rect& content_rect, | |
| 34 const gfx::Transform& draw_transform) { | |
| 35 return occlusion_tracker_->UnoccludedContentRect( | |
| 36 layer->render_target(), content_rect, draw_transform); | |
| 37 } | |
| 38 | |
| 39 gfx::Rect QuadSink::UnoccludedContributingSurfaceContentRect( | |
| 40 const LayerImpl* layer, | |
| 41 const gfx::Rect& content_rect, | |
| 42 const gfx::Transform& draw_transform) { | |
| 43 return occlusion_tracker_->UnoccludedContributingSurfaceContentRect( | |
| 44 layer, content_rect, draw_transform); | |
| 45 } | |
| 46 | |
| 47 void QuadSink::Append(scoped_ptr<DrawQuad> draw_quad) { | |
| 48 DCHECK(draw_quad->shared_quad_state == current_shared_quad_state_); | |
| 49 DCHECK(!render_pass_->shared_quad_state_list.empty()); | |
| 50 DCHECK(render_pass_->shared_quad_state_list.back() == | |
| 51 current_shared_quad_state_); | |
| 52 DCHECK(!draw_quad->rect.IsEmpty()); | |
| 53 DCHECK(!draw_quad->visible_rect.IsEmpty()); | |
| 54 render_pass_->quad_list.push_back(draw_quad.Pass()); | |
| 55 } | |
| 56 | |
| 57 } // namespace cc | |
| OLD | NEW |