2076b04d15
1. Feature: Clients need to override didConcat44() (new data) 2. Perf: Clients need to override didTranslate (and now didScale) so our default impls can be empty. Need SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS flag to stage this in clients (anyone who subclasses SkCanvas) Before (with flag) 120.87 canvas_matrix_4x4 8888 108.10 ? canvas_matrix_3x3 8888 108.13 ? canvas_matrix_2x3 8888 141.54 canvas_matrix_scale 8888 128.04 canvas_matrix_trans 8888 After (without the flag) ... 90.79 canvas_matrix_scale 8888 94.51 canvas_matrix_trans 8888 bug: skia:9768 Change-Id: I6f500138dd6b2b24754dc065c650d0bd3c341540 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263349 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
98 lines
4.3 KiB
C++
98 lines
4.3 KiB
C++
|
|
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkNWayCanvas_DEFINED
|
|
#define SkNWayCanvas_DEFINED
|
|
|
|
#include "include/core/SkCanvasVirtualEnforcer.h"
|
|
#include "include/private/SkTDArray.h"
|
|
#include "include/utils/SkNoDrawCanvas.h"
|
|
|
|
class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
|
|
public:
|
|
SkNWayCanvas(int width, int height);
|
|
~SkNWayCanvas() override;
|
|
|
|
virtual void addCanvas(SkCanvas*);
|
|
virtual void removeCanvas(SkCanvas*);
|
|
virtual void removeAll();
|
|
|
|
protected:
|
|
SkTDArray<SkCanvas*> fList;
|
|
|
|
void willSave() override;
|
|
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
|
|
bool onDoSaveBehind(const SkRect*) override;
|
|
void willRestore() override;
|
|
|
|
void didConcat44(const SkScalar[16]) override;
|
|
void didConcat(const SkMatrix&) override;
|
|
void didSetMatrix(const SkMatrix&) override;
|
|
void didScale(SkScalar, SkScalar) override;
|
|
void didTranslate(SkScalar, SkScalar) override;
|
|
|
|
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
|
|
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
|
const SkPaint& paint) override;
|
|
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
|
const SkPoint texCoords[4], SkBlendMode,
|
|
const SkPaint& paint) override;
|
|
|
|
void onDrawPaint(const SkPaint&) override;
|
|
void onDrawBehind(const SkPaint&) override;
|
|
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
|
|
void onDrawRect(const SkRect&, const SkPaint&) override;
|
|
void onDrawRegion(const SkRegion&, const SkPaint&) override;
|
|
void onDrawOval(const SkRect&, const SkPaint&) override;
|
|
void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override;
|
|
void onDrawRRect(const SkRRect&, const SkPaint&) override;
|
|
void onDrawPath(const SkPath&, const SkPaint&) override;
|
|
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
|
|
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
|
|
SrcRectConstraint) override;
|
|
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
|
|
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
|
|
const SkPaint*, SrcRectConstraint) override;
|
|
void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
|
|
const SkPaint*) override;
|
|
void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override;
|
|
void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst,
|
|
const SkPaint*) override;
|
|
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
|
const SkPaint*) override;
|
|
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
|
|
SkBlendMode, const SkPaint&) override;
|
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
|
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
|
|
|
|
void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override;
|
|
void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override;
|
|
void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override;
|
|
void onClipRegion(const SkRegion&, SkClipOp) override;
|
|
|
|
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
|
|
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
|
|
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
|
|
|
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
|
SkBlendMode) override;
|
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
|
const SkPaint*, SrcRectConstraint) override;
|
|
|
|
void onFlush() override;
|
|
|
|
class Iter;
|
|
|
|
private:
|
|
typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED;
|
|
};
|
|
|
|
|
|
#endif
|