chromium/cc/paint/paint_op_writer.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "cc/paint/paint_op_writer.h"

#include <memory>
#include <type_traits>
#include <vector>

#include "base/bits.h"
#include "base/notreached.h"
#include "cc/paint/color_filter.h"
#include "cc/paint/draw_image.h"
#include "cc/paint/draw_looper.h"
#include "cc/paint/image_provider.h"
#include "cc/paint/image_transfer_cache_entry.h"
#include "cc/paint/paint_cache.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_op_buffer_serializer.h"
#include "cc/paint/paint_shader.h"
#include "cc/paint/path_effect.h"
#include "cc/paint/skottie_transfer_cache_entry.h"
#include "cc/paint/skottie_wrapper.h"
#include "cc/paint/transfer_cache_serialize_helper.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkM44.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "third_party/skia/include/core/SkSamplingOptions.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/effects/SkHighContrastFilter.h"
#include "third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "third_party/skia/include/private/chromium/SkImageChromium.h"
#include "third_party/skia/include/private/chromium/Slug.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/mojom/hdr_metadata.mojom.h"

namespace cc {
namespace {

SkIRect MakeSrcRect(const PaintImage& image) {}

void WriteHeader(void* memory, uint8_t type, size_t serialized_size) {}

}  // namespace

// static
size_t PaintOpWriter::SerializedSize(const PaintImage& image) {}

// static
size_t PaintOpWriter::SerializedSize(const SkColorSpace* color_space) {}

// static
size_t PaintOpWriter::SerializedSize(const gfx::HDRMetadata& hdr_metadata) {}

// static
size_t PaintOpWriter::SerializedSize(const SkGainmapInfo& gainmap_info) {}

// static
size_t PaintOpWriter::SerializedSize(const PaintRecord& record) {}

// static
size_t PaintOpWriter::SerializedSize(const SkHighContrastConfig& config) {}

// static
size_t PaintOpWriter::SerializedSize(const ColorFilter* filter) {}

// static
size_t PaintOpWriter::SerializedSize(const DrawLooper* looper) {}

// static
size_t PaintOpWriter::SerializedSize(const PaintFilter* filter) {}

// static
size_t PaintOpWriter::SerializedSize(const PathEffect* effect) {}

PaintOpWriter::~PaintOpWriter() = default;

size_t PaintOpWriter::FinishOp(uint8_t type) {}

void PaintOpWriter::WriteHeaderForTesting(void* memory,
                                          uint8_t type,
                                          size_t serialized_size) {}

void PaintOpWriter::WriteSize(size_t size) {}

void* PaintOpWriter::SkipSize() {}

void PaintOpWriter::WriteSizeAt(void* memory, size_t size) {}

void PaintOpWriter::Write(const SkPath& path, UsePaintCache use_paint_cache) {}

void PaintOpWriter::Write(const PaintFlags& flags, const SkM44& current_ctm) {}

void PaintOpWriter::Write(const DrawImage& draw_image,
                          SkSize* scale_adjustment) {}

void PaintOpWriter::Write(scoped_refptr<SkottieWrapper> skottie) {}

void PaintOpWriter::WriteImage(const DecodedDrawImage& decoded_draw_image) {}

void PaintOpWriter::WriteImage(uint32_t transfer_cache_entry_id,
                               bool needs_mips) {}

void PaintOpWriter::WriteImage(const gpu::Mailbox& mailbox) {}

void PaintOpWriter::Write(const SkHighContrastConfig& config) {}

void PaintOpWriter::Write(const sk_sp<SkData>& data) {}

void PaintOpWriter::Write(const SkSamplingOptions& sampling) {}

void PaintOpWriter::Write(
    const SkGradientShader::Interpolation& interpolation) {}

void PaintOpWriter::Write(const SkColorSpace* color_space) {}

void PaintOpWriter::Write(const gfx::HDRMetadata& hdr_metadata) {}

void PaintOpWriter::Write(const SkGainmapInfo& gainmap_info) {}

void PaintOpWriter::Write(const sk_sp<sktext::gpu::Slug>& slug) {}

sk_sp<PaintShader> PaintOpWriter::TransformShaderIfNecessary(
    const PaintShader* original,
    PaintFlags::FilterQuality quality,
    const SkM44& current_ctm,
    uint32_t* paint_image_transfer_cache_entry_id,
    gfx::SizeF* paint_record_post_scale,
    bool* paint_image_needs_mips,
    gpu::Mailbox* mailbox_out) {}

void PaintOpWriter::Write(SkMatrix matrix) {}

void PaintOpWriter::Write(const SkM44& matrix) {}

void PaintOpWriter::Write(const PaintShader* shader,
                          PaintFlags::FilterQuality quality,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(SkYUVColorSpace yuv_color_space) {}

void PaintOpWriter::Write(SkYUVAInfo::PlaneConfig plane_config) {}

void PaintOpWriter::Write(SkYUVAInfo::Subsampling subsampling) {}

void PaintOpWriter::WriteData(size_t bytes, const void* input) {}

void PaintOpWriter::AlignMemory(size_t alignment) {}

void PaintOpWriter::Write(const ColorFilter* filter) {}

void PaintOpWriter::Write(const DrawLooper* looper) {}

void PaintOpWriter::Write(const PaintFilter* filter, const SkM44& current_ctm) {}

void PaintOpWriter::Write(const PathEffect* effect) {}

void PaintOpWriter::Write(const ColorFilterPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const BlurPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const DropShadowPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const MagnifierPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const ComposePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const AlphaThresholdPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const XfermodePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const ArithmeticPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const MatrixConvolutionPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const DisplacementMapEffectPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const ImagePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const RecordPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const MergePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const MorphologyPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const OffsetPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const TilePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const TurbulencePaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const ShaderPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const MatrixPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const LightingDistantPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const LightingPointPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const LightingSpotPaintFilter& filter,
                          const SkM44& current_ctm) {}

void PaintOpWriter::Write(const PaintRecord& record,
                          const gfx::Rect& playback_rect,
                          const gfx::SizeF& post_scale) {}

void PaintOpWriter::Write(const SkRegion& region) {}

}  // namespace cc