summaryrefslogtreecommitdiffstats
path: root/cc/layers/surface_layer.cc
blob: 3ca179f2b8a052ed0638c3101a744a8b034945f2 (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
// Copyright 2014 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/layers/surface_layer.h"

#include "cc/layers/surface_layer_impl.h"

namespace cc {

scoped_refptr<SurfaceLayer> SurfaceLayer::Create() {
  return make_scoped_refptr(new SurfaceLayer);
}

SurfaceLayer::SurfaceLayer() : Layer() {
}

SurfaceLayer::~SurfaceLayer() {}

void SurfaceLayer::SetSurfaceId(SurfaceId surface_id) {
  surface_id_ = surface_id;
  UpdateDrawsContent(HasDrawableContent());
  SetNeedsPushProperties();
}

scoped_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
  return SurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
}

bool SurfaceLayer::HasDrawableContent() const {
  return !surface_id_.is_null() && Layer::HasDrawableContent();
}

void SurfaceLayer::PushPropertiesTo(LayerImpl* layer) {
  Layer::PushPropertiesTo(layer);
  SurfaceLayerImpl* layer_impl = static_cast<SurfaceLayerImpl*>(layer);

  layer_impl->SetSurfaceId(surface_id_);
}

}  // namespace cc