skottie_frame_data.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2021 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. #ifndef CC_PAINT_SKOTTIE_FRAME_DATA_H_
  5. #define CC_PAINT_SKOTTIE_FRAME_DATA_H_
  6. #include "base/containers/flat_map.h"
  7. #include "cc/paint/paint_export.h"
  8. #include "cc/paint/paint_flags.h"
  9. #include "cc/paint/paint_image.h"
  10. #include "cc/paint/skottie_resource_metadata.h"
  11. namespace cc {
  12. // The equivalent of skresources::ImageAsset::FrameData, except expressed in
  13. // terms of Chromium Compositor constructs rather than Skia constructs.
  14. // Represents the image to use for an asset in one frame of a Skottie animation.
  15. //
  16. // There's currently no use case for |skresources::ImageAsset::FrameData.matrix|
  17. // so it is omitted for now.
  18. struct CC_PAINT_EXPORT SkottieFrameData {
  19. // PaintImage is preferable at the compositor layer instead of a "raw"
  20. // SkImage. It not only is more well supported for circulating through the
  21. // compositor/graphics pipeline, but also gives the client the most
  22. // versatility for how the image is "backed" (ex: a PaintImageGenerator or
  23. // PaintRecord can be used).
  24. PaintImage image;
  25. // Chromium version of SkSamplingOptions. Controls resampling quality if the
  26. // image needs to be resized when rendering.
  27. PaintFlags::FilterQuality quality = PaintFlags::FilterQuality::kLow;
  28. };
  29. CC_PAINT_EXPORT bool operator==(const SkottieFrameData& frame_l,
  30. const SkottieFrameData& frame_r);
  31. // Map from asset id to the image to use for that asset.
  32. using SkottieFrameDataMap =
  33. base::flat_map<SkottieResourceIdHash, SkottieFrameData>;
  34. } // namespace cc
  35. #endif // CC_PAINT_SKOTTIE_FRAME_DATA_H_