skia_paint_image_generator.cc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "cc/paint/skia_paint_image_generator.h"
  5. #include <utility>
  6. #include "cc/paint/paint_image_generator.h"
  7. namespace cc {
  8. SkiaPaintImageGenerator::SkiaPaintImageGenerator(
  9. sk_sp<PaintImageGenerator> paint_image_generator,
  10. size_t frame_index,
  11. PaintImage::GeneratorClientId client_id)
  12. : SkImageGenerator(paint_image_generator->GetSkImageInfo()),
  13. paint_image_generator_(std::move(paint_image_generator)),
  14. frame_index_(frame_index),
  15. client_id_(client_id) {}
  16. SkiaPaintImageGenerator::~SkiaPaintImageGenerator() = default;
  17. sk_sp<SkData> SkiaPaintImageGenerator::onRefEncodedData() {
  18. return paint_image_generator_->GetEncodedData();
  19. }
  20. bool SkiaPaintImageGenerator::onGetPixels(const SkImageInfo& info,
  21. void* pixels,
  22. size_t row_bytes,
  23. const Options& options) {
  24. return paint_image_generator_->GetPixels(
  25. info, pixels, row_bytes, frame_index_, client_id_, uniqueID());
  26. }
  27. bool SkiaPaintImageGenerator::onQueryYUVAInfo(
  28. const SkYUVAPixmapInfo::SupportedDataTypes& supported_data_types,
  29. SkYUVAPixmapInfo* yuva_pixmap_info) const {
  30. return paint_image_generator_->QueryYUVA(supported_data_types,
  31. yuva_pixmap_info);
  32. }
  33. bool SkiaPaintImageGenerator::onGetYUVAPlanes(const SkYUVAPixmaps& planes) {
  34. return paint_image_generator_->GetYUVAPlanes(planes, frame_index_, uniqueID(),
  35. client_id_);
  36. }
  37. } // namespace cc