#include "cc/paint/skia_paint_canvas.h"
#include <cstdint>
#include <cstring>
#include <utility>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/trace_event/trace_event.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_filter.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_op.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/paint/paint_recorder.h"
#include "cc/paint/scoped_raster_flags.h"
#include "cc/paint/skottie_wrapper.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkAnnotation.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPoint.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkTextBlob.h"
#include "third_party/skia/include/docs/SkPDFDocument.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/GrRecordingContext.h"
#include "third_party/skia/src/core/SkCanvasPriv.h"
namespace cc {
SkiaPaintCanvas::ContextFlushes::ContextFlushes()
: … { … }
SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas,
ImageProvider* image_provider,
ContextFlushes context_flushes)
: … { … }
SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap,
ImageProvider* image_provider)
: … { … }
SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap,
const SkSurfaceProps& props)
: … { … }
SkiaPaintCanvas::~SkiaPaintCanvas() = default;
SkImageInfo SkiaPaintCanvas::imageInfo() const { … }
void* SkiaPaintCanvas::accessTopLayerPixels(SkImageInfo* info,
size_t* rowBytes,
SkIPoint* origin) { … }
void SkiaPaintCanvas::flush() { … }
bool SkiaPaintCanvas::NeedsFlush() const { … }
int SkiaPaintCanvas::save() { … }
int SkiaPaintCanvas::saveLayer(const PaintFlags& flags) { … }
int SkiaPaintCanvas::saveLayer(const SkRect& bounds, const PaintFlags& flags) { … }
int SkiaPaintCanvas::saveLayerAlphaf(float alpha) { … }
int SkiaPaintCanvas::saveLayerAlphaf(const SkRect& bounds, float alpha) { … }
int SkiaPaintCanvas::saveLayerFilters(base::span<sk_sp<PaintFilter>> filters,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::restore() { … }
int SkiaPaintCanvas::getSaveCount() const { … }
void SkiaPaintCanvas::restoreToCount(int save_count) { … }
void SkiaPaintCanvas::translate(SkScalar dx, SkScalar dy) { … }
void SkiaPaintCanvas::scale(SkScalar sx, SkScalar sy) { … }
void SkiaPaintCanvas::rotate(SkScalar degrees) { … }
void SkiaPaintCanvas::setMatrix(const SkM44& matrix) { … }
void SkiaPaintCanvas::concat(const SkM44& matrix) { … }
void SkiaPaintCanvas::clipRect(const SkRect& rect,
SkClipOp op,
bool do_anti_alias) { … }
void SkiaPaintCanvas::clipRRect(const SkRRect& rrect,
SkClipOp op,
bool do_anti_alias) { … }
void SkiaPaintCanvas::clipPath(const SkPath& path,
SkClipOp op,
bool do_anti_alias,
UsePaintCache) { … }
bool SkiaPaintCanvas::getLocalClipBounds(SkRect* bounds) const { … }
bool SkiaPaintCanvas::getDeviceClipBounds(SkIRect* bounds) const { … }
void SkiaPaintCanvas::drawColor(SkColor4f color, SkBlendMode mode) { … }
void SkiaPaintCanvas::clear(SkColor4f color) { … }
void SkiaPaintCanvas::drawLine(SkScalar x0,
SkScalar y0,
SkScalar x1,
SkScalar y1,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawArc(const SkRect& oval,
SkScalar start_angle_degrees,
SkScalar sweep_angle_degrees,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawRect(const SkRect& rect, const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawIRect(const SkIRect& rect, const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawOval(const SkRect& oval, const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawRRect(const SkRRect& rrect, const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawDRRect(const SkRRect& outer,
const SkRRect& inner,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawRoundRect(const SkRect& rect,
SkScalar rx,
SkScalar ry,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawPath(const SkPath& path,
const PaintFlags& flags,
UsePaintCache) { … }
void SkiaPaintCanvas::drawImage(const PaintImage& image,
SkScalar left,
SkScalar top,
const SkSamplingOptions& sampling,
const PaintFlags* flags) { … }
void SkiaPaintCanvas::drawImageRect(const PaintImage& image,
const SkRect& src,
const SkRect& dst,
const SkSamplingOptions& sampling,
const PaintFlags* flags,
SkCanvas::SrcRectConstraint constraint) { … }
void SkiaPaintCanvas::drawVertices(
scoped_refptr<RefCountedBuffer<SkPoint>> vertices,
scoped_refptr<RefCountedBuffer<SkPoint>> uvs,
scoped_refptr<RefCountedBuffer<uint16_t>> indices,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawSkottie(scoped_refptr<SkottieWrapper> skottie,
const SkRect& dst,
float t,
SkottieFrameDataMap images,
const SkottieColorMap& color_map,
SkottieTextPropertyValueMap text_map) { … }
void SkiaPaintCanvas::drawTextBlob(sk_sp<SkTextBlob> blob,
SkScalar x,
SkScalar y,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawTextBlob(sk_sp<SkTextBlob> blob,
SkScalar x,
SkScalar y,
NodeId node_id,
const PaintFlags& flags) { … }
void SkiaPaintCanvas::drawPicture(PaintRecord record) { … }
void SkiaPaintCanvas::drawPicture(PaintRecord record, bool local_ctm) { … }
SkM44 SkiaPaintCanvas::getLocalToDevice() const { … }
void SkiaPaintCanvas::Annotate(AnnotationType type,
const SkRect& rect,
sk_sp<SkData> data) { … }
void SkiaPaintCanvas::setNodeId(int node_id) { … }
void SkiaPaintCanvas::drawPicture(
PaintRecord record,
PlaybackCallbacks::CustomDataRasterCallback custom_raster_callback,
bool local_ctm) { … }
void SkiaPaintCanvas::FlushAfterDrawIfNeeded() { … }
int SkiaPaintCanvas::GetMaxTextureSize() const { … }
}