Pass sampling to drawImageSet
Bug: skia:7650 Change-Id: I93d41ca6e5beb85e9924ea2f3e0a82c18ff51369 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349617 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
5933d4c8e5
commit
4f509345ab
@ -1939,6 +1939,11 @@ public:
|
|||||||
* image set is drawn as if each image used the applied paint independently, so each is affected
|
* image set is drawn as if each image used the applied paint independently, so each is affected
|
||||||
* by the image, color, and/or mask filter.
|
* by the image, color, and/or mask filter.
|
||||||
*/
|
*/
|
||||||
|
void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt,
|
||||||
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
|
const SkSamplingOptions&, const SkPaint* paint = nullptr,
|
||||||
|
SrcRectConstraint constraint = kStrict_SrcRectConstraint);
|
||||||
|
// DEPRECATED -- pass sampling directly
|
||||||
void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt,
|
void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint = nullptr,
|
const SkPaint* paint = nullptr,
|
||||||
@ -2536,6 +2541,9 @@ protected:
|
|||||||
const SkRect* cull, const SkPaint* paint);
|
const SkRect* cull, const SkPaint* paint);
|
||||||
// never called -- remove from clients' subclasses
|
// never called -- remove from clients' subclasses
|
||||||
virtual void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) {}
|
virtual void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) {}
|
||||||
|
virtual void onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
||||||
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
|
const SkPaint* paint, SrcRectConstraint constraint);
|
||||||
#endif
|
#endif
|
||||||
virtual void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
|
virtual void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
|
||||||
const SkPaint*);
|
const SkPaint*);
|
||||||
@ -2546,6 +2554,10 @@ protected:
|
|||||||
virtual void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect src[],
|
virtual void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect src[],
|
||||||
const SkColor[], int count, SkBlendMode, const SkSamplingOptions&,
|
const SkColor[], int count, SkBlendMode, const SkSamplingOptions&,
|
||||||
const SkRect* cull, const SkPaint*);
|
const SkRect* cull, const SkPaint*);
|
||||||
|
virtual void onDrawEdgeAAImageSet2(const ImageSetEntry imageSet[], int count,
|
||||||
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
|
const SkSamplingOptions&, const SkPaint*,
|
||||||
|
SrcRectConstraint);
|
||||||
|
|
||||||
virtual void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode,
|
virtual void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode,
|
||||||
const SkPaint& paint);
|
const SkPaint& paint);
|
||||||
@ -2559,9 +2571,6 @@ protected:
|
|||||||
|
|
||||||
virtual void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags,
|
virtual void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags,
|
||||||
const SkColor4f& color, SkBlendMode mode);
|
const SkColor4f& color, SkBlendMode mode);
|
||||||
virtual void onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
|
||||||
const SkPaint* paint, SrcRectConstraint constraint);
|
|
||||||
|
|
||||||
enum ClipEdgeStyle {
|
enum ClipEdgeStyle {
|
||||||
kHard_ClipEdgeStyle,
|
kHard_ClipEdgeStyle,
|
||||||
|
@ -45,15 +45,9 @@ protected:
|
|||||||
// implementations in Android's SkCanvas subclasses until this stabilizes.
|
// implementations in Android's SkCanvas subclasses until this stabilizes.
|
||||||
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||||
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override {}
|
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override {}
|
||||||
void onDrawEdgeAAImageSet(const SkCanvas::ImageSetEntry imageSet[], int count,
|
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkPaint* paint,
|
|
||||||
SkCanvas::SrcRectConstraint constraint) override {}
|
|
||||||
#else
|
#else
|
||||||
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||||
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override = 0;
|
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override = 0;
|
||||||
void onDrawEdgeAAImageSet(const SkCanvas::ImageSetEntry imageSet[], int count,
|
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkPaint* paint,
|
|
||||||
SkCanvas::SrcRectConstraint constraint) override = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override = 0;
|
void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override = 0;
|
||||||
|
@ -43,6 +43,8 @@ public:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
|
const SkPaint*, SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -61,8 +63,8 @@ public:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
const SkPaint*, SrcRectConstraint) override;
|
const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawPosTextCommon(const SkGlyphID[], int, const SkScalar[], int, const SkPoint&,
|
void drawPosTextCommon(const SkGlyphID[], int, const SkScalar[], int, const SkPoint&,
|
||||||
|
@ -59,6 +59,8 @@ protected:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
|
const SkPaint*, SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -84,8 +86,8 @@ protected:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
const SkPaint*, SrcRectConstraint) override;
|
const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
|
||||||
|
|
||||||
void onFlush() override;
|
void onFlush() override;
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ protected:
|
|||||||
const SkPaint*) override {}
|
const SkPaint*) override {}
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override {}
|
int, SkBlendMode, const SkRect*, const SkPaint*) override {}
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int, const SkPoint[],
|
||||||
|
const SkMatrix[], const SkPaint*, SrcRectConstraint) override {}
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override {}
|
const SkPaint*) override {}
|
||||||
@ -77,8 +79,9 @@ protected:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override {}
|
SkBlendMode) override {}
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int, const SkPoint[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int, const SkPoint[], const SkMatrix[],
|
||||||
const SkMatrix[], const SkPaint*, SrcRectConstraint) override {}
|
const SkSamplingOptions&, const SkPaint*,
|
||||||
|
SrcRectConstraint) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using INHERITED = SkCanvasVirtualEnforcer<SkCanvas>;
|
using INHERITED = SkCanvasVirtualEnforcer<SkCanvas>;
|
||||||
|
@ -65,6 +65,8 @@ protected:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
|
const SkPaint*, SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -89,8 +91,8 @@ protected:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
const SkPaint*, SrcRectConstraint) override;
|
const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
|
||||||
|
|
||||||
// Forwarded to the wrapped canvas.
|
// Forwarded to the wrapped canvas.
|
||||||
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
|
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
|
||||||
|
@ -2100,8 +2100,25 @@ void SkCanvas::experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], i
|
|||||||
const SkMatrix preViewMatrices[],
|
const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint,
|
const SkPaint* paint,
|
||||||
SrcRectConstraint constraint) {
|
SrcRectConstraint constraint) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_ONDRAWIMAGERECT
|
||||||
TRACE_EVENT0("skia", TRACE_FUNC);
|
TRACE_EVENT0("skia", TRACE_FUNC);
|
||||||
this->onDrawEdgeAAImageSet(imageSet, cnt, dstClips, preViewMatrices, paint, constraint);
|
this->onDrawEdgeAAImageSet(imageSet, cnt, dstClips, preViewMatrices, paint, constraint);
|
||||||
|
#else
|
||||||
|
this->experimental_DrawEdgeAAImageSet(imageSet, cnt, dstClips, preViewMatrices,
|
||||||
|
paint_to_sampling(paint, this->recordingContext()),
|
||||||
|
paint, constraint);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkCanvas::experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt,
|
||||||
|
const SkPoint dstClips[],
|
||||||
|
const SkMatrix preViewMatrices[],
|
||||||
|
const SkSamplingOptions& sampling,
|
||||||
|
const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
|
TRACE_EVENT0("skia", TRACE_FUNC);
|
||||||
|
this->onDrawEdgeAAImageSet2(imageSet, cnt, dstClips, preViewMatrices, sampling, paint,
|
||||||
|
constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2423,6 +2440,49 @@ void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const
|
|||||||
AutoLayerForImageFilter layer(this, realPaint);
|
AutoLayerForImageFilter layer(this, realPaint);
|
||||||
this->topDevice()->drawAtlas(atlas, xform, tex, colors, count, bmode, sampling, layer.paint());
|
this->topDevice()->drawAtlas(atlas, xform, tex, colors, count, bmode, sampling, layer.paint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
||||||
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
|
const SkPaint* paint, SrcRectConstraint constraint) {
|
||||||
|
if (count <= 0) {
|
||||||
|
// Nothing to draw
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkPaint realPaint = clean_paint_for_drawImage(paint);
|
||||||
|
|
||||||
|
// We could calculate the set's dstRect union to always check quickReject(), but we can't reject
|
||||||
|
// individual entries and Chromium's occlusion culling already makes it likely that at least one
|
||||||
|
// entry will be visible. So, we only calculate the draw bounds when it's trivial (count == 1),
|
||||||
|
// or we need it for the autolooper (since it greatly improves image filter perf).
|
||||||
|
bool needsAutoLayer = SkToBool(realPaint.getImageFilter());
|
||||||
|
bool setBoundsValid = count == 1 || needsAutoLayer;
|
||||||
|
SkRect setBounds = imageSet[0].fDstRect;
|
||||||
|
if (imageSet[0].fMatrixIndex >= 0) {
|
||||||
|
// Account for the per-entry transform that is applied prior to the CTM when drawing
|
||||||
|
preViewMatrices[imageSet[0].fMatrixIndex].mapRect(&setBounds);
|
||||||
|
}
|
||||||
|
if (needsAutoLayer) {
|
||||||
|
for (int i = 1; i < count; ++i) {
|
||||||
|
SkRect entryBounds = imageSet[i].fDstRect;
|
||||||
|
if (imageSet[i].fMatrixIndex >= 0) {
|
||||||
|
preViewMatrices[imageSet[i].fMatrixIndex].mapRect(&entryBounds);
|
||||||
|
}
|
||||||
|
setBounds.joinPossiblyEmptyRect(entryBounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we happen to have the draw bounds, though, might as well check quickReject().
|
||||||
|
if (setBoundsValid && this->internalQuickReject(setBounds, realPaint)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoLayerForImageFilter layer(this, realPaint, setBoundsValid ? &setBounds : nullptr);
|
||||||
|
this->topDevice()->drawEdgeAAImageSet(imageSet, count, dstClips, preViewMatrices,
|
||||||
|
SkSamplingOptions(SkPaintPriv::GetFQ(layer.paint())),
|
||||||
|
layer.paint(), constraint);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkCanvas::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
void SkCanvas::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
||||||
@ -2661,9 +2721,10 @@ void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFl
|
|||||||
this->topDevice()->drawEdgeAAQuad(r, clip, edgeAA, color, mode);
|
this->topDevice()->drawEdgeAAQuad(r, clip, edgeAA, color, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
void SkCanvas::onDrawEdgeAAImageSet2(const ImageSetEntry imageSet[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint, SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling, const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
// Nothing to draw
|
// Nothing to draw
|
||||||
return;
|
return;
|
||||||
@ -2698,8 +2759,8 @@ void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoLayerForImageFilter layer(this, realPaint, setBoundsValid ? &setBounds : nullptr);
|
AutoLayerForImageFilter layer(this, realPaint, setBoundsValid ? &setBounds : nullptr);
|
||||||
this->topDevice()->drawEdgeAAImageSet(imageSet, count, dstClips, preViewMatrices,
|
this->topDevice()->drawEdgeAAImageSet(imageSet, count, dstClips, preViewMatrices, sampling,
|
||||||
layer.paint(), constraint);
|
layer.paint(), constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -257,13 +257,11 @@ void SkBaseDevice::drawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], SkCanv
|
|||||||
|
|
||||||
void SkBaseDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry images[], int count,
|
void SkBaseDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry images[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint& paint,
|
const SkSamplingOptions& sampling, const SkPaint& paint,
|
||||||
SkCanvas::SrcRectConstraint constraint) {
|
SkCanvas::SrcRectConstraint constraint) {
|
||||||
SkASSERT(paint.getStyle() == SkPaint::kFill_Style);
|
SkASSERT(paint.getStyle() == SkPaint::kFill_Style);
|
||||||
SkASSERT(!paint.getPathEffect());
|
SkASSERT(!paint.getPathEffect());
|
||||||
|
|
||||||
// TODO: pass this in directly
|
|
||||||
const SkSamplingOptions sampling(paint.getFilterQuality());
|
|
||||||
SkPaint entryPaint = paint;
|
SkPaint entryPaint = paint;
|
||||||
const SkM44 baseLocalToDevice = this->localToDevice44();
|
const SkM44 baseLocalToDevice = this->localToDevice44();
|
||||||
int clipIndex = 0;
|
int clipIndex = 0;
|
||||||
|
@ -298,7 +298,8 @@ protected:
|
|||||||
// are all set. If there's a clip region, it will be applied using clipPath().
|
// are all set. If there's a clip region, it will be applied using clipPath().
|
||||||
virtual void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count,
|
virtual void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint& paint, SkCanvas::SrcRectConstraint);
|
const SkSamplingOptions&, const SkPaint&,
|
||||||
|
SkCanvas::SrcRectConstraint);
|
||||||
|
|
||||||
void drawGlyphRunRSXform(const SkFont&, const SkGlyphID[], const SkRSXform[], int count,
|
void drawGlyphRunRSXform(const SkFont&, const SkGlyphID[], const SkRSXform[], int count,
|
||||||
SkPoint origin, const SkPaint& paint);
|
SkPoint origin, const SkPaint& paint);
|
||||||
|
@ -197,6 +197,28 @@ void SkOverdrawCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xform[]
|
|||||||
|
|
||||||
fList[0]->onDrawAtlas(image, xform, texs, colors, count, mode, cull, paintPtr);
|
fList[0]->onDrawAtlas(image, xform, texs, colors, count, mode, cull, paintPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
fList[0]->onDrawPath(SkPath::Polygon(dstClips + clipIndex, 4, true), fPaint);
|
||||||
|
clipIndex += 4;
|
||||||
|
} else {
|
||||||
|
fList[0]->onDrawRect(set[i].fDstRect, fPaint);
|
||||||
|
}
|
||||||
|
if (set[i].fMatrixIndex >= 0) {
|
||||||
|
fList[0]->restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkOverdrawCanvas::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
void SkOverdrawCanvas::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
||||||
@ -256,10 +278,12 @@ void SkOverdrawCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkOverdrawCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
void SkOverdrawCanvas::onDrawEdgeAAImageSet2(const ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[],
|
const SkPoint dstClips[],
|
||||||
const SkMatrix preViewMatrices[], const SkPaint* paint,
|
const SkMatrix preViewMatrices[],
|
||||||
SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling,
|
||||||
|
const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
int clipIndex = 0;
|
int clipIndex = 0;
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
if (set[i].fMatrixIndex >= 0) {
|
if (set[i].fMatrixIndex >= 0) {
|
||||||
|
@ -112,8 +112,9 @@ enum DrawType {
|
|||||||
DRAW_IMAGE2,
|
DRAW_IMAGE2,
|
||||||
DRAW_IMAGE_RECT2,
|
DRAW_IMAGE_RECT2,
|
||||||
DRAW_IMAGE_LATTICE2,
|
DRAW_IMAGE_LATTICE2,
|
||||||
|
DRAW_EDGEAA_IMAGE_SET2,
|
||||||
|
|
||||||
LAST_DRAWTYPE_ENUM = DRAW_IMAGE_LATTICE2,
|
LAST_DRAWTYPE_ENUM = DRAW_EDGEAA_IMAGE_SET2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DrawVertexFlags {
|
enum DrawVertexFlags {
|
||||||
|
@ -277,7 +277,8 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
|
|||||||
BREAK_ON_READ_ERROR(reader);
|
BREAK_ON_READ_ERROR(reader);
|
||||||
canvas->experimental_DrawEdgeAAQuad(rect, clip, aaFlags, color, blend);
|
canvas->experimental_DrawEdgeAAQuad(rect, clip, aaFlags, color, blend);
|
||||||
} break;
|
} break;
|
||||||
case DRAW_EDGEAA_IMAGE_SET: {
|
case DRAW_EDGEAA_IMAGE_SET:
|
||||||
|
case DRAW_EDGEAA_IMAGE_SET2: {
|
||||||
static const size_t kEntryReadSize =
|
static const size_t kEntryReadSize =
|
||||||
4 * sizeof(uint32_t) + 2 * sizeof(SkRect) + sizeof(SkScalar);
|
4 * sizeof(uint32_t) + 2 * sizeof(SkRect) + sizeof(SkScalar);
|
||||||
static const size_t kMatrixSize = 9 * sizeof(SkScalar); // != sizeof(SkMatrix)
|
static const size_t kMatrixSize = 9 * sizeof(SkScalar); // != sizeof(SkMatrix)
|
||||||
@ -288,6 +289,14 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
|
|||||||
}
|
}
|
||||||
const SkPaint* paint = fPictureData->optionalPaint(reader);
|
const SkPaint* paint = fPictureData->optionalPaint(reader);
|
||||||
|
|
||||||
|
SkSamplingOptions sampling;
|
||||||
|
if (op == DRAW_EDGEAA_IMAGE_SET2) {
|
||||||
|
sampling = reader->readSampling();
|
||||||
|
} else {
|
||||||
|
sampling = SkSamplingOptions(paint ? paint->getFilterQuality()
|
||||||
|
: kNone_SkFilterQuality);
|
||||||
|
}
|
||||||
|
|
||||||
SkCanvas::SrcRectConstraint constraint =
|
SkCanvas::SrcRectConstraint constraint =
|
||||||
reader->checkRange(SkCanvas::kStrict_SrcRectConstraint,
|
reader->checkRange(SkCanvas::kStrict_SrcRectConstraint,
|
||||||
SkCanvas::kFast_SrcRectConstraint);
|
SkCanvas::kFast_SrcRectConstraint);
|
||||||
@ -343,7 +352,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
|
|||||||
BREAK_ON_READ_ERROR(reader);
|
BREAK_ON_READ_ERROR(reader);
|
||||||
|
|
||||||
canvas->experimental_DrawEdgeAAImageSet(set.get(), cnt, dstClips, matrices.begin(),
|
canvas->experimental_DrawEdgeAAImageSet(set.get(), cnt, dstClips, matrices.begin(),
|
||||||
paint, constraint);
|
sampling, paint, constraint);
|
||||||
} break;
|
} break;
|
||||||
case DRAW_IMAGE: {
|
case DRAW_IMAGE: {
|
||||||
const SkPaint* paint = fPictureData->optionalPaint(reader);
|
const SkPaint* paint = fPictureData->optionalPaint(reader);
|
||||||
|
@ -614,6 +614,41 @@ void SkPictureRecord::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[],
|
|||||||
this->validate(initialOffset, size);
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkPictureRecord::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
void SkPictureRecord::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
||||||
@ -850,11 +885,12 @@ void SkPictureRecord::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4]
|
|||||||
this->validate(initialOffset, size);
|
this->validate(initialOffset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkPictureRecord::onDrawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
void SkPictureRecord::onDrawEdgeAAImageSet2(const SkCanvas::ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[],
|
const SkPoint dstClips[],
|
||||||
const SkMatrix preViewMatrices[],
|
const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint,
|
const SkSamplingOptions& sampling,
|
||||||
SkCanvas::SrcRectConstraint constraint) {
|
const SkPaint* paint,
|
||||||
|
SkCanvas::SrcRectConstraint constraint) {
|
||||||
static constexpr size_t kMatrixSize = 9 * sizeof(SkScalar); // *not* sizeof(SkMatrix)
|
static constexpr size_t kMatrixSize = 9 * sizeof(SkScalar); // *not* sizeof(SkMatrix)
|
||||||
// op + count + paint + constraint + (image index, src rect, dst rect, alpha, aa flags,
|
// op + count + paint + constraint + (image index, src rect, dst rect, alpha, aa flags,
|
||||||
// hasClip(int), matrixIndex) * cnt + totalClipCount + dstClips + totalMatrixCount + matrices
|
// hasClip(int), matrixIndex) * cnt + totalClipCount + dstClips + totalMatrixCount + matrices
|
||||||
@ -863,10 +899,12 @@ void SkPictureRecord::onDrawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[],
|
|||||||
|
|
||||||
size_t size = 6 * kUInt32Size + sizeof(SkPoint) * totalDstClipCount +
|
size_t size = 6 * kUInt32Size + sizeof(SkPoint) * totalDstClipCount +
|
||||||
kMatrixSize * totalMatrixCount +
|
kMatrixSize * totalMatrixCount +
|
||||||
(4 * kUInt32Size + 2 * sizeof(SkRect) + sizeof(SkScalar)) * count;
|
(4 * kUInt32Size + 2 * sizeof(SkRect) + sizeof(SkScalar)) * count +
|
||||||
size_t initialOffset = this->addDraw(DRAW_EDGEAA_IMAGE_SET, &size);
|
SkSamplingPriv::kFlatSize;
|
||||||
|
size_t initialOffset = this->addDraw(DRAW_EDGEAA_IMAGE_SET2, &size);
|
||||||
this->addInt(count);
|
this->addInt(count);
|
||||||
this->addPaintPtr(paint);
|
this->addPaintPtr(paint);
|
||||||
|
this->addSampling(sampling);
|
||||||
this->addInt((int) constraint);
|
this->addInt((int) constraint);
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
this->addImage(set[i].fImage.get());
|
this->addImage(set[i].fImage.get());
|
||||||
|
@ -194,6 +194,8 @@ protected:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
|
||||||
SkBlendMode, const SkRect*, const SkPaint*) override;
|
SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
|
const SkPaint*, SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -220,8 +222,8 @@ protected:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
const SkPaint*, SrcRectConstraint) override;
|
const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
|
||||||
|
|
||||||
int addPathToHeap(const SkPath& path); // does not write to ops stream
|
int addPathToHeap(const SkPath& path); // does not write to ops stream
|
||||||
|
|
||||||
|
@ -158,6 +158,8 @@ DRAW(DrawEdgeAAQuad, experimental_DrawEdgeAAQuad(
|
|||||||
r.rect, r.clip, r.aa, r.color, r.mode));
|
r.rect, r.clip, r.aa, r.color, r.mode));
|
||||||
DRAW(DrawEdgeAAImageSet, experimental_DrawEdgeAAImageSet(
|
DRAW(DrawEdgeAAImageSet, experimental_DrawEdgeAAImageSet(
|
||||||
r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.paint, r.constraint));
|
r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.paint, r.constraint));
|
||||||
|
DRAW(DrawEdgeAAImageSet2, experimental_DrawEdgeAAImageSet(
|
||||||
|
r.set.get(), r.count, r.dstClips, r.preViewMatrices, r.sampling, r.paint, r.constraint));
|
||||||
|
|
||||||
#undef DRAW
|
#undef DRAW
|
||||||
|
|
||||||
@ -524,6 +526,22 @@ private:
|
|||||||
}
|
}
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
Bounds bounds(const DrawEdgeAAImageSet2& 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,
|
// Returns true if rect was meaningfully adjusted for the effects of paint,
|
||||||
// false if the paint could affect the rect in unknown ways.
|
// false if the paint could affect the rect in unknown ways.
|
||||||
|
@ -237,6 +237,21 @@ void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], cons
|
|||||||
mode,
|
mode,
|
||||||
this->copy(cull));
|
this->copy(cull));
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkRecorder::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
void SkRecorder::onDrawImage2(const SkImage* image, SkScalar x, SkScalar y,
|
||||||
@ -319,9 +334,10 @@ void SkRecorder::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
|||||||
rect, this->copy(clip, 4), aa, color, mode);
|
rect, this->copy(clip, 4), aa, color, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkRecorder::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
void SkRecorder::onDrawEdgeAAImageSet2(const ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint, SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling, const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
int totalDstClipCount, totalMatrixCount;
|
int totalDstClipCount, totalMatrixCount;
|
||||||
SkCanvasPriv::GetDstClipAndMatrixCounts(set, count, &totalDstClipCount, &totalMatrixCount);
|
SkCanvasPriv::GetDstClipAndMatrixCounts(set, count, &totalDstClipCount, &totalMatrixCount);
|
||||||
|
|
||||||
@ -330,9 +346,9 @@ void SkRecorder::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
|||||||
setCopy[i] = set[i];
|
setCopy[i] = set[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
this->append<SkRecords::DrawEdgeAAImageSet>(this->copy(paint), std::move(setCopy), count,
|
this->append<SkRecords::DrawEdgeAAImageSet2>(this->copy(paint), std::move(setCopy), count,
|
||||||
this->copy(dstClips, totalDstClipCount),
|
this->copy(dstClips, totalDstClipCount),
|
||||||
this->copy(preViewMatrices, totalMatrixCount), constraint);
|
this->copy(preViewMatrices, totalMatrixCount), sampling, constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkRecorder::onFlush() {
|
void SkRecorder::onFlush() {
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
|
const SkPaint*, SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -119,8 +121,9 @@ public:
|
|||||||
|
|
||||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||||
const SkPaint*, SrcRectConstraint) override;
|
const SkSamplingOptions&, const SkPaint*,
|
||||||
|
SrcRectConstraint) override;
|
||||||
|
|
||||||
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
|
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ namespace SkRecords {
|
|||||||
M(DrawShadowRec) \
|
M(DrawShadowRec) \
|
||||||
M(DrawAnnotation) \
|
M(DrawAnnotation) \
|
||||||
M(DrawEdgeAAQuad) \
|
M(DrawEdgeAAQuad) \
|
||||||
M(DrawEdgeAAImageSet)
|
M(DrawEdgeAAImageSet) \
|
||||||
|
M(DrawEdgeAAImageSet2)
|
||||||
|
|
||||||
|
|
||||||
// Defines SkRecords::Type, an enum of all record types.
|
// Defines SkRecords::Type, an enum of all record types.
|
||||||
@ -369,6 +370,14 @@ RECORD(DrawEdgeAAImageSet, kDraw_Tag|kHasImage_Tag|kHasPaint_Tag,
|
|||||||
PODArray<SkPoint> dstClips;
|
PODArray<SkPoint> dstClips;
|
||||||
PODArray<SkMatrix> preViewMatrices;
|
PODArray<SkMatrix> preViewMatrices;
|
||||||
SkCanvas::SrcRectConstraint constraint);
|
SkCanvas::SrcRectConstraint constraint);
|
||||||
|
RECORD(DrawEdgeAAImageSet2, kDraw_Tag|kHasImage_Tag|kHasPaint_Tag,
|
||||||
|
Optional<SkPaint> paint;
|
||||||
|
SkAutoTArray<SkCanvas::ImageSetEntry> set;
|
||||||
|
int count;
|
||||||
|
PODArray<SkPoint> dstClips;
|
||||||
|
PODArray<SkMatrix> preViewMatrices;
|
||||||
|
SkSamplingOptions sampling;
|
||||||
|
SkCanvas::SrcRectConstraint constraint);
|
||||||
#undef RECORD
|
#undef RECORD
|
||||||
|
|
||||||
} // namespace SkRecords
|
} // namespace SkRecords
|
||||||
|
@ -123,7 +123,8 @@ public:
|
|||||||
void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags,
|
void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags,
|
||||||
const SkColor4f& color, SkBlendMode mode) override;
|
const SkColor4f& color, SkBlendMode mode) override;
|
||||||
void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[],
|
void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[],
|
||||||
const SkMatrix[], const SkPaint&, SkCanvas::SrcRectConstraint) override;
|
const SkMatrix[], const SkSamplingOptions&, const SkPaint&,
|
||||||
|
SkCanvas::SrcRectConstraint) override;
|
||||||
|
|
||||||
sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override;
|
sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override;
|
||||||
sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
|
sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
|
||||||
|
@ -808,11 +808,8 @@ void SkGpuDevice::drawImageQuad(const SkImage* image, const SkRect* srcRect, con
|
|||||||
|
|
||||||
void SkGpuDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
void SkGpuDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling, const SkPaint& paint,
|
||||||
// TODO: pass in directly
|
SkCanvas::SrcRectConstraint constraint) {
|
||||||
// pass sampling, or just filter?
|
|
||||||
SkSamplingOptions sampling(SkPaintPriv::GetFQ(paint));
|
|
||||||
|
|
||||||
SkASSERT(count > 0);
|
SkASSERT(count > 0);
|
||||||
if (!can_use_draw_texture(paint, sampling.useCubic, sampling.mipmap)) {
|
if (!can_use_draw_texture(paint, sampling.useCubic, sampling.mipmap)) {
|
||||||
// Send every entry through drawImageQuad() to handle the more complicated paint
|
// Send every entry through drawImageQuad() to handle the more complicated paint
|
||||||
|
@ -273,6 +273,15 @@ void SkNWayCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xform[], co
|
|||||||
iter->drawAtlas(image, xform, tex, colors, count, bmode, cull, paint);
|
iter->drawAtlas(image, xform, tex, colors, count, bmode, cull, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkNWayCanvas::onDrawImage2(const SkImage* image, SkScalar left, SkScalar top,
|
void SkNWayCanvas::onDrawImage2(const SkImage* image, SkScalar left, SkScalar top,
|
||||||
@ -373,13 +382,14 @@ void SkNWayCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkNWayCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
void SkNWayCanvas::onDrawEdgeAAImageSet2(const ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint, SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling, const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
Iter iter(fList);
|
Iter iter(fList);
|
||||||
while (iter.next()) {
|
while (iter.next()) {
|
||||||
iter->experimental_DrawEdgeAAImageSet(
|
iter->experimental_DrawEdgeAAImageSet(
|
||||||
set, count, dstClips, preViewMatrices, paint, constraint);
|
set, count, dstClips, preViewMatrices, sampling, paint, constraint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,16 @@ void SkPaintFilterCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xfor
|
|||||||
this->SkNWayCanvas::onDrawAtlas(image, xform, tex, colors, count, bmode, cull, &apf.paint());
|
this->SkNWayCanvas::onDrawAtlas(image, xform, tex, colors, count, bmode, cull, &apf.paint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void SkPaintFilterCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
||||||
|
const SkPoint dstClips[],
|
||||||
|
const SkMatrix preViewMatrices[],
|
||||||
|
const SkPaint* paint, SrcRectConstraint constraint) {
|
||||||
|
AutoPaintFilter apf(this, paint);
|
||||||
|
if (apf.shouldDraw()) {
|
||||||
|
this->SkNWayCanvas::onDrawEdgeAAImageSet(
|
||||||
|
set, count, dstClips, preViewMatrices, &apf.paint(), constraint);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SkPaintFilterCanvas::onDrawImage2(const SkImage* image, SkScalar left, SkScalar top,
|
void SkPaintFilterCanvas::onDrawImage2(const SkImage* image, SkScalar left, SkScalar top,
|
||||||
@ -265,14 +275,16 @@ void SkPaintFilterCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint cli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkPaintFilterCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count,
|
void SkPaintFilterCanvas::onDrawEdgeAAImageSet2(const ImageSetEntry set[], int count,
|
||||||
const SkPoint dstClips[],
|
const SkPoint dstClips[],
|
||||||
const SkMatrix preViewMatrices[],
|
const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint, SrcRectConstraint constraint) {
|
const SkSamplingOptions& sampling,
|
||||||
|
const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
AutoPaintFilter apf(this, paint);
|
AutoPaintFilter apf(this, paint);
|
||||||
if (apf.shouldDraw()) {
|
if (apf.shouldDraw()) {
|
||||||
this->SkNWayCanvas::onDrawEdgeAAImageSet(
|
this->SkNWayCanvas::onDrawEdgeAAImageSet2(
|
||||||
set, count, dstClips, preViewMatrices, &apf.paint(), constraint);
|
set, count, dstClips, preViewMatrices, sampling, &apf.paint(), constraint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,6 +450,16 @@ void DebugCanvas::onDrawAtlas(const SkImage* image,
|
|||||||
this->addDrawCommand(
|
this->addDrawCommand(
|
||||||
new DrawAtlasCommand(image, xform, tex, colors, count, bmode, cull, paint));
|
new DrawAtlasCommand(image, xform, tex, colors, count, bmode, cull, paint));
|
||||||
}
|
}
|
||||||
|
void DebugCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[],
|
||||||
|
int count,
|
||||||
|
const SkPoint dstClips[],
|
||||||
|
const SkMatrix preViewMatrices[],
|
||||||
|
const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
|
SkSamplingOptions sampling(paint ? paint->getFilterQuality() : kNone_SkFilterQuality);
|
||||||
|
this->addDrawCommand(new DrawEdgeAAImageSetCommand(
|
||||||
|
set, count, dstClips, preViewMatrices, sampling, paint, constraint));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DebugCanvas::onDrawImage2(const SkImage* image,
|
void DebugCanvas::onDrawImage2(const SkImage* image,
|
||||||
@ -607,14 +617,15 @@ void DebugCanvas::onDrawEdgeAAQuad(const SkRect& rect,
|
|||||||
this->addDrawCommand(new DrawEdgeAAQuadCommand(rect, clip, aa, color, mode));
|
this->addDrawCommand(new DrawEdgeAAQuadCommand(rect, clip, aa, color, mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[],
|
void DebugCanvas::onDrawEdgeAAImageSet2(const ImageSetEntry set[],
|
||||||
int count,
|
int count,
|
||||||
const SkPoint dstClips[],
|
const SkPoint dstClips[],
|
||||||
const SkMatrix preViewMatrices[],
|
const SkMatrix preViewMatrices[],
|
||||||
const SkPaint* paint,
|
const SkSamplingOptions& sampling,
|
||||||
SrcRectConstraint constraint) {
|
const SkPaint* paint,
|
||||||
|
SrcRectConstraint constraint) {
|
||||||
this->addDrawCommand(new DrawEdgeAAImageSetCommand(
|
this->addDrawCommand(new DrawEdgeAAImageSetCommand(
|
||||||
set, count, dstClips, preViewMatrices, paint, constraint));
|
set, count, dstClips, preViewMatrices, sampling, paint, constraint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugCanvas::willRestore() {
|
void DebugCanvas::willRestore() {
|
||||||
|
@ -177,6 +177,12 @@ protected:
|
|||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
|
||||||
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
int, SkBlendMode, const SkRect*, const SkPaint*) override;
|
||||||
|
void onDrawEdgeAAImageSet(const ImageSetEntry[],
|
||||||
|
int count,
|
||||||
|
const SkPoint[],
|
||||||
|
const SkMatrix[],
|
||||||
|
const SkPaint*,
|
||||||
|
SrcRectConstraint) override;
|
||||||
#endif
|
#endif
|
||||||
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
|
||||||
const SkPaint*) override;
|
const SkPaint*) override;
|
||||||
@ -202,12 +208,13 @@ protected:
|
|||||||
QuadAAFlags,
|
QuadAAFlags,
|
||||||
const SkColor4f&,
|
const SkColor4f&,
|
||||||
SkBlendMode) override;
|
SkBlendMode) override;
|
||||||
void onDrawEdgeAAImageSet(const ImageSetEntry[],
|
void onDrawEdgeAAImageSet2(const ImageSetEntry[],
|
||||||
int count,
|
int count,
|
||||||
const SkPoint[],
|
const SkPoint[],
|
||||||
const SkMatrix[],
|
const SkMatrix[],
|
||||||
const SkPaint*,
|
const SkSamplingOptions&,
|
||||||
SrcRectConstraint) override;
|
const SkPaint*,
|
||||||
|
SrcRectConstraint) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkTDArray<DrawCommand*> fCommandVector;
|
SkTDArray<DrawCommand*> fCommandVector;
|
||||||
|
@ -1921,11 +1921,13 @@ DrawEdgeAAImageSetCommand::DrawEdgeAAImageSetCommand(const SkCanvas::ImageSetEnt
|
|||||||
int count,
|
int count,
|
||||||
const SkPoint dstClips[],
|
const SkPoint dstClips[],
|
||||||
const SkMatrix preViewMatrices[],
|
const SkMatrix preViewMatrices[],
|
||||||
|
const SkSamplingOptions& sampling,
|
||||||
const SkPaint* paint,
|
const SkPaint* paint,
|
||||||
SkCanvas::SrcRectConstraint constraint)
|
SkCanvas::SrcRectConstraint constraint)
|
||||||
: INHERITED(kDrawEdgeAAImageSet_OpType)
|
: INHERITED(kDrawEdgeAAImageSet_OpType)
|
||||||
, fSet(count)
|
, fSet(count)
|
||||||
, fCount(count)
|
, fCount(count)
|
||||||
|
, fSampling(sampling)
|
||||||
, fPaint(paint)
|
, fPaint(paint)
|
||||||
, fConstraint(constraint) {
|
, fConstraint(constraint) {
|
||||||
int totalDstClipCount, totalMatrixCount;
|
int totalDstClipCount, totalMatrixCount;
|
||||||
@ -1943,6 +1945,7 @@ void DrawEdgeAAImageSetCommand::execute(SkCanvas* canvas) const {
|
|||||||
fCount,
|
fCount,
|
||||||
fDstClips.get(),
|
fDstClips.get(),
|
||||||
fPreViewMatrices.get(),
|
fPreViewMatrices.get(),
|
||||||
|
fSampling,
|
||||||
fPaint.getMaybeNull(),
|
fPaint.getMaybeNull(),
|
||||||
fConstraint);
|
fConstraint);
|
||||||
}
|
}
|
||||||
|
@ -691,6 +691,7 @@ public:
|
|||||||
int count,
|
int count,
|
||||||
const SkPoint[],
|
const SkPoint[],
|
||||||
const SkMatrix[],
|
const SkMatrix[],
|
||||||
|
const SkSamplingOptions&,
|
||||||
const SkPaint*,
|
const SkPaint*,
|
||||||
SkCanvas::SrcRectConstraint);
|
SkCanvas::SrcRectConstraint);
|
||||||
void execute(SkCanvas* canvas) const override;
|
void execute(SkCanvas* canvas) const override;
|
||||||
@ -700,6 +701,7 @@ private:
|
|||||||
int fCount;
|
int fCount;
|
||||||
SkAutoTArray<SkPoint> fDstClips;
|
SkAutoTArray<SkPoint> fDstClips;
|
||||||
SkAutoTArray<SkMatrix> fPreViewMatrices;
|
SkAutoTArray<SkMatrix> fPreViewMatrices;
|
||||||
|
SkSamplingOptions fSampling;
|
||||||
SkTLazy<SkPaint> fPaint;
|
SkTLazy<SkPaint> fPaint;
|
||||||
SkCanvas::SrcRectConstraint fConstraint;
|
SkCanvas::SrcRectConstraint fConstraint;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user