#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/paint/paint_op_buffer_serializer.h"
#include <limits>
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/trace_event/trace_event.h"
#include "cc/paint/clear_for_opaque_raster.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_op_buffer_iterator.h"
#include "cc/paint/paint_op_writer.h"
#include "cc/paint/scoped_raster_flags.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/utils/SkNoDrawCanvas.h"
#include "ui/gfx/geometry/skia_conversions.h"
namespace cc {
namespace {
std::unique_ptr<SkCanvas> MakeAnalysisCanvas(
const PaintOp::SerializeOptions& options) { … }
}
PaintOpBufferSerializer::PaintOpBufferSerializer(
SerializeCallback serialize_cb,
void* callback_data,
const PaintOp::SerializeOptions& options)
: … { … }
PaintOpBufferSerializer::~PaintOpBufferSerializer() = default;
PlaybackParams PaintOpBufferSerializer::MakeParams(
const SkCanvas* canvas) const { … }
void PaintOpBufferSerializer::Serialize(const PaintOpBuffer& buffer,
const std::vector<size_t>* offsets,
const Preamble& preamble) { … }
void PaintOpBufferSerializer::Serialize(const PaintOpBuffer& buffer) { … }
void PaintOpBufferSerializer::Serialize(const PaintOpBuffer& buffer,
const gfx::Rect& playback_rect,
const gfx::SizeF& post_scale) { … }
void PaintOpBufferSerializer::ClearForOpaqueRaster(
SkCanvas* canvas,
const Preamble& preamble,
const PlaybackParams& params) { … }
void PaintOpBufferSerializer::SerializePreamble(SkCanvas* canvas,
const Preamble& preamble,
const PlaybackParams& params) { … }
template<>
bool PaintOpBufferSerializer::SerializeOpWithFlags<float>(
SkCanvas* canvas,
const PaintOpWithFlags& flags_op,
const PlaybackParams& params,
float alpha) { … }
template <>
bool PaintOpBufferSerializer::WillSerializeNextOp<float>(
const PaintOp& op,
SkCanvas* canvas,
const PlaybackParams& params,
float alpha) { … }
void PaintOpBufferSerializer::SerializeBuffer(
SkCanvas* canvas,
const PaintOpBuffer& buffer,
const std::vector<size_t>* offsets) { … }
void PaintOpBufferSerializer::SerializeBufferWithParams(
SkCanvas* canvas,
const PlaybackParams& params,
const PaintOpBuffer& buffer,
const std::vector<size_t>* offsets) { … }
bool PaintOpBufferSerializer::SerializeOp(SkCanvas* canvas,
const PaintOp& op,
const PaintFlags* flags_to_serialize,
const PlaybackParams& params) { … }
void PaintOpBufferSerializer::PlaybackOnAnalysisCanvas(
SkCanvas* canvas,
const PaintOp& op,
const PaintFlags* flags_to_serialize,
const PlaybackParams& params) { … }
void PaintOpBufferSerializer::Save(SkCanvas* canvas,
const PlaybackParams& params) { … }
void PaintOpBufferSerializer::RestoreToCount(SkCanvas* canvas,
int count,
const PlaybackParams& params) { … }
SimpleBufferSerializer::SimpleBufferSerializer(
void* memory,
size_t size,
const PaintOp::SerializeOptions& options)
: … { … }
SimpleBufferSerializer::~SimpleBufferSerializer() = default;
size_t SimpleBufferSerializer::SerializeToMemoryImpl(
const PaintOp& op,
const PaintOp::SerializeOptions& options,
const PaintFlags* flags_to_serialize,
const SkM44& current_ctm,
const SkM44& original_ctm) { … }
}