Compare selection models in Textfield::ExecuteCommand.
[chromium-blink-merge.git] / cc / trees / quad_culler.cc
blob419a3dd26f37cddd83d30c27f73d3ff66d1d3ceb
1 // Copyright 2012 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/trees/quad_culler.h"
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"
17 namespace cc {
19 QuadCuller::QuadCuller(RenderPass* render_pass,
20 const LayerImpl* layer,
21 const OcclusionTracker<LayerImpl>& occlusion_tracker)
22 : render_pass_(render_pass),
23 layer_(layer),
24 occlusion_tracker_(occlusion_tracker),
25 current_shared_quad_state_(NULL) {
28 SharedQuadState* QuadCuller::CreateSharedQuadState() {
29 current_shared_quad_state_ = render_pass_->CreateAndAppendSharedQuadState();
30 return current_shared_quad_state_;
33 gfx::Rect QuadCuller::UnoccludedContentRect(
34 const gfx::Rect& content_rect,
35 const gfx::Transform& draw_transform) {
36 return occlusion_tracker_.UnoccludedContentRect(
37 layer_->render_target(), content_rect, draw_transform);
40 gfx::Rect QuadCuller::UnoccludedContributingSurfaceContentRect(
41 const gfx::Rect& content_rect,
42 const gfx::Transform& draw_transform) {
43 return occlusion_tracker_.UnoccludedContributingSurfaceContentRect(
44 layer_, content_rect, draw_transform);
47 void QuadCuller::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());
57 } // namespace cc