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>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 9e0b426..720ac60 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1876,23 +1876,6 @@
}
}
-void SkCanvas::experimental_DrawImageSetV1(const ImageSetEntry imageSet[], int cnt,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- TRACE_EVENT0("skia", TRACE_FUNC);
- RETURN_ON_NULL(imageSet);
- RETURN_ON_FALSE(cnt);
-
- this->onDrawImageSet(imageSet, cnt, filterQuality, mode);
-}
-
-void SkCanvas::experimental_DrawEdgeAARectV1(const SkRect& r, QuadAAFlags edgeAA, SkColor color,
- SkBlendMode mode) {
- TRACE_EVENT0("skia", TRACE_FUNC);
- // To avoid redundant logic in our culling code and various backends, we always sort rects
- // before passing them along.
- this->onDrawEdgeAARect(r.makeSorted(), edgeAA, color, mode);
-}
-
void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, const SkPaint* paint) {
TRACE_EVENT0("skia", TRACE_FUNC);
if (bitmap.drawsNothing()) {
@@ -2012,6 +1995,56 @@
LOOPER_END
}
+void SkCanvas::experimental_DrawImageSetV1(const ImageSetEntry imageSet[], int cnt,
+ SkFilterQuality filterQuality, SkBlendMode mode) {
+ TRACE_EVENT0("skia", TRACE_FUNC);
+ RETURN_ON_NULL(imageSet);
+ RETURN_ON_FALSE(cnt);
+
+ // DrawImageSetV1 is the same as DrawEdgeAAImageSet by making a paint from its filterQuality and
+ // blend mode, and not providing any clip region. To safely handle that, we make a copy of the
+ // entry set and set fHasClip to false and fMatrixIndex to -1 on each entry. Since this
+ // function will be going away, that performance hit is acceptable.
+ SkTArray<ImageSetEntry> safeImages(cnt);
+ for (int i = 0; i < cnt; ++i) {
+ ImageSetEntry& e = safeImages.push_back();
+ e = imageSet[i];
+ e.fHasClip = false;
+ e.fMatrixIndex = -1;
+ }
+
+ SkPaint paint;
+ paint.setFilterQuality(filterQuality);
+ paint.setBlendMode(mode);
+ this->onDrawEdgeAAImageSet(safeImages.begin(), cnt, nullptr, nullptr, &paint,
+ kFast_SrcRectConstraint);
+}
+
+void SkCanvas::experimental_DrawEdgeAARectV1(const SkRect& r, QuadAAFlags edgeAA, SkColor color,
+ SkBlendMode mode) {
+ TRACE_EVENT0("skia", TRACE_FUNC);
+ // To avoid redundant logic in our culling code and various backends, we always sort rects
+ // before passing them along.
+ // DrawEdgeAARectV1 is the same as DrawEdgeAAQuad when no clip region is specified
+ this->onDrawEdgeAAQuad(r.makeSorted(), nullptr, edgeAA, color, mode);
+}
+
+void SkCanvas::experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) {
+ TRACE_EVENT0("skia", TRACE_FUNC);
+ // Make sure the rect is sorted before passing it along
+ this->onDrawEdgeAAQuad(rect.makeSorted(), clip, aaFlags, color, mode);
+}
+
+void SkCanvas::experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt,
+ const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[],
+ const SkPaint* paint,
+ SrcRectConstraint constraint) {
+ TRACE_EVENT0("skia", TRACE_FUNC);
+ this->onDrawEdgeAAImageSet(imageSet, cnt, dstClips, preViewMatrices, paint, constraint);
+}
+
//////////////////////////////////////////////////////////////////////////////
// These are the virtual drawing methods
//////////////////////////////////////////////////////////////////////////////
@@ -2103,20 +2136,6 @@
}
}
-void SkCanvas::onDrawEdgeAARect(const SkRect& r, QuadAAFlags edgeAA, SkColor color,
- SkBlendMode mode) {
- SkASSERT(r.isSorted());
-
- SkPaint paint;
- LOOPER_BEGIN(paint, nullptr)
-
- while (iter.next()) {
- iter.fDevice->drawEdgeAARect(r, edgeAA, color, mode);
- }
-
- LOOPER_END
-}
-
void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
SkRect regionRect = SkRect::Make(region.getBounds());
if (paint.canComputeFastBounds()) {
@@ -2512,16 +2531,6 @@
LOOPER_END
}
-void SkCanvas::onDrawImageSet(const ImageSetEntry imageSet[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- SkPaint paint;
- LOOPER_BEGIN(paint, nullptr)
- while (iter.next()) {
- iter.fDevice->drawImageSet(imageSet, count, filterQuality, mode);
- }
- LOOPER_END
-}
-
void SkCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
const SkRect& dst, const SkPaint* paint) {
SkPaint realPaint;
@@ -2689,6 +2698,39 @@
LOOPER_END
}
+void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFlags edgeAA,
+ SkColor color, SkBlendMode mode) {
+ SkASSERT(r.isSorted());
+
+ // If this used a paint, it would be a filled color with blend mode, which does not
+ // need to use an autodraw loop, so use SkDrawIter directly.
+ if (this->quickReject(r)) {
+ return;
+ }
+
+ this->predrawNotify();
+ SkDrawIter iter(this);
+ while(iter.next()) {
+ iter.fDevice->drawEdgeAAQuad(r, clip, edgeAA, color, mode);
+ }
+}
+
+void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SrcRectConstraint constraint) {
+ SkPaint realPaint;
+ init_image_paint(&realPaint, paint);
+
+ // Looper is used when there are image filters, which drawEdgeAAImageSet needs to support
+ // for Chromium's RenderPassDrawQuads' filters.
+ LOOPER_BEGIN(realPaint, nullptr)
+ while (iter.next()) {
+ iter.fDevice->drawEdgeAAImageSet(
+ imageSet, count, dstClips, preViewMatrices, looper.paint(), constraint);
+ }
+ LOOPER_END
+}
+
//////////////////////////////////////////////////////////////////////////////
// These methods are NOT virtual, and therefore must call back into virtual
// methods, rather than actually drawing themselves.
diff --git a/src/core/SkCanvasPriv.cpp b/src/core/SkCanvasPriv.cpp
index 35c9866..5249687 100644
--- a/src/core/SkCanvasPriv.cpp
+++ b/src/core/SkCanvasPriv.cpp
@@ -83,3 +83,17 @@
buffer.writePad32(storage.get(), size);
}
+void SkCanvasPriv::GetDstClipAndMatrixCounts(const SkCanvas::ImageSetEntry set[], int count,
+ int* totalDstClipCount, int* totalMatrixCount) {
+ int dstClipCount = 0;
+ int maxMatrixIndex = -1;
+ for (int i = 0; i < count; ++i) {
+ dstClipCount += 4 * set[i].fHasClip;
+ if (set[i].fMatrixIndex > maxMatrixIndex) {
+ maxMatrixIndex = set[i].fMatrixIndex;
+ }
+ }
+
+ *totalDstClipCount = dstClipCount;
+ *totalMatrixCount = maxMatrixIndex + 1;
+}
diff --git a/src/core/SkCanvasPriv.h b/src/core/SkCanvasPriv.h
index cb25401..e06e06a 100644
--- a/src/core/SkCanvasPriv.h
+++ b/src/core/SkCanvasPriv.h
@@ -43,6 +43,12 @@
static int SaveBehind(SkCanvas* canvas, const SkRect* subset) {
return canvas->only_axis_aligned_saveBehind(subset);
}
+
+ // The experimental_DrawEdgeAAImageSet API accepts separate dstClips and preViewMatrices arrays,
+ // where entries refer into them, but no explicit size is provided. Given a set of entries,
+ // computes the minimum length for these arrays that would provide index access errors.
+ static void GetDstClipAndMatrixCounts(const SkCanvas::ImageSetEntry set[], int count,
+ int* totalDstClipCount, int* totalMatrixCount);
};
#endif
diff --git a/src/core/SkColorSpaceXformCanvas.cpp b/src/core/SkColorSpaceXformCanvas.cpp
index ceb014e..bfbdfa7 100644
--- a/src/core/SkColorSpaceXformCanvas.cpp
+++ b/src/core/SkColorSpaceXformCanvas.cpp
@@ -57,10 +57,6 @@
void onDrawRect(const SkRect& rect, const SkPaint& paint) override {
fTarget->drawRect(rect, fXformer->apply(paint));
}
- void onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) override {
- fTarget->experimental_DrawEdgeAARectV1(rect, aa, fXformer->apply(color), mode);
- }
void onDrawOval(const SkRect& oval, const SkPaint& paint) override {
fTarget->drawOval(oval, fXformer->apply(paint));
}
@@ -155,18 +151,6 @@
dst, MaybePaint(paint, fXformer.get()));
}
}
- void onDrawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) override {
- SkAutoTArray<ImageSetEntry> xformedSet(count);
- for (int i = 0; i < count; ++i) {
- xformedSet[i].fImage = this->prepareImage(set[i].fImage.get());
- xformedSet[i].fSrcRect = set[i].fSrcRect;
- xformedSet[i].fDstRect = set[i].fDstRect;
- xformedSet[i].fAlpha = set[i].fAlpha;
- xformedSet[i].fAAFlags = set[i].fAAFlags;
- }
- fTarget->experimental_DrawImageSetV1(xformedSet.get(), count, filterQuality, mode);
- }
void onDrawAtlas(const SkImage* atlas, const SkRSXform* xforms, const SkRect* tex,
const SkColor* colors, int count, SkBlendMode mode,
@@ -246,6 +230,28 @@
SkCanvas::onDrawDrawable(drawable, matrix);
}
+ void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aa, SkColor color, SkBlendMode mode) override {
+ fTarget->experimental_DrawEdgeAAQuad(
+ rect, clip, aa, fXformer->apply(color), mode);
+ }
+ void onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SrcRectConstraint constraint) override {
+ SkAutoTArray<ImageSetEntry> xformedSet(count);
+ for (int i = 0; i < count; ++i) {
+ xformedSet[i].fImage = this->prepareImage(set[i].fImage.get());
+ xformedSet[i].fSrcRect = set[i].fSrcRect;
+ xformedSet[i].fDstRect = set[i].fDstRect;
+ xformedSet[i].fMatrixIndex = set[i].fMatrixIndex;
+ xformedSet[i].fAlpha = set[i].fAlpha;
+ xformedSet[i].fAAFlags = set[i].fAAFlags;
+ xformedSet[i].fHasClip = set[i].fHasClip;
+ }
+ fTarget->experimental_DrawEdgeAAImageSet(xformedSet.get(), count, dstClips, preViewMatrices,
+ MaybePaint(paint, fXformer.get()), constraint);
+ }
+
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override {
sk_sp<SkImageFilter> backdrop = rec.fBackdrop ? fXformer->apply(rec.fBackdrop) : nullptr;
sk_sp<SkImage> clipMask = rec.fClipMask ? fXformer->apply(rec.fClipMask) : nullptr;
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index d44dda8..a52bd84 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -128,16 +128,6 @@
this->drawPath(path, paint, true);
}
-void SkBaseDevice::drawEdgeAARect(const SkRect& r, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- SkPaint paint;
- paint.setColor(color);
- paint.setBlendMode(mode);
- paint.setAntiAlias(aa == SkCanvas::kAll_QuadAAFlags);
-
- this->drawRect(r, paint);
-}
-
void SkBaseDevice::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkBlendMode bmode, const SkPaint& paint) {
SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &this->ctm());
@@ -204,22 +194,6 @@
}
}
-void SkBaseDevice::drawImageSet(const SkCanvas::ImageSetEntry images[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- SkPaint paint;
- paint.setFilterQuality(SkTPin(filterQuality, kNone_SkFilterQuality, kLow_SkFilterQuality));
- paint.setBlendMode(mode);
- for (int i = 0; i < count; ++i) {
- // TODO: Handle per-edge AA. Right now this mirrors the SkiaRenderer component of Chrome
- // which turns off antialiasing unless all four edges should be antialiased. This avoids
- // seaming in tiled composited layers.
- paint.setAntiAlias(images[i].fAAFlags == SkCanvas::kAll_QuadAAFlags);
- paint.setAlpha(SkToUInt(SkTClamp(SkScalarRoundToInt(images[i].fAlpha * 255), 0, 255)));
- this->drawImageRect(images[i].fImage.get(), &images[i].fSrcRect, images[i].fDstRect, paint,
- SkCanvas::kFast_SrcRectConstraint);
- }
-}
-
void SkBaseDevice::drawBitmapLattice(const SkBitmap& bitmap,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint& paint) {
@@ -275,6 +249,70 @@
this->drawVertices(builder.detach().get(), nullptr, 0, mode, p);
}
+
+void SkBaseDevice::drawEdgeAAQuad(const SkRect& r, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setBlendMode(mode);
+ paint.setAntiAlias(aa == SkCanvas::kAll_QuadAAFlags);
+
+ if (clip) {
+ // Draw the clip directly as a quad since it's a filled color with no local coords
+ SkPath clipPath;
+ clipPath.addPoly(clip, 4, true);
+ this->drawPath(clipPath, paint);
+ } else {
+ this->drawRect(r, paint);
+ }
+}
+
+void SkBaseDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry images[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint& paint,
+ SkCanvas::SrcRectConstraint constraint) {
+ SkASSERT(paint.getStyle() == SkPaint::kFill_Style);
+ SkASSERT(!paint.getPathEffect());
+
+ SkPaint entryPaint = paint;
+ const SkMatrix baseCTM = this->ctm();
+ int clipIndex = 0;
+ for (int i = 0; i < count; ++i) {
+ // TODO: Handle per-edge AA. Right now this mirrors the SkiaRenderer component of Chrome
+ // which turns off antialiasing unless all four edges should be antialiased. This avoids
+ // seaming in tiled composited layers.
+ entryPaint.setAntiAlias(images[i].fAAFlags == SkCanvas::kAll_QuadAAFlags);
+ entryPaint.setAlphaf(paint.getAlphaf() * images[i].fAlpha);
+
+ bool needsRestore = false;
+ SkASSERT(images[i].fMatrixIndex < 0 || preViewMatrices);
+ if (images[i].fMatrixIndex >= 0) {
+ this->save();
+ this->setGlobalCTM(SkMatrix::Concat(
+ baseCTM, preViewMatrices[images[i].fMatrixIndex]));
+ needsRestore = true;
+ }
+
+ SkASSERT(!images[i].fHasClip || dstClips);
+ if (images[i].fHasClip) {
+ // Since drawImageRect requires a srcRect, the dst clip is implemented as a true clip
+ if (!needsRestore) {
+ this->save();
+ needsRestore = true;
+ }
+ SkPath clipPath;
+ clipPath.addPoly(dstClips + clipIndex, 4, true);
+ this->clipPath(clipPath, SkClipOp::kIntersect, entryPaint.isAntiAlias());
+ clipIndex += 4;
+ }
+ this->drawImageRect(images[i].fImage.get(), &images[i].fSrcRect, images[i].fDstRect,
+ entryPaint, constraint);
+ if (needsRestore) {
+ this->restore(baseCTM);
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
void SkBaseDevice::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix, SkCanvas* canvas) {
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index c0796cd..5a0f246 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -175,11 +175,6 @@
virtual void drawDRRect(const SkRRect& outer,
const SkRRect& inner, const SkPaint&);
- // Default impl always calls drawRect() with a solid-color paint, setting it to anti-aliased
- // only when all edge flags are set.
- virtual void drawEdgeAARect(const SkRect& r, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode);
-
/**
* If pathIsMutable, then the implementation is allowed to cast path to a
* non-const pointer and modify it in place (as an optimization). Canvas
@@ -212,9 +207,6 @@
virtual void drawImageLattice(const SkImage*, const SkCanvas::Lattice&,
const SkRect& dst, const SkPaint&);
- virtual void drawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality,
- SkBlendMode);
-
virtual void drawVertices(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
SkBlendMode, const SkPaint&) = 0;
virtual void drawShadow(const SkPath&, const SkDrawShadowRec&);
@@ -230,6 +222,17 @@
virtual void drawAnnotation(const SkRect&, const char[], SkData*) {}
+ // Default impl always calls drawRect() with a solid-color paint, setting it to anti-aliased
+ // only when all edge flags are set. If there's a clip region, it draws that using drawPath,
+ // or uses clipPath().
+ virtual void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aaFlags, SkColor color, SkBlendMode mode);
+ // Default impl uses drawImageRect per entry, being anti-aliased only when an entry's edge flags
+ // are all set. If there's a clip region, it will be applied using clipPath().
+ virtual void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint& paint, SkCanvas::SrcRectConstraint);
+
/** The SkDevice passed will be an SkDevice which was returned by a call to
onCreateDevice on this device with kNeverTile_TileExpectation.
*/
@@ -341,8 +344,6 @@
friend class SkGlyphRunList;
friend class SkGlyphRunBuilder;
- friend class ClipTileRenderer; // GM needs context() until API is in SkCanvas
-
// used to change the backend's pixels (and possibly config/rowbytes)
// but cannot change the width/height, so there should be no change to
// any clip information.
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp
index 1c9c742..7083a7a 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -52,12 +52,13 @@
M(Flush) M(Save) M(Restore) M(SaveLayer) M(SaveBehind) \
M(Concat) M(SetMatrix) M(Translate) \
M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \
- M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawEdgeAARect) \
+ M(DrawPaint) M(DrawPath) M(DrawRect) \
M(DrawRegion) M(DrawOval) M(DrawArc) \
M(DrawRRect) M(DrawDRRect) M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) \
- M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice) M(DrawImageSet) \
+ M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice) \
M(DrawTextBlob) \
- M(DrawPatch) M(DrawPoints) M(DrawVertices) M(DrawAtlas) M(DrawShadowRec)
+ M(DrawPatch) M(DrawPoints) M(DrawVertices) M(DrawAtlas) M(DrawShadowRec) \
+ M(DrawEdgeAAQuad) M(DrawEdgeAAImageSet)
#define M(T) T,
enum class Type : uint8_t { TYPES(M) };
@@ -190,19 +191,6 @@
SkPaint paint;
void draw(SkCanvas* c, const SkMatrix&) const { c->drawRect(rect, paint); }
};
- struct DrawEdgeAARect final : Op {
- static const auto kType = Type::DrawEdgeAARect;
- DrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode)
- : rect(rect), aa(aa), color(color), mode(mode) {}
- SkRect rect;
- SkCanvas::QuadAAFlags aa;
- SkColor color;
- SkBlendMode mode;
- void draw(SkCanvas* c, const SkMatrix&) const {
- c->experimental_DrawEdgeAARectV1(rect, aa, color, mode);
- }
- };
struct DrawRegion final : Op {
static const auto kType = Type::DrawRegion;
DrawRegion(const SkRegion& region, const SkPaint& paint) : region(region), paint(paint) {}
@@ -349,21 +337,6 @@
&paint);
}
};
- struct DrawImageSet final : Op {
- static const auto kType = Type::DrawImageSet;
- DrawImageSet(const SkCanvas::ImageSetEntry set[], int count, SkFilterQuality quality,
- SkBlendMode xfermode)
- : count(count), quality(quality), xfermode(xfermode), set(count) {
- std::copy_n(set, count, this->set.get());
- }
- int count;
- SkFilterQuality quality;
- SkBlendMode xfermode;
- SkAutoTArray<SkCanvas::ImageSetEntry> set;
- void draw(SkCanvas* c, const SkMatrix&) const {
- c->experimental_DrawImageSetV1(set.get(), count, quality, xfermode);
- }
- };
struct DrawTextBlob final : Op {
static const auto kType = Type::DrawTextBlob;
DrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint)
@@ -459,6 +432,48 @@
c->private_draw_shadow_rec(fPath, fRec);
}
};
+
+ struct DrawEdgeAAQuad final : Op {
+ static const auto kType = Type::DrawEdgeAAQuad;
+ DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode)
+ : rect(rect), hasClip(clip != nullptr), aa(aa), color(color), mode(mode) {
+ if (clip) {
+ for (int i = 0; i < 4; ++i) {
+ this->clip[i] = clip[i];
+ }
+ }
+ }
+ SkRect rect;
+ SkPoint clip[4];
+ bool hasClip;
+ SkCanvas::QuadAAFlags aa;
+ SkColor color;
+ SkBlendMode mode;
+ void draw(SkCanvas* c, const SkMatrix&) const {
+ c->experimental_DrawEdgeAAQuad(rect, hasClip ? clip : nullptr, aa, color, mode);
+ }
+ };
+ struct DrawEdgeAAImageSet final : Op {
+ static const auto kType = Type::DrawEdgeAAImageSet;
+ DrawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count, int dstClipCount,
+ const SkPaint* paint, SkCanvas::SrcRectConstraint constraint)
+ : count(count), set(count), dstClipCount(dstClipCount), constraint(constraint) {
+ std::copy_n(set, count, this->set.get());
+ if (paint) { this->paint = *paint; }
+ }
+ int count;
+ SkAutoTArray<SkCanvas::ImageSetEntry> set;
+ int dstClipCount;
+ SkPaint paint;
+ SkCanvas::SrcRectConstraint constraint;
+ void draw(SkCanvas* c, const SkMatrix&) const {
+ auto dstClips = pod<SkPoint>(this);
+ auto preViewMatrices = pod<SkMatrix>(this, dstClipCount * sizeof(SkPoint));
+ c->experimental_DrawEdgeAAImageSet(
+ set.get(), count, dstClips, preViewMatrices, &paint, constraint);
+ }
+ };
}
template <typename T, typename... Args>
@@ -533,10 +548,6 @@
void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) {
this->push<DrawRect>(0, rect, paint);
}
-void SkLiteDL::drawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- this->push<DrawEdgeAARect>(0, rect, aa, color, mode);
-}
void SkLiteDL::drawRegion(const SkRegion& region, const SkPaint& paint) {
this->push<DrawRegion>(0, region, paint);
}
@@ -592,11 +603,6 @@
lattice.fRectTypes, fs);
}
-void SkLiteDL::drawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- this->push<DrawImageSet>(0, set, count, filterQuality, mode);
-}
-
void SkLiteDL::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) {
this->push<DrawTextBlob>(0, blob, x,y, paint);
}
@@ -636,6 +642,24 @@
this->push<DrawShadowRec>(0, path, rec);
}
+void SkLiteDL::drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ this->push<DrawEdgeAAQuad>(0, rect, clip, aa, color, mode);
+}
+
+void SkLiteDL::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) {
+ int totalDstClipCount, totalMatrixCount;
+ SkCanvasPriv::GetDstClipAndMatrixCounts(set, count, &totalDstClipCount, &totalMatrixCount);
+
+ size_t bytes = totalDstClipCount * sizeof(SkPoint) + totalMatrixCount * sizeof(SkMatrix);
+ void* pod = this->push<DrawEdgeAAImageSet>(
+ bytes, set, count, totalDstClipCount, paint, constraint);
+ copy_v(pod, dstClips, totalDstClipCount,
+ preViewMatrices, totalMatrixCount);
+}
+
typedef void(*draw_fn)(const void*, SkCanvas*, const SkMatrix&);
typedef void(*void_fn)(const void*);
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index a6041bc..ea9a5fa 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -46,7 +46,6 @@
void drawPaint (const SkPaint&);
void drawPath (const SkPath&, const SkPaint&);
void drawRect (const SkRect&, const SkPaint&);
- void drawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode);
void drawRegion(const SkRegion&, const SkPaint&);
void drawOval (const SkRect&, const SkPaint&);
void drawArc (const SkRect&, SkScalar, SkScalar, bool, const SkPaint&);
@@ -65,7 +64,6 @@
SkCanvas::SrcRectConstraint);
void drawImageLattice(sk_sp<const SkImage>, const SkCanvas::Lattice&,
const SkRect&, const SkPaint*);
- void drawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality, SkBlendMode);
void drawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4],
SkBlendMode, const SkPaint&);
@@ -76,6 +74,12 @@
SkBlendMode, const SkRect*, const SkPaint*);
void drawShadowRec(const SkPath&, const SkDrawShadowRec&);
+ void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags,
+ SkColor color, SkBlendMode mode);
+ void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[], const SkPaint* paint,
+ SkCanvas::SrcRectConstraint constraint);
+
private:
template <typename T, typename... Args>
void* push(size_t, Args&&...);
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index 6dda8d6..f95dc34 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -66,10 +66,6 @@
void SkLiteRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
fDL->drawRect(rect, paint);
}
-void SkLiteRecorder::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- fDL->drawEdgeAARect(rect, aa, color, mode);
-}
void SkLiteRecorder::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
fDL->drawRegion(region, paint);
}
@@ -147,11 +143,6 @@
fDL->drawImageLattice(sk_ref_sp(img), lattice, dst, paint);
}
-void SkLiteRecorder::onDrawImageSet(const ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- fDL->drawImageSet(set, count, filterQuality, mode);
-}
-
void SkLiteRecorder::onDrawPatch(const SkPoint cubics[12],
const SkColor colors[4], const SkPoint texCoords[4],
SkBlendMode bmode, const SkPaint& paint) {
@@ -180,3 +171,14 @@
void SkLiteRecorder::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) {
fDL->drawShadowRec(path, rec);
}
+
+void SkLiteRecorder::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) {
+ fDL->drawEdgeAAQuad(rect, clip, aaFlags, color, mode);
+}
+void SkLiteRecorder::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[], const SkPaint* paint,
+ SkCanvas::SrcRectConstraint constraint) {
+ fDL->drawEdgeAAImageSet(set, count, dstClips, preViewMatrices, paint, constraint);
+}
diff --git a/src/core/SkLiteRecorder.h b/src/core/SkLiteRecorder.h
index 81eedb3..7b54f89 100644
--- a/src/core/SkLiteRecorder.h
+++ b/src/core/SkLiteRecorder.h
@@ -39,7 +39,6 @@
void onDrawPaint (const SkPaint&) override;
void onDrawPath (const SkPath&, const SkPaint&) override;
void onDrawRect (const SkRect&, const SkPaint&) override;
- void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) 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;
@@ -64,7 +63,6 @@
void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override;
void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
SrcRectConstraint) override;
- void onDrawImageSet(const ImageSetEntry[], int count, SkFilterQuality, SkBlendMode) override;
void onDrawPatch(const SkPoint[12], const SkColor[4],
const SkPoint[4], SkBlendMode, const SkPaint&) override;
@@ -75,6 +73,11 @@
int, SkBlendMode, const SkRect*, const SkPaint*) override;
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
+ void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
+ SkBlendMode) override;
+ void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
+ const SkPaint*, SrcRectConstraint) override;
+
private:
typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED;
diff --git a/src/core/SkOverdrawCanvas.cpp b/src/core/SkOverdrawCanvas.cpp
index a7b39bb..ef611cd 100644
--- a/src/core/SkOverdrawCanvas.cpp
+++ b/src/core/SkOverdrawCanvas.cpp
@@ -117,11 +117,6 @@
fList[0]->onDrawRect(rect, this->overdrawPaint(paint));
}
-void SkOverdrawCanvas::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- fList[0]->onDrawRect(rect, fPaint);
-}
-
void SkOverdrawCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
fList[0]->onDrawRegion(region, this->overdrawPaint(paint));
}
@@ -211,13 +206,6 @@
}
}
-void SkOverdrawCanvas::onDrawImageSet(const ImageSetEntry set[], int count, SkFilterQuality,
- SkBlendMode) {
- for (int i = 0; i < count; ++i) {
- fList[0]->onDrawRect(set[i].fDstRect, fPaint);
- }
-}
-
void SkOverdrawCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
const SkPaint*) {
fList[0]->onDrawRect(SkRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()), fPaint);
@@ -256,6 +244,41 @@
fList[0]->onDrawRect(bounds, fPaint);
}
+void SkOverdrawCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ if (clip) {
+ SkPath path;
+ path.addPoly(clip, 4, true);
+ fList[0]->onDrawPath(path, fPaint);
+ } else {
+ fList[0]->onDrawRect(rect, fPaint);
+ }
+}
+
+void SkOverdrawCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[], const SkPaint* paint,
+ SrcRectConstraint constraint) {
+ int clipIndex = 0;
+ for (int i = 0; i < count; ++i) {
+ if (set[i].fMatrixIndex >= 0) {
+ fList[0]->save();
+ fList[0]->concat(preViewMatrices[set[i].fMatrixIndex]);
+ }
+ if (set[i].fHasClip) {
+ SkPath path;
+ path.addPoly(dstClips + clipIndex, 4, true);
+ clipIndex += 4;
+ fList[0]->onDrawPath(path, fPaint);
+ } else {
+ fList[0]->onDrawRect(set[i].fDstRect, fPaint);
+ }
+ if (set[i].fMatrixIndex >= 0) {
+ fList[0]->restore();
+ }
+ }
+}
+
inline SkPaint SkOverdrawCanvas::overdrawPaint(const SkPaint& paint) {
SkPaint newPaint = fPaint;
newPaint.setStyle(paint.getStyle());
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index de1c269..34e4dfb 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -97,13 +97,13 @@
FLUSH,
- DRAW_IMAGE_SET,
+ DRAW_EDGEAA_IMAGE_SET,
SAVE_BEHIND,
- DRAW_EDGEAA_RECT,
+ DRAW_EDGEAA_QUAD,
- LAST_DRAWTYPE_ENUM = DRAW_EDGEAA_RECT,
+ LAST_DRAWTYPE_ENUM = DRAW_EDGEAA_QUAD,
};
enum DrawVertexFlags {
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index e0120dd..4a51ab0 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -274,15 +274,55 @@
canvas->drawDRRect(outer, inner, *paint);
}
} break;
- case DRAW_EDGEAA_RECT: {
+ case DRAW_EDGEAA_QUAD: {
SkRect rect;
reader->readRect(&rect);
SkCanvas::QuadAAFlags aaFlags = static_cast<SkCanvas::QuadAAFlags>(reader->read32());
SkColor color = reader->read32();
SkBlendMode blend = static_cast<SkBlendMode>(reader->read32());
+ bool hasClip = reader->readInt();
+ SkPoint clip[4];
+ if (hasClip) {
+ for (int i = 0; i < 4; ++i) {
+ reader->readPoint(&clip[i]);
+ }
+ }
+ BREAK_ON_READ_ERROR(reader);
+ canvas->experimental_DrawEdgeAAQuad(rect, hasClip ? clip : nullptr,
+ aaFlags, color, blend);
+ } break;
+ case DRAW_EDGEAA_IMAGE_SET: {
+ int cnt = reader->readInt();
+ if (!reader->validate(cnt >= 0)) {
+ break;
+ }
+ const SkPaint* paint = fPictureData->getPaint(reader);
+ SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstraint)reader->readInt();
+ SkAutoTArray<SkCanvas::ImageSetEntry> set(cnt);
+ for (int i = 0; i < cnt; ++i) {
+ set[i].fImage = sk_ref_sp(fPictureData->getImage(reader));
+ reader->readRect(&set[i].fSrcRect);
+ reader->readRect(&set[i].fDstRect);
+ set[i].fMatrixIndex = reader->readInt();
+ set[i].fAlpha = reader->readScalar();
+ set[i].fAAFlags = reader->readUInt();
+ set[i].fHasClip = reader->readInt();
+ }
+
+ int dstClipCount = reader->readInt();
+ SkTArray<SkPoint> dstClips(dstClipCount);
+ for (int i = 0; i < dstClipCount; ++i) {
+ reader->readPoint(&dstClips.push_back());
+ }
+ int matrixCount = reader->readInt();
+ SkTArray<SkMatrix> matrices(matrixCount);
+ for (int i = 0; i < matrixCount; ++i) {
+ reader->readMatrix(&matrices.push_back());
+ }
BREAK_ON_READ_ERROR(reader);
- canvas->experimental_DrawEdgeAARectV1(rect, aaFlags, color, blend);
+ canvas->experimental_DrawEdgeAAImageSet(set.get(), cnt, dstClips.begin(),
+ matrices.begin(), paint, constraint);
} break;
case DRAW_IMAGE: {
const SkPaint* paint = fPictureData->getPaint(reader);
@@ -331,25 +371,6 @@
canvas->legacy_drawImageRect(image, src, dst, paint, constraint);
} break;
- case DRAW_IMAGE_SET: {
- int cnt = reader->readInt();
- if (!reader->validate(cnt >= 0)) {
- break;
- }
- SkFilterQuality filterQuality = (SkFilterQuality)reader->readUInt();
- SkBlendMode mode = (SkBlendMode)reader->readUInt();
- SkAutoTArray<SkCanvas::ImageSetEntry> set(cnt);
- for (int i = 0; i < cnt; ++i) {
- set[i].fImage = sk_ref_sp(fPictureData->getImage(reader));
- reader->readRect(&set[i].fSrcRect);
- reader->readRect(&set[i].fDstRect);
- set[i].fAlpha = reader->readScalar();
- set[i].fAAFlags = reader->readUInt();
- }
- BREAK_ON_READ_ERROR(reader);
-
- canvas->experimental_DrawImageSetV1(set.get(), cnt, filterQuality, mode);
- } break;
case DRAW_OVAL: {
const SkPaint* paint = fPictureData->getPaint(reader);
SkRect rect;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 01115bf..d8bc36b 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -467,18 +467,6 @@
this->validate(initialOffset, size);
}
-void SkPictureRecord::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa,
- SkColor color, SkBlendMode mode) {
- // op + rect + aa flags + color + mode
- size_t size = 4 * kUInt32Size + sizeof(rect);
- size_t initialOffset = this->addDraw(DRAW_EDGEAA_RECT, &size);
- this->addRect(rect);
- this->addInt((int) aa);
- this->addInt((int) color);
- this->addInt((int) mode);
- this->validate(initialOffset, size);
-}
-
void SkPictureRecord::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
// op + paint index + region
size_t regionBytes = region.writeToMemory(nullptr);
@@ -574,25 +562,6 @@
this->validate(initialOffset, size);
}
-void SkPictureRecord::onDrawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- // op + count + alpha + fq + mode + (image index, src rect, dst rect, alpha, aa flags) * cnt
- size_t size =
- 4 * kUInt32Size + (2 * kUInt32Size + 2 * sizeof(SkRect) + sizeof(SkScalar)) * count;
- size_t initialOffset = this->addDraw(DRAW_IMAGE_SET, &size);
- this->addInt(count);
- this->addInt((int)filterQuality);
- this->addInt((int)mode);
- for (int i = 0; i < count; ++i) {
- this->addImage(set[i].fImage.get());
- this->addRect(set[i].fSrcRect);
- this->addRect(set[i].fDstRect);
- this->addScalar(set[i].fAlpha);
- this->addInt((int)set[i].fAAFlags);
- }
- this->validate(initialOffset, size);
-}
-
void SkPictureRecord::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
@@ -762,6 +731,59 @@
this->validate(initialOffset, size);
}
+void SkPictureRecord::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+
+ // op + rect + aa flags + color + mode + hasClip(as int) + clipCount*points
+ size_t size = 5 * kUInt32Size + sizeof(rect) + (clip ? 4 : 0) * sizeof(SkPoint);
+ size_t initialOffset = this->addDraw(DRAW_EDGEAA_QUAD, &size);
+ this->addRect(rect);
+ this->addInt((int) aa);
+ this->addInt((int) color);
+ this->addInt((int) mode);
+ this->addInt(clip != nullptr);
+ if (clip) {
+ this->addPoints(clip, 4);
+ }
+ this->validate(initialOffset, size);
+}
+
+void SkPictureRecord::onDrawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
+ const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[],
+ const SkPaint* paint,
+ SkCanvas::SrcRectConstraint constraint) {
+ static constexpr size_t kMatrixSize = 9 * sizeof(SkScalar); // *not* sizeof(SkMatrix)
+ // op + count + paint + constraint + (image index, src rect, dst rect, alpha, aa flags,
+ // hasClip(int), matrixIndex) * cnt + totalClipCount + dstClips + totalMatrixCount + matrices
+ int totalDstClipCount, totalMatrixCount;
+ SkCanvasPriv::GetDstClipAndMatrixCounts(set, count, &totalDstClipCount, &totalMatrixCount);
+
+ size_t size = 6 * kUInt32Size + sizeof(SkPoint) * totalDstClipCount +
+ kMatrixSize * totalMatrixCount +
+ (4 * kUInt32Size + 2 * sizeof(SkRect) + sizeof(SkScalar)) * count;
+ size_t initialOffset = this->addDraw(DRAW_EDGEAA_IMAGE_SET, &size);
+ this->addInt(count);
+ this->addPaintPtr(paint);
+ this->addInt((int) constraint);
+ for (int i = 0; i < count; ++i) {
+ this->addImage(set[i].fImage.get());
+ this->addRect(set[i].fSrcRect);
+ this->addRect(set[i].fDstRect);
+ this->addInt(set[i].fMatrixIndex);
+ this->addScalar(set[i].fAlpha);
+ this->addInt((int)set[i].fAAFlags);
+ this->addInt(set[i].fHasClip);
+ }
+ this->addInt(totalDstClipCount);
+ this->addPoints(dstClips, totalDstClipCount);
+ this->addInt(totalMatrixCount);
+ for (int i = 0; i < totalMatrixCount; ++i) {
+ this->addMatrix(preViewMatrices[i]);
+ }
+ this->validate(initialOffset, size);
+}
+
///////////////////////////////////////////////////////////////////////////////
// De-duping helper.
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 77137c4..f355e41 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -176,7 +176,6 @@
void onDrawPaint(const SkPaint&) override;
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
void onDrawRect(const SkRect&, const SkPaint&) override;
- void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) 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;
@@ -189,8 +188,7 @@
const SkPaint*) override;
void onDrawImageLattice(const SkImage*, const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint*) override;
- void onDrawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality,
- SkBlendMode) override;
+
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
SkBlendMode, const SkPaint&) override;
@@ -205,6 +203,11 @@
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
+ void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
+ SkBlendMode) override;
+ void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
+ const SkPaint*, SrcRectConstraint) override;
+
int addPathToHeap(const SkPath& path); // does not write to ops stream
// These entry points allow the writing of matrices, clips, saves &
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 4dcc455..b6a3033 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -115,7 +115,6 @@
DRAW(DrawImageRect, legacy_drawImageRect(r.image.get(), r.src, r.dst, r.paint, r.constraint));
DRAW(DrawImageNine, drawImageNine(r.image.get(), r.center, r.dst, r.paint));
-DRAW(DrawImageSet, experimental_DrawImageSetV1(r.set.get(), r.count, r.quality, r.mode));
DRAW(DrawOval, drawOval(r.oval, r.paint));
DRAW(DrawPaint, drawPaint(r.paint));
DRAW(DrawPath, drawPath(r.path, r.paint));
@@ -124,7 +123,6 @@
DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
DRAW(DrawRect, drawRect(r.rect, r.paint));
-DRAW(DrawEdgeAARect, experimental_DrawEdgeAARectV1(r.rect, r.aa, r.color, r.mode));
DRAW(DrawRegion, drawRegion(r.region, r.paint));
DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint));
DRAW(DrawAtlas, drawAtlas(r.atlas.get(),
@@ -132,6 +130,12 @@
DRAW(DrawVertices, drawVertices(r.vertices, r.bones, r.boneCount, r.bmode, r.paint));
DRAW(DrawShadowRec, private_draw_shadow_rec(r.path, r.rec));
DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value.get()));
+
+DRAW(DrawEdgeAAQuad, experimental_DrawEdgeAAQuad(
+ r.rect, r.clip, r.aa, r.color, r.mode));
+DRAW(DrawEdgeAAImageSet, experimental_DrawEdgeAAImageSet(
+ r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.paint, r.constraint));
+
#undef DRAW
template <> void Draw::draw(const DrawDrawable& r) {
@@ -357,8 +361,6 @@
Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw.
Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }
- Bounds bounds(const DrawEdgeAARect& op) const { return this->adjustAndMap(op.rect, nullptr); }
-
Bounds bounds(const DrawRegion& op) const {
SkRect rect = SkRect::Make(op.region.getBounds());
return this->adjustAndMap(rect, &op.paint);
@@ -387,13 +389,6 @@
Bounds bounds(const DrawImageNine& op) const {
return this->adjustAndMap(op.dst, op.paint);
}
- Bounds bounds(const DrawImageSet& op) const {
- SkRect rect = SkRect::MakeEmpty();
- for (int i = 0; i < op.count; ++i) {
- rect.join(this->adjustAndMap(op.set[i].fDstRect, nullptr));
- }
- return rect;
- }
Bounds bounds(const DrawPath& op) const {
return op.path.isInverseFillType() ? fCullRect
: this->adjustAndMap(op.path.getBounds(), &op.paint);
@@ -452,6 +447,29 @@
Bounds bounds(const DrawAnnotation& op) const {
return this->adjustAndMap(op.rect, nullptr);
}
+ Bounds bounds(const DrawEdgeAAQuad& op) const {
+ SkRect bounds = op.rect;
+ if (op.clip) {
+ bounds.setBounds(op.clip, 4);
+ }
+ return this->adjustAndMap(bounds, nullptr);
+ }
+ Bounds bounds(const DrawEdgeAAImageSet& op) const {
+ SkRect rect = SkRect::MakeEmpty();
+ int clipIndex = 0;
+ for (int i = 0; i < op.count; ++i) {
+ SkRect entryBounds = op.set[i].fDstRect;
+ if (op.set[i].fHasClip) {
+ entryBounds.setBounds(op.dstClips + clipIndex, 4);
+ clipIndex += 4;
+ }
+ if (op.set[i].fMatrixIndex >= 0) {
+ op.preViewMatrices[op.set[i].fMatrixIndex].mapRect(&entryBounds);
+ }
+ rect.join(this->adjustAndMap(entryBounds, nullptr));
+ }
+ return rect;
+ }
// Returns true if rect was meaningfully adjusted for the effects of paint,
// false if the paint could affect the rect in unknown ways.
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index bfe1067..ef43f81 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -151,11 +151,6 @@
this->append<SkRecords::DrawRect>(paint, rect);
}
-void SkRecorder::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- this->append<SkRecords::DrawEdgeAARect>(rect, aa, color, mode);
-}
-
void SkRecorder::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
this->append<SkRecords::DrawRegion>(paint, region);
}
@@ -258,15 +253,6 @@
this->copy(lattice.fColors, flagCount), *lattice.fBounds, dst);
}
-void SkRecorder::onDrawImageSet(const ImageSetEntry set[], int count, SkFilterQuality filterQuality,
- SkBlendMode mode) {
- SkAutoTArray<ImageSetEntry> setCopy(count);
- for (int i = 0; i < count; ++i) {
- setCopy[i] = set[i];
- }
- this->append<SkRecords::DrawImageSet>(std::move(setCopy), count, filterQuality, mode);
-}
-
void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
@@ -324,6 +310,28 @@
this->append<SkRecords::DrawAnnotation>(rect, SkString(key), sk_ref_sp(value));
}
+void SkRecorder::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ this->append<SkRecords::DrawEdgeAAQuad>(
+ rect, this->copy(clip, 4), aa, color, mode);
+}
+
+void SkRecorder::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SrcRectConstraint constraint) {
+ int totalDstClipCount, totalMatrixCount;
+ SkCanvasPriv::GetDstClipAndMatrixCounts(set, count, &totalDstClipCount, &totalMatrixCount);
+
+ SkAutoTArray<ImageSetEntry> setCopy(count);
+ for (int i = 0; i < count; ++i) {
+ setCopy[i] = set[i];
+ }
+
+ this->append<SkRecords::DrawEdgeAAImageSet>(this->copy(paint), std::move(setCopy), count,
+ this->copy(dstClips, totalDstClipCount),
+ this->copy(preViewMatrices, totalMatrixCount), constraint);
+}
+
void SkRecorder::onFlush() {
this->append<SkRecords::Flush>();
}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 6b4c7fe..a1d3a69 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -79,7 +79,6 @@
void onDrawPaint(const SkPaint&) override;
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
void onDrawRect(const SkRect&, const SkPaint&) override;
- void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) 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;
@@ -99,8 +98,6 @@
const SkPaint*) override;
void onDrawBitmapLattice(const SkBitmap&, const Lattice& lattice, const SkRect& dst,
const SkPaint*) override;
- void onDrawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality,
- SkBlendMode) 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[],
@@ -116,6 +113,11 @@
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
+ void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
+ SkBlendMode) override;
+ void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
+ const SkPaint*, SrcRectConstraint) override;
+
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
void flushMiniRecorder();
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index 8f80924..6612a06 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -57,7 +57,6 @@
M(DrawImageLattice) \
M(DrawImageRect) \
M(DrawImageNine) \
- M(DrawImageSet) \
M(DrawDRRect) \
M(DrawOval) \
M(DrawPaint) \
@@ -67,13 +66,15 @@
M(DrawPoints) \
M(DrawRRect) \
M(DrawRect) \
- M(DrawEdgeAARect) \
M(DrawRegion) \
M(DrawTextBlob) \
M(DrawAtlas) \
M(DrawVertices) \
M(DrawShadowRec) \
- M(DrawAnnotation)
+ M(DrawAnnotation) \
+ M(DrawEdgeAAQuad) \
+ M(DrawEdgeAAImageSet)
+
// Defines SkRecords::Type, an enum of all record types.
#define ENUM(T) T##_Type,
@@ -259,11 +260,6 @@
sk_sp<const SkImage> image;
SkIRect center;
SkRect dst);
-RECORD(DrawImageSet, kDraw_Tag|kHasImage_Tag,
- SkAutoTArray<SkCanvas::ImageSetEntry> set;
- int count;
- SkFilterQuality quality;
- SkBlendMode mode);
RECORD(DrawOval, kDraw_Tag|kHasPaint_Tag,
SkPaint paint;
SkRect oval);
@@ -287,11 +283,6 @@
RECORD(DrawRect, kDraw_Tag|kHasPaint_Tag,
SkPaint paint;
SkRect rect);
-RECORD(DrawEdgeAARect, kDraw_Tag,
- SkRect rect;
- SkCanvas::QuadAAFlags aa;
- SkColor color;
- SkBlendMode mode);
RECORD(DrawRegion, kDraw_Tag|kHasPaint_Tag,
SkPaint paint;
SkRegion region);
@@ -328,6 +319,19 @@
SkRect rect;
SkString key;
sk_sp<SkData> value);
+RECORD(DrawEdgeAAQuad, kDraw_Tag,
+ SkRect rect;
+ PODArray<SkPoint> clip;
+ SkCanvas::QuadAAFlags aa;
+ SkColor color;
+ SkBlendMode mode);
+RECORD(DrawEdgeAAImageSet, kDraw_Tag|kHasImage_Tag|kHasPaint_Tag,
+ Optional<SkPaint> paint;
+ SkAutoTArray<SkCanvas::ImageSetEntry> set;
+ int count;
+ PODArray<SkPoint> dstClips;
+ PODArray<SkMatrix> preViewMatrices;
+ SkCanvas::SrcRectConstraint constraint);
#undef RECORD
} // namespace SkRecords
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 0e0efb4..aa40a3d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -397,20 +397,10 @@
this->ctm(), rect, &style);
}
-void SkGpuDevice::drawEdgeAARect(const SkRect& r, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- this->tmp_drawEdgeAAQuad(r, nullptr, 0, aa, color, mode);
-}
-
-void SkGpuDevice::tmp_drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[], int clipCount,
- SkCanvas::QuadAAFlags aaFlags, SkColor color,
- SkBlendMode mode) {
+void SkGpuDevice::drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "tmp_drawEdgeAAQuad", fContext.get());
-
- // Only no clip or a quad clip is currently supported
- SkASSERT(clipCount == 0 || clipCount == 4);
- SkASSERT(clipCount == 0 || clip);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawEdgeAAQuad", fContext.get());
SkPMColor4f dstColor = SkColor4fPrepForDst(SkColor4f::FromColor(color),
fRenderTargetContext->colorSpaceInfo(),
@@ -425,7 +415,7 @@
// This is exclusively meant for tiling operations, so keep AA enabled to handle MSAA seaming
GrQuadAAFlags grAA = SkToGrQuadAAFlags(aaFlags);
- if (clipCount > 0) {
+ if (clip) {
// Use fillQuadWithEdgeAA
fRenderTargetContext->fillQuadWithEdgeAA(this->clip(), std::move(grPaint), GrAA::kYes, grAA,
this->ctm(), clip, nullptr);
@@ -1404,16 +1394,6 @@
this->drawProducerLattice(&maker, std::move(iter), dst, paint);
}
-void SkGpuDevice::drawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- SkPaint paint;
- paint.setBlendMode(mode);
- paint.setFilterQuality(filterQuality);
- paint.setAntiAlias(true);
- this->tmp_drawImageSetV3(set, nullptr, nullptr, count, nullptr, nullptr, paint,
- SkCanvas::kFast_SrcRectConstraint);
-}
-
static bool init_vertices_paint(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo,
const SkPaint& skPaint, const SkMatrix& matrix, SkBlendMode bmode,
bool hasTexs, bool hasColors, GrPaint* grPaint) {
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index b41b8c8..21072a6 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -72,8 +72,6 @@
void drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint[],
const SkPaint& paint) override;
void drawRect(const SkRect& r, const SkPaint& paint) override;
- void drawEdgeAARect(const SkRect& r, SkCanvas::QuadAAFlags edgeAA, SkColor color,
- SkBlendMode mode) override;
void drawRRect(const SkRRect& r, const SkPaint& paint) override;
void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) override;
void drawRegion(const SkRegion& r, const SkPaint& paint) override;
@@ -105,13 +103,17 @@
const SkRect& dst, const SkPaint&) override;
void drawBitmapLattice(const SkBitmap&, const SkCanvas::Lattice&,
const SkRect& dst, const SkPaint&) override;
- void drawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality,
- SkBlendMode) override;
void drawDrawable(SkDrawable*, const SkMatrix*, SkCanvas* canvas) override;
void drawSpecial(SkSpecialImage*, int left, int top, const SkPaint& paint,
SkImage*, const SkMatrix&) override;
+
+ void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ SkCanvas::QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) override;
+ void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[],
+ const SkMatrix[], const SkPaint&, SkCanvas::SrcRectConstraint) override;
+
sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override;
sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
sk_sp<SkSpecialImage> snapSpecial() override;
@@ -126,19 +128,6 @@
bool onAccessPixels(SkPixmap*) override;
- // Temporary interface until it gets lifted up to SkDevice and exposed in SkCanvas
-
- /*
- * dstClipCounts[] is a parallel array to the image entries, acting like the intended
- * dstClipCount field in ImageSetEntry. Similarly, preViewMatrixIdx is parallel and will
- * become an index field in ImageSetEntry that specifies an entry in the matrix array.
- */
- void tmp_drawImageSetV3(const SkCanvas::ImageSetEntry[],
- int dstClipCounts[], int preViewMatrixIdx[], int count,
- const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkPaint& paint,
- SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectConstraint);
- void tmp_drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[], int clipCount,
- SkCanvas::QuadAAFlags aaFlags, SkColor color, SkBlendMode mode);
protected:
bool onReadPixels(const SkPixmap&, int, int) override;
bool onWritePixels(const SkPixmap&, int, int) override;
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 8c280d5..d23097c 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -454,12 +454,9 @@
// Otherwise don't know how to draw it
}
-// For ease-of-use, the temporary API treats null dstClipCounts as if it were the proper sized
-// array, filled with all 0s (so dstClips can be null too)
-void SkGpuDevice::tmp_drawImageSetV3(const SkCanvas::ImageSetEntry set[], int dstClipCounts[],
- int preViewMatrixIdx[], int count, const SkPoint dstClips[],
- const SkMatrix preViewMatrices[], const SkPaint& paint,
- SkCanvas::SrcRectConstraint constraint) {
+void SkGpuDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) {
SkASSERT(count > 0);
if (!can_use_draw_texture(paint)) {
@@ -467,19 +464,16 @@
int dstClipIndex = 0;
for (int i = 0; i < count; ++i) {
// Only no clip or quad clip are supported
- SkASSERT(!dstClipCounts || dstClipCounts[i] == 0 || dstClipCounts[i] == 4);
-
- int xform = preViewMatrixIdx ? preViewMatrixIdx[i] : -1;
- SkASSERT(xform < 0 || preViewMatrices);
+ SkASSERT(!set[i].fHasClip || dstClips);
+ SkASSERT(set[i].fMatrixIndex < 0 || preViewMatrices);
// Always send GrAA::kYes to preserve seaming across tiling in MSAA
this->drawImageQuad(set[i].fImage.get(), &set[i].fSrcRect, &set[i].fDstRect,
- (dstClipCounts && dstClipCounts[i] > 0) ? dstClips + dstClipIndex : nullptr,
+ set[i].fHasClip ? dstClips + dstClipIndex : nullptr,
GrAA::kYes, SkToGrQuadAAFlags(set[i].fAAFlags),
- xform < 0 ? nullptr : preViewMatrices + xform, paint, constraint);
- if (dstClipCounts) {
- dstClipIndex += dstClipCounts[i];
- }
+ set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
+ paint, constraint);
+ dstClipIndex += 4 * set[i].fHasClip;
}
return;
}
@@ -506,12 +500,10 @@
for (int i = 0; i < count; ++i) {
// Manage the dst clip pointer tracking before any continues are used so we don't lose
// our place in the dstClips array.
- int clipCount = (dstClipCounts ? dstClipCounts[i] : 0);
- SkASSERT(clipCount == 0 || (dstClipCounts[i] == 4 && dstClips));
- const SkPoint* clip = clipCount > 0 ? dstClips + dstClipIndex : nullptr;
- if (dstClipCounts) {
- dstClipIndex += dstClipCounts[i];
- }
+ SkASSERT(!set[i].fHasClip || dstClips);
+ const SkPoint* clip = set[i].fHasClip ? dstClips + dstClipIndex : nullptr;
+ dstClipIndex += 4 * set[i].fHasClip;
+
// The default SkBaseDevice implementation is based on drawImageRect which does not allow
// non-sorted src rects. TODO: Decide this is OK or make sure we handle it.
if (!set[i].fSrcRect.isSorted()) {
@@ -544,13 +536,13 @@
}
}
- int xform = preViewMatrixIdx ? preViewMatrixIdx[i] : -1;
- SkASSERT(xform < 0 || preViewMatrices);
+ SkASSERT(set[i].fMatrixIndex < 0 || preViewMatrices);
textures[i].fSrcRect = set[i].fSrcRect;
textures[i].fDstRect = set[i].fDstRect;
textures[i].fDstClipQuad = clip;
- textures[i].fPreViewMatrix = xform < 0 ? nullptr : preViewMatrices + xform;
+ textures[i].fPreViewMatrix =
+ set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex;
textures[i].fAlpha = set[i].fAlpha * paint.getAlphaf();
textures[i].fAAFlags = SkToGrQuadAAFlags(set[i].fAAFlags);
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 1e6cd89..39d5a40 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -162,14 +162,6 @@
}
}
-void SkNWayCanvas::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
- SkBlendMode mode) {
- Iter iter(fList);
- while (iter.next()) {
- iter->experimental_DrawEdgeAARectV1(rect, aa, color, mode);
- }
-}
-
void SkNWayCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
@@ -277,14 +269,6 @@
}
}
-void SkNWayCanvas::onDrawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- Iter iter(fList);
- while (iter.next()) {
- iter->experimental_DrawImageSetV1(set, count, filterQuality, mode);
- }
-}
-
void SkNWayCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint &paint) {
Iter iter(fList);
@@ -348,6 +332,24 @@
}
}
+void SkNWayCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ Iter iter(fList);
+ while (iter.next()) {
+ iter->experimental_DrawEdgeAAQuad(rect, clip, aa, color, mode);
+ }
+}
+
+void SkNWayCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[], const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SrcRectConstraint constraint) {
+ Iter iter(fList);
+ while (iter.next()) {
+ iter->experimental_DrawEdgeAAImageSet(
+ set, count, dstClips, preViewMatrices, paint, constraint);
+ }
+}
+
void SkNWayCanvas::onFlush() {
Iter iter(fList);
while (iter.next()) {
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
index ded7fc2..f09e6c2 100644
--- a/src/utils/SkPaintFilterCanvas.cpp
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -64,17 +64,6 @@
}
}
-void SkPaintFilterCanvas::onDrawEdgeAARect(const SkRect& rect, SkCanvas::QuadAAFlags aa,
- SkColor color, SkBlendMode mode) {
- SkPaint paint;
- paint.setColor(color);
- paint.setBlendMode(mode);
- AutoPaintFilter apf(this, kRect_Type, paint);
- if (apf.shouldDraw()) {
- this->SkNWayCanvas::onDrawEdgeAARect(rect, aa, paint.getColor(), paint.getBlendMode());
- }
-}
-
void SkPaintFilterCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
AutoPaintFilter apf(this, kRRect_Type, paint);
if (apf.shouldDraw()) {
@@ -184,17 +173,6 @@
}
}
-void SkPaintFilterCanvas::onDrawImageSet(const SkCanvas::ImageSetEntry set[], int count,
- SkFilterQuality filterQuality, SkBlendMode mode) {
- SkPaint paint;
- paint.setBlendMode(mode);
- AutoPaintFilter apf(this, kBitmap_Type, &paint);
- mode = paint.getBlendMode();
- if (apf.shouldDraw()) {
- this->SkNWayCanvas::onDrawImageSet(set, count, filterQuality, mode);
- }
-}
-
void SkPaintFilterCanvas::onDrawVerticesObject(const SkVertices* vertices,
const SkVertices::Bone bones[], int boneCount,
SkBlendMode bmode, const SkPaint& paint) {
@@ -256,6 +234,29 @@
this->SkNWayCanvas::onDrawShadowRec(path, rec);
}
+void SkPaintFilterCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
+ QuadAAFlags aa, SkColor color, SkBlendMode mode) {
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setBlendMode(mode);
+ AutoPaintFilter apf(this, kRect_Type, paint);
+ if (apf.shouldDraw()) {
+ this->SkNWayCanvas::onDrawEdgeAAQuad(rect, clip, aa, apf.paint()->getColor(),
+ apf.paint()->getBlendMode());
+ }
+}
+
+void SkPaintFilterCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
+ const SkPoint dstClips[],
+ const SkMatrix preViewMatrices[],
+ const SkPaint* paint, SrcRectConstraint constraint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ if (apf.shouldDraw()) {
+ this->SkNWayCanvas::onDrawEdgeAAImageSet(
+ set, count, dstClips, preViewMatrices, apf.paint(), constraint);
+ }
+}
+
sk_sp<SkSurface> SkPaintFilterCanvas::onNewSurface(const SkImageInfo& info,
const SkSurfaceProps& props) {
return proxy()->makeSurface(info, &props);