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

cc / paint / paint_image_generator.cc [blame]

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

#include <utility>
#include <vector>

#include "cc/paint/paint_image_generator.h"

#include "base/atomic_sequence_num.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkSize.h"

namespace cc {

PaintImageGenerator::PaintImageGenerator(const SkImageInfo& info,
                                         std::vector<FrameMetadata> frames)
    : info_(info),
      generator_content_id_(PaintImage::GetNextContentId()),
      frames_(std::move(frames)) {}

PaintImageGenerator::~PaintImageGenerator() = default;

PaintImage::ContentId PaintImageGenerator::GetContentIdForFrame(
    size_t frame_index) const {
  return generator_content_id_;
}

SkISize PaintImageGenerator::GetSupportedDecodeSize(
    const SkISize& requested_size) const {
  // The base class just returns the original size as the only supported decode
  // size.
  return info_.dimensions();
}

const ImageHeaderMetadata*
PaintImageGenerator::GetMetadataForDecodeAcceleration() const {
  return nullptr;
}

}  // namespace cc