#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/graphics/decoding_image_generator.h"
#include <memory>
#include <utility>
#include "base/containers/heap_array.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/graphics/image_frame_generator.h"
#include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h"
#include "third_party/blink/renderer/platform/image-decoders/image_decoder.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkImageInfo.h"
namespace {
class ScopedSegmentReaderDataLocker { … };
}
namespace blink {
std::unique_ptr<SkImageGenerator>
DecodingImageGenerator::CreateAsSkImageGenerator(sk_sp<SkData> data) { … }
sk_sp<DecodingImageGenerator> DecodingImageGenerator::Create(
scoped_refptr<ImageFrameGenerator> frame_generator,
const SkImageInfo& info,
scoped_refptr<SegmentReader> data,
WebVector<FrameMetadata> frames,
PaintImage::ContentId content_id,
bool all_data_received,
bool can_yuv_decode,
const cc::ImageHeaderMetadata& image_metadata) { … }
DecodingImageGenerator::DecodingImageGenerator(
scoped_refptr<ImageFrameGenerator> frame_generator,
const SkImageInfo& info,
scoped_refptr<SegmentReader> data,
WebVector<FrameMetadata> frames,
PaintImage::ContentId complete_frame_content_id,
bool all_data_received,
bool can_yuv_decode,
const cc::ImageHeaderMetadata& image_metadata)
: … { … }
DecodingImageGenerator::~DecodingImageGenerator() = default;
sk_sp<SkData> DecodingImageGenerator::GetEncodedData() const { … }
bool DecodingImageGenerator::GetPixels(SkPixmap dst_pixmap,
size_t frame_index,
PaintImage::GeneratorClientId client_id,
uint32_t lazy_pixel_ref) { … }
bool DecodingImageGenerator::QueryYUVA(
const SkYUVAPixmapInfo::SupportedDataTypes& supported_data_types,
SkYUVAPixmapInfo* yuva_pixmap_info) const { … }
bool DecodingImageGenerator::GetYUVAPlanes(
const SkYUVAPixmaps& pixmaps,
size_t frame_index,
uint32_t lazy_pixel_ref,
PaintImage::GeneratorClientId client_id) { … }
SkISize DecodingImageGenerator::GetSupportedDecodeSize(
const SkISize& requested_size) const { … }
PaintImage::ContentId DecodingImageGenerator::GetContentIdForFrame(
size_t frame_index) const { … }
const cc::ImageHeaderMetadata*
DecodingImageGenerator::GetMetadataForDecodeAcceleration() const { … }
}