summaryrefslogtreecommitdiffstats
path: root/cc/test/mock_quad_culler.cc
blob: f9924c8bb053521a64c1f8f80b7355766204e0dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/test/mock_quad_culler.h"

#include "cc/quads/draw_quad.h"

namespace cc {

MockQuadCuller::MockQuadCuller()
    : active_quad_list_(&quad_list_storage_),
      active_shared_quad_state_list_(&shared_quad_state_storage_) {}

MockQuadCuller::MockQuadCuller(
    QuadList* external_quad_list,
    SharedQuadStateList* external_shared_quad_state_list)
    : active_quad_list_(external_quad_list),
      active_shared_quad_state_list_(external_shared_quad_state_list) {}

MockQuadCuller::~MockQuadCuller() {}

bool MockQuadCuller::Append(scoped_ptr<DrawQuad> draw_quad, AppendQuadsData*) {
  if (!draw_quad->rect.IsEmpty()) {
    active_quad_list_->push_back(draw_quad.Pass());
    return true;
  }
  return false;
}

SharedQuadState* MockQuadCuller::UseSharedQuadState(
    scoped_ptr<SharedQuadState> shared_quad_state) {
  SharedQuadState* raw_ptr = shared_quad_state.get();
  active_shared_quad_state_list_->push_back(shared_quad_state.Pass());
  return raw_ptr;
}

}  // namespace cc