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
   50

cc / test / fake_picture_layer.cc [blame]

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/test/fake_picture_layer.h"

#include <utility>

#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/fake_raster_source.h"

namespace cc {

FakePictureLayer::FakePictureLayer(ContentLayerClient* client)
    : PictureLayer(client) {
  SetBounds(gfx::Size(1, 1));
  SetIsDrawable(true);
}

FakePictureLayer::~FakePictureLayer() = default;

std::unique_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl(
    LayerTreeImpl* tree_impl) const {
  auto layer_impl = FakePictureLayerImpl::Create(tree_impl, id());

  if (!fixed_tile_size_.IsEmpty())
    layer_impl->set_fixed_tile_size(fixed_tile_size_);

  return layer_impl;
}

bool FakePictureLayer::Update() {
  bool updated = PictureLayer::Update();
  update_count_++;
  return updated || always_update_resources_;
}

bool FakePictureLayer::RequiresSetNeedsDisplayOnHdrHeadroomChange() const {
  return reraster_on_hdr_change_;
}

scoped_refptr<RasterSource> FakePictureLayer::CreateRasterSource() const {
  if (playback_allowed_event_) {
    return FakeRasterSource::CreateFromRecordingSourceWithWaitable(
        GetRecordingSourceForTesting(), playback_allowed_event_);
  }
  return PictureLayer::CreateRasterSource();
}

}  // namespace cc