#include "third_party/blink/renderer/platform/graphics/image.h"
#include <math.h>
#include <tuple>
#include "base/numerics/checked_math.h"
#include "build/build_config.h"
#include "cc/tiles/software_image_decode_cache.h"
#include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/renderer/platform/geometry/length.h"
#include "third_party/blink/renderer/platform/graphics/bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_image_cache.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.h"
#include "third_party/blink/renderer/platform/graphics/deferred_image_decoder.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_image.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_shader.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.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/SkSurface.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
namespace blink {
Image::Image(ImageObserver* observer, bool is_multipart)
: … { … }
Image::~Image() = default;
Image* Image::NullImage() { … }
cc::ImageDecodeCache& Image::SharedCCDecodeCache(SkColorType color_type) { … }
scoped_refptr<Image> Image::LoadPlatformResource(
int resource_id,
ui::ResourceScaleFactor scale_factor) { … }
PaintImage Image::ResizeAndOrientImage(
const PaintImage& image,
ImageOrientation orientation,
gfx::Vector2dF image_scale,
float opacity,
InterpolationQuality interpolation_quality) { … }
PaintImage Image::ResizeAndOrientImage(
const PaintImage& image,
ImageOrientation orientation,
gfx::Vector2dF image_scale,
float opacity,
InterpolationQuality interpolation_quality,
sk_sp<SkColorSpace> color_space) { … }
Image::SizeAvailability Image::SetData(scoped_refptr<SharedBuffer> data,
bool all_data_received) { … }
String Image::FilenameExtension() const { … }
const AtomicString& Image::MimeType() const { … }
namespace {
sk_sp<PaintShader> CreatePatternShader(const PaintImage& image,
const SkMatrix& shader_matrix,
const SkSamplingOptions& sampling,
bool should_antialias,
const gfx::SizeF& spacing,
SkTileMode tmx,
SkTileMode tmy,
const gfx::Rect& subset_rect) { … }
SkTileMode ComputeTileMode(float left, float right, float min, float max) { … }
}
void Image::DrawPattern(GraphicsContext& context,
const cc::PaintFlags& base_flags,
const gfx::RectF& dest_rect,
const ImageTilingInfo& tiling_info,
const ImageDrawOptions& draw_options) { … }
mojom::blink::ImageAnimationPolicy Image::AnimationPolicy() { … }
scoped_refptr<Image> Image::ImageForDefaultFrame() { … }
PaintImageBuilder Image::CreatePaintImageBuilder() { … }
bool Image::ApplyShader(cc::PaintFlags& flags,
const SkMatrix& local_matrix,
const gfx::RectF& src_rect,
const ImageDrawOptions& draw_options) { … }
SkBitmap Image::AsSkBitmapForCurrentFrame(
RespectImageOrientationEnum respect_image_orientation) { … }
DarkModeImageCache* Image::GetDarkModeImageCache() { … }
gfx::RectF Image::CorrectSrcRectForImageOrientation(gfx::SizeF image_size,
gfx::RectF src_rect) const { … }
}