paint_image_generator.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include <vector>
  5. #include "cc/paint/paint_image_generator.h"
  6. #include "base/atomic_sequence_num.h"
  7. #include "third_party/skia/include/core/SkImageInfo.h"
  8. #include "third_party/skia/include/core/SkSize.h"
  9. namespace cc {
  10. PaintImageGenerator::PaintImageGenerator(const SkImageInfo& info,
  11. std::vector<FrameMetadata> frames)
  12. : info_(info),
  13. generator_content_id_(PaintImage::GetNextContentId()),
  14. frames_(std::move(frames)) {}
  15. PaintImageGenerator::~PaintImageGenerator() = default;
  16. PaintImage::ContentId PaintImageGenerator::GetContentIdForFrame(
  17. size_t frame_index) const {
  18. return generator_content_id_;
  19. }
  20. SkISize PaintImageGenerator::GetSupportedDecodeSize(
  21. const SkISize& requested_size) const {
  22. // The base class just returns the original size as the only supported decode
  23. // size.
  24. return info_.dimensions();
  25. }
  26. const ImageHeaderMetadata*
  27. PaintImageGenerator::GetMetadataForDecodeAcceleration() const {
  28. return nullptr;
  29. }
  30. } // namespace cc