2009-03-31 03:48:49 +00:00
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2009-03-31 03:48:49 +00:00
|
|
|
#ifndef SkNWayCanvas_DEFINED
|
|
|
|
#define SkNWayCanvas_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvasVirtualEnforcer.h"
|
|
|
|
#include "include/private/SkTDArray.h"
|
|
|
|
#include "include/utils/SkNoDrawCanvas.h"
|
2009-03-31 03:48:49 +00:00
|
|
|
|
2018-03-09 18:40:31 +00:00
|
|
|
class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
|
2009-03-31 03:48:49 +00:00
|
|
|
public:
|
2012-05-01 16:50:25 +00:00
|
|
|
SkNWayCanvas(int width, int height);
|
2017-03-22 16:05:03 +00:00
|
|
|
~SkNWayCanvas() override;
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2013-09-04 17:16:00 +00:00
|
|
|
virtual void addCanvas(SkCanvas*);
|
|
|
|
virtual void removeCanvas(SkCanvas*);
|
|
|
|
virtual void removeAll();
|
2009-03-31 03:48:49 +00:00
|
|
|
|
2013-09-04 17:16:00 +00:00
|
|
|
protected:
|
2009-03-31 03:48:49 +00:00
|
|
|
SkTDArray<SkCanvas*> fList;
|
2012-01-28 01:45:11 +00:00
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void willSave() override;
|
2015-12-18 15:09:18 +00:00
|
|
|
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
|
2018-12-18 22:38:18 +00:00
|
|
|
bool onDoSaveBehind(const SkRect*) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
void willRestore() override;
|
2014-03-12 20:21:48 +00:00
|
|
|
|
2020-04-24 16:02:25 +00:00
|
|
|
void onMarkCTM(const char*) override;
|
2020-04-07 01:32:43 +00:00
|
|
|
void didConcat44(const SkM44&) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
void didConcat(const SkMatrix&) override;
|
|
|
|
void didSetMatrix(const SkMatrix&) override;
|
2020-01-10 22:21:40 +00:00
|
|
|
void didScale(SkScalar, SkScalar) override;
|
|
|
|
void didTranslate(SkScalar, SkScalar) override;
|
2014-03-13 20:03:58 +00:00
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
|
2020-08-14 02:58:04 +00:00
|
|
|
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
|
|
|
const SkPaint& paint) override;
|
|
|
|
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
|
|
|
const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
|
|
|
|
void onDrawPaint(const SkPaint&) override;
|
2019-04-19 19:00:47 +00:00
|
|
|
void onDrawBehind(const SkPaint&) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
|
|
|
|
void onDrawRect(const SkRect&, const SkPaint&) override;
|
2018-03-08 19:52:20 +00:00
|
|
|
void onDrawRegion(const SkRegion&, const SkPaint&) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawOval(const SkRect&, const SkPaint&) override;
|
2016-08-19 18:25:19 +00:00
|
|
|
void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawRRect(const SkRRect&, const SkPaint&) override;
|
|
|
|
void onDrawPath(const SkPath&, const SkPaint&) override;
|
|
|
|
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
|
2015-01-05 15:49:08 +00:00
|
|
|
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
|
2015-07-28 14:35:14 +00:00
|
|
|
const SkPaint*, SrcRectConstraint) override;
|
2018-10-12 15:42:02 +00:00
|
|
|
void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override;
|
2018-03-08 19:52:20 +00:00
|
|
|
void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst,
|
|
|
|
const SkPaint*) override;
|
2020-03-02 22:08:01 +00:00
|
|
|
void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override;
|
2018-03-08 19:52:20 +00:00
|
|
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
|
|
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
2017-05-17 12:53:36 +00:00
|
|
|
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
|
2015-01-05 15:49:08 +00:00
|
|
|
|
2016-12-09 14:00:50 +00:00
|
|
|
void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override;
|
|
|
|
void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override;
|
|
|
|
void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override;
|
2020-03-10 18:02:56 +00:00
|
|
|
void onClipShader(sk_sp<SkShader>, SkClipOp) override;
|
2016-12-09 14:00:50 +00:00
|
|
|
void onClipRegion(const SkRegion&, SkClipOp) override;
|
2014-02-28 18:19:39 +00:00
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
|
2017-09-21 19:28:29 +00:00
|
|
|
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
|
2016-03-05 00:36:20 +00:00
|
|
|
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
|
2014-06-04 12:40:44 +00:00
|
|
|
|
2019-08-27 19:25:49 +00:00
|
|
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
Reland "Reland "Update SkCanvas' experimental SkiaRenderer API""
This reverts commit 138a06d1b1cd035daf6b6a970c75126e94777822.
Reason for revert: add explicit constructors to ImageSetEntry to account for the new arguments,
matching SkiaRenderer's current initializer list. Also hardens SkPictureDrawback's deserialization
code for drawEdgeAAImageSet and drawEdgeAAQuad from a fuzz that was found during the CL's brief
lifespan.
Original change's description:
> Revert "Reland "Update SkCanvas' experimental SkiaRenderer API""
>
> This reverts commit bd9d88a6e4d9730f3aa67227e5a1618180513a87.
>
> Reason for revert: Breaks SkiaRenderer on Android. Rendering is all corrupted, bisected to this change.
>
> Original change's description:
> > Reland "Update SkCanvas' experimental SkiaRenderer API"
> >
> > This reverts commit 90791c202dd2d943565237bf511d929e8bd19951.
> >
> > Reason for revert: Jumped the gun, just need to update blacklist
> >
> > Original change's description:
> > > Revert "Update SkCanvas' experimental SkiaRenderer API"
> > >
> > > This reverts commit 4bf964602ab8758f6e580aaaa69add4fb260c1a6.
> > >
> > > Reason for revert: vulkan dm crashes
> > >
> > > Original change's description:
> > > > Update SkCanvas' experimental SkiaRenderer API
> > > >
> > > > This lifts the temporary functions in SkGpuDevice into SkCanvas and
> > > > deprecates the older experimental_DrawImageSetV1 and
> > > > experimental_DrawEdgeAARect. The new functions can handle paints and
> > > > transform batching. Internally, SkCanvas routes the old functions to the
> > > > new entry points and all device-level code is updated to handle the new
> > > > API features.
> > > >
> > > > While touching all of the canvas/device/recording areas, the
> > > > experimental functions are grouped in an "EdgeAA" cluster instead of being
> > > > separated into the image category and the rectangle category.
> > > >
> > > > Bug: skia:8739
> > > > Change-Id: I67c2a724873040ad5dc3307ab5b2823ba1eac54b
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/190221
> > > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > >
> > > TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
> > >
> > > Change-Id: I87a5a258c5a1bd15e16389cdf91743772d6fa98a
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:8739
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201226
> > > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
> >
> > Change-Id: I75e9b6cbf079a7739b69a7e208730a930621abf9
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:8739
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201229
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Auto-Submit: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
>
> Change-Id: Ib87ef9b8b8598c16a8a6915920adf0b5dffc644b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:8739
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201391
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:8739, oss-fuzz:13794
Change-Id: Ibd7df4a398928c3170d16300bf3ade496125372c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201650
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-19 13:16:38 +00:00
|
|
|
SkBlendMode) override;
|
|
|
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
|
|
|
const SkPaint*, SrcRectConstraint) override;
|
|
|
|
|
2017-10-12 15:08:46 +00:00
|
|
|
void onFlush() override;
|
|
|
|
|
2009-03-31 03:48:49 +00:00
|
|
|
class Iter;
|
|
|
|
|
2013-09-04 17:16:00 +00:00
|
|
|
private:
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = SkCanvasVirtualEnforcer<SkNoDrawCanvas>;
|
2009-03-31 03:48:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|