Add Color4f variant for DrawEdgeAAQuad
Bug: chromium:795132,chromium:985500 Change-Id: Idbb4d45b29d2c0d0fd54b05b807086ecf0b8cf26 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237492 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
a5fa56e910
commit
a595f86428
@ -4,8 +4,6 @@ This file includes a list of high level updates for each milestone release.
|
||||
|
||||
-----
|
||||
|
||||
* Remove 4-parameter variant of SkRect::join() and intersect(), and noemptycheck variants of intersect()
|
||||
|
||||
Milestone 78
|
||||
|
||||
* Added RELEASE_NOTES.txt file
|
||||
@ -66,5 +64,13 @@ Milestone 78
|
||||
* SkMallocPixelRef: remove MakeDirect and MakeWithProc from API.
|
||||
https://review.skia.org/234660
|
||||
|
||||
* Remove 4-parameter variant of SkRect::join() and intersect(), and
|
||||
noemptycheck variants of intersect().
|
||||
https://review.skia.org/235832
|
||||
https://review.skia.org/237142
|
||||
|
||||
* Remove unused sk_sp comparison operators.
|
||||
https://review.skia.org/236942
|
||||
|
||||
* Add SkColor4f variant to experimental_DrawEdgeAAQuad for SkiaRenderer.
|
||||
https://review.skia.org/237492
|
||||
|
@ -1859,7 +1859,12 @@ public:
|
||||
* This API only draws solid color, filled rectangles so it does not accept a full SkPaint.
|
||||
*/
|
||||
void experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags,
|
||||
SkColor color, SkBlendMode mode);
|
||||
const SkColor4f& color, SkBlendMode mode);
|
||||
void experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags,
|
||||
SkColor color, SkBlendMode mode) {
|
||||
this->experimental_DrawEdgeAAQuad(rect, clip, aaFlags, SkColor4f::FromColor(color), mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an bulk variant of experimental_DrawEdgeAAQuad() that renders 'cnt' textured quads.
|
||||
* For each entry, 'fDstRect' is rendered with its clip (determined by entry's 'fHasClip' and
|
||||
@ -2478,7 +2483,7 @@ protected:
|
||||
const SkPaint* paint);
|
||||
|
||||
virtual void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags,
|
||||
SkColor 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);
|
||||
|
@ -55,13 +55,13 @@ protected:
|
||||
// This is under active development for Chrome and not used in Android. Hold off on adding
|
||||
// implementations in Android's SkCanvas subclasses until this stabilizes.
|
||||
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aaFlags, SkColor 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
|
||||
void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aaFlags, SkColor 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;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
void onDrawAnnotation(const SkRect&, const char key[], SkData* value) override;
|
||||
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -77,7 +77,7 @@ protected:
|
||||
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
|
||||
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override {}
|
||||
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override {}
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override {}
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int, const SkPoint[],
|
||||
const SkMatrix[], const SkPaint*, SrcRectConstraint) override {}
|
||||
|
@ -89,7 +89,7 @@ protected:
|
||||
void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override;
|
||||
void onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) override;
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -1983,7 +1983,8 @@ void SkCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) {
|
||||
}
|
||||
|
||||
void SkCanvas::experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) {
|
||||
QuadAAFlags aaFlags, const SkColor4f& 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);
|
||||
@ -2684,8 +2685,8 @@ void SkCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* va
|
||||
DRAW_END
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFlags edgeAA,
|
||||
SkColor color, SkBlendMode mode) {
|
||||
void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFlags edgeAA,
|
||||
const SkColor4f& color, SkBlendMode mode) {
|
||||
SkASSERT(r.isSorted());
|
||||
|
||||
// If this used a paint, it would be a filled color with blend mode, which does not
|
||||
|
@ -245,10 +245,10 @@ void SkBaseDevice::drawAtlas(const SkImage* atlas, const SkRSXform xform[],
|
||||
}
|
||||
|
||||
|
||||
void SkBaseDevice::drawEdgeAAQuad(const SkRect& r, const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
void SkBaseDevice::drawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], SkCanvas::QuadAAFlags aa,
|
||||
const SkColor4f& color, SkBlendMode mode) {
|
||||
SkPaint paint;
|
||||
paint.setColor(color);
|
||||
paint.setColor4f(color);
|
||||
paint.setBlendMode(mode);
|
||||
paint.setAntiAlias(aa == SkCanvas::kAll_QuadAAFlags);
|
||||
|
||||
|
@ -227,7 +227,8 @@ protected:
|
||||
// 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);
|
||||
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& 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,
|
||||
|
@ -230,7 +230,7 @@ void SkOverdrawCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec
|
||||
}
|
||||
|
||||
void SkOverdrawCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
QuadAAFlags aa, const SkColor4f& color, SkBlendMode mode) {
|
||||
if (clip) {
|
||||
SkPath path;
|
||||
path.addPoly(clip, 4, true);
|
||||
|
@ -278,7 +278,13 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
|
||||
SkRect rect;
|
||||
reader->readRect(&rect);
|
||||
SkCanvas::QuadAAFlags aaFlags = static_cast<SkCanvas::QuadAAFlags>(reader->read32());
|
||||
SkColor color = reader->read32();
|
||||
SkColor4f color;
|
||||
if (reader->isVersionLT(SkPicturePriv::kEdgeAAQuadColor4f_Version)) {
|
||||
// Old version stored color as 8888
|
||||
color = SkColor4f::FromColor(reader->read32());
|
||||
} else {
|
||||
reader->readColor4f(&color);
|
||||
}
|
||||
SkBlendMode blend = static_cast<SkBlendMode>(reader->read32());
|
||||
bool hasClip = reader->readInt();
|
||||
SkPoint* clip = nullptr;
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
// V70: Image filters definitions hidden, registered names updated to include "Impl"
|
||||
// V71: Unify erode and dilate image filters
|
||||
// V72: SkColorFilter_Matrix domain (rgba vs. hsla)
|
||||
// V73: Use SkColor4f in per-edge AA quad API
|
||||
|
||||
enum Version {
|
||||
kTileModeInBlurImageFilter_Version = 56,
|
||||
@ -92,10 +93,11 @@ public:
|
||||
kHideImageFilterImpls_Version = 70,
|
||||
kUnifyErodeDilateImpls_Version = 71,
|
||||
kMatrixColorFilterDomain_Version = 72,
|
||||
kEdgeAAQuadColor4f_Version = 73,
|
||||
|
||||
// Only SKPs within the min/current picture version range (inclusive) can be read.
|
||||
kMin_Version = kTileModeInBlurImageFilter_Version,
|
||||
kCurrent_Version = kMatrixColorFilterDomain_Version
|
||||
kCurrent_Version = kEdgeAAQuadColor4f_Version
|
||||
};
|
||||
|
||||
static_assert(kMin_Version <= 62, "Remove kFontAxes_bad from SkFontDescriptor.cpp");
|
||||
|
@ -744,14 +744,16 @@ void SkPictureRecord::onDrawAnnotation(const SkRect& rect, const char key[], SkD
|
||||
}
|
||||
|
||||
void SkPictureRecord::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
SkCanvas::QuadAAFlags aa, const SkColor4f& 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 size = 4 * kUInt32Size + sizeof(SkColor4f) + 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);
|
||||
fWriter.write(&color, sizeof(SkColor4f));
|
||||
this->addInt((int) mode);
|
||||
this->addInt(clip != nullptr);
|
||||
if (clip) {
|
||||
|
@ -206,7 +206,7 @@ protected:
|
||||
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
|
||||
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -315,7 +315,7 @@ void SkRecorder::onDrawAnnotation(const SkRect& rect, const char key[], SkData*
|
||||
}
|
||||
|
||||
void SkRecorder::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
QuadAAFlags aa, const SkColor4f& color, SkBlendMode mode) {
|
||||
this->append<SkRecords::DrawEdgeAAQuad>(
|
||||
rect, this->copy(clip, 4), aa, color, mode);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
|
||||
void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
|
||||
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, SkColor,
|
||||
void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -330,7 +330,7 @@ RECORD(DrawEdgeAAQuad, kDraw_Tag,
|
||||
SkRect rect;
|
||||
PODArray<SkPoint> clip;
|
||||
SkCanvas::QuadAAFlags aa;
|
||||
SkColor color;
|
||||
SkColor4f color;
|
||||
SkBlendMode mode);
|
||||
RECORD(DrawEdgeAAImageSet, kDraw_Tag|kHasImage_Tag|kHasPaint_Tag,
|
||||
Optional<SkPaint> paint;
|
||||
|
@ -378,13 +378,13 @@ void SkGpuDevice::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aaFlags, SkColor color, SkBlendMode mode) {
|
||||
SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color,
|
||||
SkBlendMode mode) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawEdgeAAQuad", fContext.get());
|
||||
|
||||
SkPMColor4f dstColor = SkColor4fPrepForDst(SkColor4f::FromColor(color),
|
||||
fRenderTargetContext->colorSpaceInfo())
|
||||
.premul();
|
||||
SkPMColor4f dstColor =
|
||||
SkColor4fPrepForDst(color, fRenderTargetContext->colorSpaceInfo()).premul();
|
||||
|
||||
GrPaint grPaint;
|
||||
grPaint.setColor4f(dstColor);
|
||||
|
@ -111,8 +111,8 @@ public:
|
||||
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 drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags,
|
||||
const SkColor4f& color, SkBlendMode mode) override;
|
||||
void drawEdgeAAImageSet(const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[],
|
||||
const SkMatrix[], const SkPaint&, SkCanvas::SrcRectConstraint) override;
|
||||
|
||||
|
@ -340,7 +340,7 @@ void SkNWayCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData
|
||||
}
|
||||
|
||||
void SkNWayCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
QuadAAFlags aa, const SkColor4f& color, SkBlendMode mode) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->experimental_DrawEdgeAAQuad(rect, clip, aa, color, mode);
|
||||
|
@ -242,13 +242,13 @@ void SkPaintFilterCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadow
|
||||
}
|
||||
|
||||
void SkPaintFilterCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
QuadAAFlags aa, SkColor color, SkBlendMode mode) {
|
||||
QuadAAFlags aa, const SkColor4f& color, SkBlendMode mode) {
|
||||
SkPaint paint;
|
||||
paint.setColor(color);
|
||||
paint.setBlendMode(mode);
|
||||
AutoPaintFilter apf(this, paint);
|
||||
if (apf.shouldDraw()) {
|
||||
this->SkNWayCanvas::onDrawEdgeAAQuad(rect, clip, aa, apf.paint().getColor(),
|
||||
this->SkNWayCanvas::onDrawEdgeAAQuad(rect, clip, aa, apf.paint().getColor4f(),
|
||||
apf.paint().getBlendMode());
|
||||
}
|
||||
}
|
||||
|
@ -473,11 +473,11 @@ void DebugCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
|
||||
this->addDrawCommand(new DrawDrawableCommand(drawable, matrix));
|
||||
}
|
||||
|
||||
void DebugCanvas::onDrawEdgeAAQuad(const SkRect& rect,
|
||||
const SkPoint clip[4],
|
||||
QuadAAFlags aa,
|
||||
SkColor color,
|
||||
SkBlendMode mode) {
|
||||
void DebugCanvas::onDrawEdgeAAQuad(const SkRect& rect,
|
||||
const SkPoint clip[4],
|
||||
QuadAAFlags aa,
|
||||
const SkColor4f& color,
|
||||
SkBlendMode mode) {
|
||||
this->addDrawCommand(new DrawEdgeAAQuadCommand(rect, clip, aa, color, mode));
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ protected:
|
||||
void onDrawEdgeAAQuad(const SkRect&,
|
||||
const SkPoint[4],
|
||||
QuadAAFlags,
|
||||
SkColor,
|
||||
const SkColor4f&,
|
||||
SkBlendMode) override;
|
||||
void onDrawEdgeAAImageSet(const ImageSetEntry[],
|
||||
int count,
|
||||
|
@ -1967,7 +1967,7 @@ void DrawShadowCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataMana
|
||||
DrawEdgeAAQuadCommand::DrawEdgeAAQuadCommand(const SkRect& rect,
|
||||
const SkPoint clip[],
|
||||
SkCanvas::QuadAAFlags aa,
|
||||
SkColor color,
|
||||
const SkColor4f& color,
|
||||
SkBlendMode mode)
|
||||
: INHERITED(kDrawEdgeAAQuad_OpType)
|
||||
, fRect(rect)
|
||||
|
@ -690,7 +690,7 @@ public:
|
||||
DrawEdgeAAQuadCommand(const SkRect& rect,
|
||||
const SkPoint clip[4],
|
||||
SkCanvas::QuadAAFlags aa,
|
||||
SkColor color,
|
||||
const SkColor4f& color,
|
||||
SkBlendMode mode);
|
||||
void execute(SkCanvas* canvas) const override;
|
||||
|
||||
@ -699,7 +699,7 @@ private:
|
||||
SkPoint fClip[4];
|
||||
int fHasClip;
|
||||
SkCanvas::QuadAAFlags fAA;
|
||||
SkColor fColor;
|
||||
SkColor4f fColor;
|
||||
SkBlendMode fMode;
|
||||
|
||||
typedef DrawCommand INHERITED;
|
||||
|
Loading…
Reference in New Issue
Block a user