summaryrefslogtreecommitdiffstats
path: root/cc/picture_layer.cc
blob: 01eb454b4d8ab0ce67b9c60486ebcee3eb14ea7d (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
39
40
41
42
43
44
45
46
47
48
49
// 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/picture_layer.h"
#include "cc/picture_layer_impl.h"
#include "ui/gfx/rect_conversions.h"

namespace cc {

scoped_refptr<PictureLayer> PictureLayer::create(ContentLayerClient* client) {
  return make_scoped_refptr(new PictureLayer(client));
}

PictureLayer::PictureLayer(ContentLayerClient* client) :
  client_(client) {
}

PictureLayer::~PictureLayer() {
}

bool PictureLayer::drawsContent() const {
  return Layer::drawsContent() && client_;
}

scoped_ptr<LayerImpl> PictureLayer::createLayerImpl() {
  return PictureLayerImpl::create(id()).PassAs<LayerImpl>();
}

void PictureLayer::pushPropertiesTo(LayerImpl* base_layer) {
  PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
  pile_.PushPropertiesTo(layer_impl->pile_);

  // TODO(enne): Need to sync tiling from active tree prior to this?
  // TODO(nduca): Need to invalidate tiles here from pile's invalidation info.
}

void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) {
  gfx::Rect rect = gfx::ToEnclosedRect(layer_rect);
  pile_.Invalidate(rect);
}

void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
                    RenderingStats& stats) {
  pile_.Resize(bounds());
  pile_.Update(client_, stats);
}

}  // namespace cc