#include "cc/test/skia_common.h"
#include <stddef.h>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
#include "base/base_paths.h"
#include "base/check.h"
#include "base/containers/heap_array.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/draw_image.h"
#include "cc/paint/paint_canvas.h"
#include "cc/paint/paint_image_builder.h"
#include "cc/paint/skottie_wrapper.h"
#include "cc/test/fake_paint_image_generator.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageGenerator.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkYUVAPixmaps.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/ganesh/SkImageGanesh.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/skia_conversions.h"
namespace cc {
namespace {
constexpr char kSkottieJSON[] = …;
constexpr char kSkottieWidthToken[] = …;
constexpr char kSkottieHeightToken[] = …;
constexpr char kSkottieDurationToken[] = …;
constexpr int kFps = …;
}
void DrawDisplayList(unsigned char* buffer,
const gfx::Rect& layer_rect,
scoped_refptr<const DisplayItemList> list) { … }
bool AreDisplayListDrawingResultsSame(const gfx::Rect& layer_rect,
const DisplayItemList* list_a,
const DisplayItemList* list_b) { … }
Region ImageRectsToRegion(const DiscardableImageMap::Rects& rects) { … }
sk_sp<PaintImageGenerator> CreatePaintImageGenerator(const gfx::Size& size) { … }
PaintImage CreatePaintWorkletPaintImage(
scoped_refptr<PaintWorkletInput> input) { … }
SkYUVAPixmapInfo GetYUVAPixmapInfo(const gfx::Size& image_size,
YUVSubsampling format,
SkYUVAPixmapInfo::DataType yuv_data_type,
bool has_alpha) { … }
PaintImage CreateDiscardablePaintImage(
const gfx::Size& size,
sk_sp<SkColorSpace> color_space,
bool allocate_encoded_data,
PaintImage::Id id,
SkColorType color_type,
std::optional<YUVSubsampling> yuv_format,
SkYUVAPixmapInfo::DataType yuv_data_type) { … }
DrawImage CreateDiscardableDrawImage(const gfx::Size& size,
sk_sp<SkColorSpace> color_space,
SkRect rect,
PaintFlags::FilterQuality filter_quality,
const SkM44& matrix) { … }
PaintImage CreateAnimatedImage(const gfx::Size& size,
std::vector<FrameMetadata> frames,
int repetition_count,
PaintImage::Id id) { … }
PaintImage CreateBitmapImage(const gfx::Size& size, SkColorType color_type) { … }
scoped_refptr<SkottieWrapper> CreateSkottie(const gfx::Size& size,
int duration_secs) { … }
scoped_refptr<SkottieWrapper> CreateSkottieFromString(std::string_view json) { … }
std::string LoadSkottieFileFromTestData(
base::FilePath::StringPieceType animation_file_name) { … }
scoped_refptr<SkottieWrapper> CreateSkottieFromTestDataDir(
base::FilePath::StringPieceType animation_file_name) { … }
PaintImage CreateNonDiscardablePaintImage(const gfx::Size& size) { … }
}