#include "third_party/blink/renderer/platform/graphics/image_decoder_wrapper.h"
#include "base/system/sys_info.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/graphics/image_decoding_store.h"
#include "third_party/blink/renderer/platform/graphics/image_frame_generator.h"
namespace blink {
namespace {
ImageDecoder::AlphaOption PixmapAlphaOption(const SkPixmap& pixmap) { … }
bool CompatibleInfo(const SkImageInfo& src, const SkImageInfo& dst) { … }
class ExternalMemoryAllocator final : public SkBitmap::Allocator { … };
}
ImageDecoderWrapper::ImageDecoderWrapper(
ImageFrameGenerator* generator,
SegmentReader* data,
const SkPixmap& pixmap,
ColorBehavior decoder_color_behavior,
cc::AuxImage aux_image,
wtf_size_t index,
bool all_data_received,
cc::PaintImage::GeneratorClientId client_id)
: … { … }
ImageDecoderWrapper::~ImageDecoderWrapper() = default;
namespace {
bool IsLowEndDeviceOrPartialLowEndModeEnabled() { … }
}
bool ImageDecoderWrapper::Decode(ImageDecoderFactory* factory,
wtf_size_t* frame_count,
bool* has_alpha) { … }
bool ImageDecoderWrapper::ShouldDecodeToExternalMemory(
wtf_size_t frame_count,
bool resume_decoding) const { … }
bool ImageDecoderWrapper::ShouldRemoveDecoder(
bool frame_was_completely_decoded,
bool decoded_to_external_memory) const { … }
void ImageDecoderWrapper::PurgeAllFramesIfNecessary(
ImageDecoder* decoder,
bool frame_was_completely_decoded,
wtf_size_t frame_count) const { … }
std::unique_ptr<ImageDecoder> ImageDecoderWrapper::CreateDecoderWithData(
ImageDecoderFactory* factory) const { … }
}