190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "cc/test/fake_picture_layer.h"
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "cc/test/fake_picture_layer_impl.h"
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace cc {
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)FakePictureLayer::FakePictureLayer(ContentLayerClient* client)
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    : PictureLayer(client),
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch      update_count_(0),
14558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch      push_properties_count_(0),
15558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch      always_update_resources_(false) {
1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SetAnchorPoint(gfx::PointF(0.f, 0.f));
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SetBounds(gfx::Size(1, 1));
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SetIsDrawable(true);
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)FakePictureLayer::~FakePictureLayer() {}
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl(
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    LayerTreeImpl* tree_impl) {
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  return FakePictureLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>();
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochbool FakePictureLayer::Update(ResourceUpdateQueue* queue,
29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                              const OcclusionTracker* occlusion) {
307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  bool updated = PictureLayer::Update(queue, occlusion);
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  update_count_++;
32558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch  return updated || always_update_resources_;
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
357dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochvoid FakePictureLayer::PushPropertiesTo(LayerImpl* layer) {
367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  PictureLayer::PushPropertiesTo(layer);
377dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  push_properties_count_++;
387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}
397dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
407dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace cc
42