chromium/third_party/blink/renderer/platform/graphics/logging_canvas.cc

/*
 * Copyright (C) 2013 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#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) {}

}  // namespace

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) {}

}  // namespace blink