#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/graphics/logging_canvas.h"
#include <unicode/unistr.h>
#include "base/logging.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h"
#include "third_party/blink/renderer/platform/image-encoders/image_encoder.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkRect.h"
#include "ui/gfx/geometry/size.h"
namespace blink {
namespace {
struct VerbParams { … };
std::unique_ptr<JSONObject> ObjectForSkRect(const SkRect& rect) { … }
String PointModeName(SkCanvas::PointMode mode) { … }
std::unique_ptr<JSONObject> ObjectForSkPoint(const SkPoint& point) { … }
std::unique_ptr<JSONArray> ArrayForSkPoints(size_t count,
const SkPoint points[]) { … }
std::unique_ptr<JSONObject> ObjectForRadius(const SkRRect& rrect,
SkRRect::Corner corner) { … }
String RrectTypeName(SkRRect::Type type) { … }
String RadiusName(SkRRect::Corner corner) { … }
std::unique_ptr<JSONObject> ObjectForSkRRect(const SkRRect& rrect) { … }
String FillTypeName(SkPathFillType type) { … }
VerbParams SegmentParams(SkPath::Verb verb) { … }
std::unique_ptr<JSONObject> ObjectForSkPath(const SkPath& path) { … }
std::unique_ptr<JSONObject> ObjectForSkImage(const SkImage* image) { … }
std::unique_ptr<JSONArray> ArrayForSkScalars(size_t count,
const SkScalar array[]) { … }
std::unique_ptr<JSONObject> ObjectForSkShader(const SkShader& shader) { … }
String StringForSkColor(SkColor color) { … }
void AppendFlagToString(StringBuilder* flags_string,
bool is_set,
const StringView& name) { … }
String StringForSkPaintFlags(const SkPaint& paint) { … }
String StrokeCapName(SkPaint::Cap cap) { … }
String StrokeJoinName(SkPaint::Join join) { … }
String StyleName(SkPaint::Style style) { … }
std::unique_ptr<JSONObject> ObjectForSkPaint(const SkPaint& paint) { … }
String ClipOpName(SkClipOp op) { … }
String FilterModeName(SkFilterMode fm) { … }
String MipmapModeName(SkMipmapMode mm) { … }
std::unique_ptr<JSONObject> ObjectForSkSamplingOptions(
const SkSamplingOptions& sampling) { … }
}
class AutoLogger
: InterceptingCanvasBase::CanvasInterceptorBase<LoggingCanvas> { … };
JSONObject* AutoLogger::LogItem(const String& name) { … }
JSONObject* AutoLogger::LogItemWithParams(const String& name) { … }
LoggingCanvas::LoggingCanvas()
: … { … }
void LoggingCanvas::onDrawPaint(const SkPaint& paint) { … }
void LoggingCanvas::onDrawPoints(PointMode mode,
size_t count,
const SkPoint pts[],
const SkPaint& paint) { … }
void LoggingCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { … }
void LoggingCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { … }
void LoggingCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { … }
void LoggingCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { … }
void LoggingCanvas::onDrawImage2(const SkImage* image,
SkScalar left,
SkScalar top,
const SkSamplingOptions& sampling,
const SkPaint* paint) { … }
void LoggingCanvas::onDrawImageRect2(const SkImage* image,
const SkRect& src,
const SkRect& dst,
const SkSamplingOptions& sampling,
const SkPaint* paint,
SrcRectConstraint constraint) { … }
void LoggingCanvas::onDrawVerticesObject(const SkVertices* vertices,
SkBlendMode bmode,
const SkPaint& paint) { … }
void LoggingCanvas::onDrawDRRect(const SkRRect& outer,
const SkRRect& inner,
const SkPaint& paint) { … }
void LoggingCanvas::onDrawTextBlob(const SkTextBlob* blob,
SkScalar x,
SkScalar y,
const SkPaint& paint) { … }
void LoggingCanvas::onClipRect(const SkRect& rect,
SkClipOp op,
ClipEdgeStyle style) { … }
void LoggingCanvas::onClipRRect(const SkRRect& rrect,
SkClipOp op,
ClipEdgeStyle style) { … }
void LoggingCanvas::onClipPath(const SkPath& path,
SkClipOp op,
ClipEdgeStyle style) { … }
void LoggingCanvas::onClipRegion(const SkRegion& region, SkClipOp op) { … }
void LoggingCanvas::onDrawPicture(const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) { … }
void LoggingCanvas::didSetM44(const SkM44& matrix) { … }
void LoggingCanvas::didConcat44(const SkM44& matrix) { … }
void LoggingCanvas::didScale(SkScalar x, SkScalar y) { … }
void LoggingCanvas::didTranslate(SkScalar x, SkScalar y) { … }
void LoggingCanvas::willSave() { … }
SkCanvas::SaveLayerStrategy LoggingCanvas::getSaveLayerStrategy(
const SaveLayerRec& rec) { … }
void LoggingCanvas::willRestore() { … }
std::unique_ptr<JSONArray> LoggingCanvas::Log() { … }
std::unique_ptr<JSONArray> RecordAsJSON(const PaintRecord& record) { … }
String RecordAsDebugString(const PaintRecord& record) { … }
void ShowPaintRecord(const PaintRecord& record) { … }
std::unique_ptr<JSONArray> SkPictureAsJSON(const SkPicture& picture) { … }
String SkPictureAsDebugString(const SkPicture& picture) { … }
void ShowSkPicture(const SkPicture& picture) { … }
}