Remove GrAA parameter from drawing functions that support per-edge AA
Bug: skia:13114 Change-Id: I653ab746927abdd1491e070e2e27252bf056d233 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526024 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
e679a08f9a
commit
027b9c0d38
@ -151,7 +151,7 @@ protected:
|
|||||||
SkMatrixProvider matrixProvider(view);
|
SkMatrixProvider matrixProvider(view);
|
||||||
GrPaint grPaint;
|
GrPaint grPaint;
|
||||||
SkPaintToGrPaint(context, sdc->colorInfo(), paint, matrixProvider, &grPaint);
|
SkPaintToGrPaint(context, sdc->colorInfo(), paint, matrixProvider, &grPaint);
|
||||||
sdc->drawQuadSet(nullptr, std::move(grPaint), GrAA::kYes, view, batch, kRectCount);
|
sdc->drawQuadSet(nullptr, std::move(grPaint), view, batch, kRectCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawSolidColorsRef(SkCanvas* canvas) const {
|
void drawSolidColorsRef(SkCanvas* canvas) const {
|
||||||
|
@ -287,7 +287,6 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
|
|||||||
SK_PMColor4fWHITE,
|
SK_PMColor4fWHITE,
|
||||||
{0, 0, 100, 200},
|
{0, 0, 100, 200},
|
||||||
{100, 0, 200, 200},
|
{100, 0, 200, 200},
|
||||||
GrAA::kNo,
|
|
||||||
GrQuadAAFlags::kNone,
|
GrQuadAAFlags::kNone,
|
||||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
|
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
|
||||||
SkMatrix::I(),
|
SkMatrix::I(),
|
||||||
@ -311,7 +310,6 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
|
|||||||
SK_PMColor4fWHITE,
|
SK_PMColor4fWHITE,
|
||||||
{0, 0, 100, 200},
|
{0, 0, 100, 200},
|
||||||
{200, 0, 300, 200},
|
{200, 0, 300, 200},
|
||||||
GrAA::kNo,
|
|
||||||
GrQuadAAFlags::kNone,
|
GrQuadAAFlags::kNone,
|
||||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
|
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
|
||||||
SkMatrix::I(),
|
SkMatrix::I(),
|
||||||
|
@ -87,7 +87,7 @@ static void draw_gradient_tiles(SkCanvas* canvas, bool alignGradients) {
|
|||||||
SkMatrixProvider matrixProvider(view);
|
SkMatrixProvider matrixProvider(view);
|
||||||
GrPaint grPaint;
|
GrPaint grPaint;
|
||||||
SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, &grPaint);
|
SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, &grPaint);
|
||||||
sdc->fillRectWithEdgeAA(nullptr, std::move(grPaint), GrAA::kYes,
|
sdc->fillRectWithEdgeAA(nullptr, std::move(grPaint),
|
||||||
static_cast<GrQuadAAFlags>(aa), view, tile);
|
static_cast<GrQuadAAFlags>(aa), view, tile);
|
||||||
} else {
|
} else {
|
||||||
// Fallback to solid color on raster backend since the public API only has color
|
// Fallback to solid color on raster backend since the public API only has color
|
||||||
|
@ -257,18 +257,13 @@ enum class GrClampType {
|
|||||||
/**
|
/**
|
||||||
* A number of rectangle/quadrilateral drawing APIs can control anti-aliasing on a per edge basis.
|
* A number of rectangle/quadrilateral drawing APIs can control anti-aliasing on a per edge basis.
|
||||||
* These masks specify which edges are AA'ed. The intent for this is to support tiling with seamless
|
* These masks specify which edges are AA'ed. The intent for this is to support tiling with seamless
|
||||||
* boundaries, where the inner edges are non-AA and the outer edges are AA. Regular draws (where AA
|
* boundaries, where the inner edges are non-AA and the outer edges are AA. Regular rectangle draws
|
||||||
* is specified by GrAA) is almost equivalent to kNone or kAll, with the exception of how MSAA is
|
* simply use kAll or kNone depending on if they want anti-aliasing or not.
|
||||||
* handled.
|
|
||||||
*
|
*
|
||||||
* When tiling and there is MSAA, mixed edge rectangles are processed with MSAA, so in order for the
|
* In APIs that support per-edge AA, GrQuadAAFlags is the only AA-control parameter that is
|
||||||
* tiled edges to remain seamless, inner tiles with kNone must also be processed with MSAA. In
|
* provided (compared to the typical GrAA parameter). kNone is equivalent to GrAA::kNo, and any
|
||||||
* regular drawing, however, kNone should disable MSAA (if it's supported) to match the expected
|
* other set of edge flags would require GrAA::kYes (with rendering output dependent on how that
|
||||||
* appearance.
|
* maps to GrAAType for a given SurfaceDrawContext).
|
||||||
*
|
|
||||||
* Therefore, APIs that use per-edge AA flags also take a GrAA value so that they can differentiate
|
|
||||||
* between the regular and tiling use case behaviors. Tiling operations should always pass
|
|
||||||
* GrAA::kYes while regular options should pass GrAA based on the SkPaint's anti-alias state.
|
|
||||||
*
|
*
|
||||||
* These values are identical to SkCanvas::QuadAAFlags.
|
* These values are identical to SkCanvas::QuadAAFlags.
|
||||||
*/
|
*/
|
||||||
|
@ -646,7 +646,6 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
|
|||||||
SK_PMColor4fWHITE,
|
SK_PMColor4fWHITE,
|
||||||
SkRect::Make(srcRect),
|
SkRect::Make(srcRect),
|
||||||
SkRect::Make(dstRect),
|
SkRect::Make(dstRect),
|
||||||
GrAA::kNo,
|
|
||||||
GrQuadAAFlags::kNone,
|
GrQuadAAFlags::kNone,
|
||||||
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint,
|
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint,
|
||||||
SkMatrix::I(),
|
SkMatrix::I(),
|
||||||
|
@ -481,16 +481,21 @@ void Device::drawEdgeAAQuad(const SkRect& rect,
|
|||||||
grPaint.setXPFactory(SkBlendMode_AsXPFactory(mode));
|
grPaint.setXPFactory(SkBlendMode_AsXPFactory(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is exclusively meant for tiling operations, so keep AA enabled to handle MSAA seaming
|
|
||||||
GrQuadAAFlags grAA = SkToGrQuadAAFlags(aaFlags);
|
|
||||||
if (clip) {
|
if (clip) {
|
||||||
// Use fillQuadWithEdgeAA
|
// Use fillQuadWithEdgeAA
|
||||||
fSurfaceDrawContext->fillQuadWithEdgeAA(this->clip(), std::move(grPaint), GrAA::kYes, grAA,
|
fSurfaceDrawContext->fillQuadWithEdgeAA(this->clip(),
|
||||||
this->localToDevice(), clip, nullptr);
|
std::move(grPaint),
|
||||||
|
SkToGrQuadAAFlags(aaFlags),
|
||||||
|
this->localToDevice(),
|
||||||
|
clip,
|
||||||
|
nullptr);
|
||||||
} else {
|
} else {
|
||||||
// Use fillRectWithEdgeAA to preserve mathematical properties of dst being rectangular
|
// Use fillRectWithEdgeAA to preserve mathematical properties of dst being rectangular
|
||||||
fSurfaceDrawContext->fillRectWithEdgeAA(this->clip(), std::move(grPaint), GrAA::kYes, grAA,
|
fSurfaceDrawContext->fillRectWithEdgeAA(this->clip(),
|
||||||
this->localToDevice(), rect);
|
std::move(grPaint),
|
||||||
|
SkToGrQuadAAFlags(aaFlags),
|
||||||
|
this->localToDevice(),
|
||||||
|
rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,8 +790,7 @@ void Device::drawImageRect(const SkImage* image,
|
|||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
GrAA aa = fSurfaceDrawContext->chooseAA(paint);
|
GrAA aa = fSurfaceDrawContext->chooseAA(paint);
|
||||||
GrQuadAAFlags aaFlags = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
GrQuadAAFlags aaFlags = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||||
this->drawImageQuad(image, src, &dst, nullptr, aa, aaFlags, nullptr, sampling, paint,
|
this->drawImageQuad(image, src, &dst, nullptr, aaFlags, nullptr, sampling, paint, constraint);
|
||||||
constraint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::drawViewLattice(GrSurfaceProxyView view,
|
void Device::drawViewLattice(GrSurfaceProxyView view,
|
||||||
|
@ -349,7 +349,6 @@ void draw_texture(skgpu::v1::SurfaceDrawContext* sdc,
|
|||||||
const SkRect& srcRect,
|
const SkRect& srcRect,
|
||||||
const SkRect& dstRect,
|
const SkRect& dstRect,
|
||||||
const SkPoint dstClip[4],
|
const SkPoint dstClip[4],
|
||||||
GrAA aa,
|
|
||||||
GrQuadAAFlags aaFlags,
|
GrQuadAAFlags aaFlags,
|
||||||
SkCanvas::SrcRectConstraint constraint,
|
SkCanvas::SrcRectConstraint constraint,
|
||||||
GrSurfaceProxyView view,
|
GrSurfaceProxyView view,
|
||||||
@ -365,7 +364,7 @@ void draw_texture(skgpu::v1::SurfaceDrawContext* sdc,
|
|||||||
if (constraint != SkCanvas::kStrict_SrcRectConstraint && !proxy->isFunctionallyExact()) {
|
if (constraint != SkCanvas::kStrict_SrcRectConstraint && !proxy->isFunctionallyExact()) {
|
||||||
// Conservative estimate of how much a coord could be outset from src rect:
|
// Conservative estimate of how much a coord could be outset from src rect:
|
||||||
// 1/2 pixel for AA and 1/2 pixel for linear filtering
|
// 1/2 pixel for AA and 1/2 pixel for linear filtering
|
||||||
float buffer = 0.5f * (aa == GrAA::kYes) +
|
float buffer = 0.5f * (aaFlags != GrQuadAAFlags::kNone) +
|
||||||
0.5f * (filter == GrSamplerState::Filter::kLinear);
|
0.5f * (filter == GrSamplerState::Filter::kLinear);
|
||||||
SkRect safeBounds = proxy->getBoundsRect();
|
SkRect safeBounds = proxy->getBoundsRect();
|
||||||
safeBounds.inset(buffer, buffer);
|
safeBounds.inset(buffer, buffer);
|
||||||
@ -390,7 +389,6 @@ void draw_texture(skgpu::v1::SurfaceDrawContext* sdc,
|
|||||||
color,
|
color,
|
||||||
srcQuad,
|
srcQuad,
|
||||||
dstClip,
|
dstClip,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
constraint == SkCanvas::kStrict_SrcRectConstraint ? &srcRect : nullptr,
|
constraint == SkCanvas::kStrict_SrcRectConstraint ? &srcRect : nullptr,
|
||||||
ctm,
|
ctm,
|
||||||
@ -405,7 +403,6 @@ void draw_texture(skgpu::v1::SurfaceDrawContext* sdc,
|
|||||||
color,
|
color,
|
||||||
srcRect,
|
srcRect,
|
||||||
dstRect,
|
dstRect,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
constraint,
|
constraint,
|
||||||
ctm,
|
ctm,
|
||||||
@ -424,7 +421,6 @@ void draw_image(GrRecordingContext* rContext,
|
|||||||
const SkRect& dst,
|
const SkRect& dst,
|
||||||
const SkPoint dstClip[4],
|
const SkPoint dstClip[4],
|
||||||
const SkMatrix& srcToDst,
|
const SkMatrix& srcToDst,
|
||||||
GrAA aa,
|
|
||||||
GrQuadAAFlags aaFlags,
|
GrQuadAAFlags aaFlags,
|
||||||
SkCanvas::SrcRectConstraint constraint,
|
SkCanvas::SrcRectConstraint constraint,
|
||||||
SkSamplingOptions sampling,
|
SkSamplingOptions sampling,
|
||||||
@ -449,7 +445,6 @@ void draw_image(GrRecordingContext* rContext,
|
|||||||
src,
|
src,
|
||||||
dst,
|
dst,
|
||||||
dstClip,
|
dstClip,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
constraint,
|
constraint,
|
||||||
std::move(view),
|
std::move(view),
|
||||||
@ -545,10 +540,10 @@ void draw_image(GrRecordingContext* rContext,
|
|||||||
GrMapRectPoints(dst, src, dstClip, srcClipPoints, 4);
|
GrMapRectPoints(dst, src, dstClip, srcClipPoints, 4);
|
||||||
srcClip = srcClipPoints;
|
srcClip = srcClipPoints;
|
||||||
}
|
}
|
||||||
sdc->fillQuadWithEdgeAA(clip, std::move(grPaint), aa, aaFlags, ctm, dstClip, srcClip);
|
sdc->fillQuadWithEdgeAA(clip, std::move(grPaint), aaFlags, ctm, dstClip, srcClip);
|
||||||
} else {
|
} else {
|
||||||
// Provide explicit texture coords when possible, otherwise rely on texture matrix
|
// Provide explicit texture coords when possible, otherwise rely on texture matrix
|
||||||
sdc->fillRectWithEdgeAA(clip, std::move(grPaint), aa, aaFlags, ctm, dst,
|
sdc->fillRectWithEdgeAA(clip, std::move(grPaint), aaFlags, ctm, dst,
|
||||||
canUseTextureCoordsAsLocalCoords ? &src : nullptr);
|
canUseTextureCoordsAsLocalCoords ? &src : nullptr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -580,7 +575,7 @@ void draw_tiled_bitmap(GrRecordingContext* rContext,
|
|||||||
const SkRect& srcRect,
|
const SkRect& srcRect,
|
||||||
const SkIRect& clippedSrcIRect,
|
const SkIRect& clippedSrcIRect,
|
||||||
const SkPaint& paint,
|
const SkPaint& paint,
|
||||||
GrAA aa,
|
GrQuadAAFlags origAAFlags,
|
||||||
SkCanvas::SrcRectConstraint constraint,
|
SkCanvas::SrcRectConstraint constraint,
|
||||||
SkSamplingOptions sampling,
|
SkSamplingOptions sampling,
|
||||||
SkTileMode tileMode) {
|
SkTileMode tileMode) {
|
||||||
@ -636,20 +631,18 @@ void draw_tiled_bitmap(GrRecordingContext* rContext,
|
|||||||
image->height() <= rContext->priv().caps()->maxTextureSize());
|
image->height() <= rContext->priv().caps()->maxTextureSize());
|
||||||
|
|
||||||
GrQuadAAFlags aaFlags = GrQuadAAFlags::kNone;
|
GrQuadAAFlags aaFlags = GrQuadAAFlags::kNone;
|
||||||
if (aa == GrAA::kYes) {
|
// Preserve the original edge AA flags for the exterior tile edges.
|
||||||
// If the entire bitmap was anti-aliased, turn on AA for the outside tile edges.
|
if (tileR.fLeft <= srcRect.fLeft && (origAAFlags & GrQuadAAFlags::kLeft)) {
|
||||||
if (tileR.fLeft <= srcRect.fLeft) {
|
aaFlags |= GrQuadAAFlags::kLeft;
|
||||||
aaFlags |= GrQuadAAFlags::kLeft;
|
}
|
||||||
}
|
if (tileR.fRight >= srcRect.fRight && (origAAFlags & GrQuadAAFlags::kRight)) {
|
||||||
if (tileR.fRight >= srcRect.fRight) {
|
aaFlags |= GrQuadAAFlags::kRight;
|
||||||
aaFlags |= GrQuadAAFlags::kRight;
|
}
|
||||||
}
|
if (tileR.fTop <= srcRect.fTop && (origAAFlags & GrQuadAAFlags::kTop)) {
|
||||||
if (tileR.fTop <= srcRect.fTop) {
|
aaFlags |= GrQuadAAFlags::kTop;
|
||||||
aaFlags |= GrQuadAAFlags::kTop;
|
}
|
||||||
}
|
if (tileR.fBottom >= srcRect.fBottom && (origAAFlags & GrQuadAAFlags::kBottom)) {
|
||||||
if (tileR.fBottom >= srcRect.fBottom) {
|
aaFlags |= GrQuadAAFlags::kBottom;
|
||||||
aaFlags |= GrQuadAAFlags::kBottom;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now offset it to make it "local" to our tmp bitmap
|
// now offset it to make it "local" to our tmp bitmap
|
||||||
@ -666,7 +659,6 @@ void draw_tiled_bitmap(GrRecordingContext* rContext,
|
|||||||
rectToDraw,
|
rectToDraw,
|
||||||
nullptr,
|
nullptr,
|
||||||
offsetSrcToDst,
|
offsetSrcToDst,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
constraint,
|
constraint,
|
||||||
sampling,
|
sampling,
|
||||||
@ -746,7 +738,6 @@ void Device::drawSpecial(SkSpecialImage* special,
|
|||||||
dst,
|
dst,
|
||||||
nullptr,
|
nullptr,
|
||||||
srcToDst,
|
srcToDst,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
SkCanvas::kStrict_SrcRectConstraint,
|
SkCanvas::kStrict_SrcRectConstraint,
|
||||||
sampling);
|
sampling);
|
||||||
@ -756,7 +747,6 @@ void Device::drawImageQuad(const SkImage* image,
|
|||||||
const SkRect* srcRect,
|
const SkRect* srcRect,
|
||||||
const SkRect* dstRect,
|
const SkRect* dstRect,
|
||||||
const SkPoint dstClip[4],
|
const SkPoint dstClip[4],
|
||||||
GrAA aa,
|
|
||||||
GrQuadAAFlags aaFlags,
|
GrQuadAAFlags aaFlags,
|
||||||
const SkMatrix* preViewMatrix,
|
const SkMatrix* preViewMatrix,
|
||||||
const SkSamplingOptions& origSampling,
|
const SkSamplingOptions& origSampling,
|
||||||
@ -826,7 +816,7 @@ void Device::drawImageQuad(const SkImage* image,
|
|||||||
src,
|
src,
|
||||||
clippedSubset,
|
clippedSubset,
|
||||||
paint,
|
paint,
|
||||||
aa,
|
aaFlags,
|
||||||
constraint,
|
constraint,
|
||||||
sampling,
|
sampling,
|
||||||
tileMode);
|
tileMode);
|
||||||
@ -845,7 +835,6 @@ void Device::drawImageQuad(const SkImage* image,
|
|||||||
dst,
|
dst,
|
||||||
dstClip,
|
dstClip,
|
||||||
srcToDst,
|
srcToDst,
|
||||||
aa,
|
|
||||||
aaFlags,
|
aaFlags,
|
||||||
constraint,
|
constraint,
|
||||||
sampling);
|
sampling);
|
||||||
@ -870,10 +859,9 @@ void Device::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
|||||||
auto paintAlpha = paint.getAlphaf();
|
auto paintAlpha = paint.getAlphaf();
|
||||||
entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha);
|
entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha);
|
||||||
}
|
}
|
||||||
// Always send GrAA::kYes to preserve seaming across tiling in MSAA
|
|
||||||
this->drawImageQuad(
|
this->drawImageQuad(
|
||||||
set[i].fImage.get(), &set[i].fSrcRect, &set[i].fDstRect,
|
set[i].fImage.get(), &set[i].fSrcRect, &set[i].fDstRect,
|
||||||
set[i].fHasClip ? dstClips + dstClipIndex : nullptr, GrAA::kYes,
|
set[i].fHasClip ? dstClips + dstClipIndex : nullptr,
|
||||||
SkToGrQuadAAFlags(set[i].fAAFlags),
|
SkToGrQuadAAFlags(set[i].fAAFlags),
|
||||||
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
|
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
|
||||||
sampling, *entryPaint, constraint);
|
sampling, *entryPaint, constraint);
|
||||||
@ -903,7 +891,6 @@ void Device::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
|||||||
filter,
|
filter,
|
||||||
GrSamplerState::MipmapMode::kNone,
|
GrSamplerState::MipmapMode::kNone,
|
||||||
mode,
|
mode,
|
||||||
GrAA::kYes,
|
|
||||||
constraint,
|
constraint,
|
||||||
this->localToDevice(),
|
this->localToDevice(),
|
||||||
std::move(textureXform));
|
std::move(textureXform));
|
||||||
@ -952,7 +939,7 @@ void Device::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
|
|||||||
entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha);
|
entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha);
|
||||||
}
|
}
|
||||||
this->drawImageQuad(
|
this->drawImageQuad(
|
||||||
image, &set[i].fSrcRect, &set[i].fDstRect, clip, GrAA::kYes,
|
image, &set[i].fSrcRect, &set[i].fDstRect, clip,
|
||||||
SkToGrQuadAAFlags(set[i].fAAFlags),
|
SkToGrQuadAAFlags(set[i].fAAFlags),
|
||||||
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
|
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
|
||||||
sampling, *entryPaint, constraint);
|
sampling, *entryPaint, constraint);
|
||||||
|
@ -235,7 +235,7 @@ private:
|
|||||||
// If not null, dstClip must be contained inside dst and will also respect the edge AA flags.
|
// If not null, dstClip must be contained inside dst and will also respect the edge AA flags.
|
||||||
// If 'preViewMatrix' is not null, final CTM will be this->ctm() * preViewMatrix.
|
// If 'preViewMatrix' is not null, final CTM will be this->ctm() * preViewMatrix.
|
||||||
void drawImageQuad(const SkImage*, const SkRect* src, const SkRect* dst,
|
void drawImageQuad(const SkImage*, const SkRect* src, const SkRect* dst,
|
||||||
const SkPoint dstClip[4], GrAA aa, GrQuadAAFlags aaFlags,
|
const SkPoint dstClip[4], GrQuadAAFlags aaFlags,
|
||||||
const SkMatrix* preViewMatrix, const SkSamplingOptions&,
|
const SkMatrix* preViewMatrix, const SkSamplingOptions&,
|
||||||
const SkPaint&, SkCanvas::SrcRectConstraint);
|
const SkPaint&, SkCanvas::SrcRectConstraint);
|
||||||
|
|
||||||
|
@ -416,7 +416,9 @@ enum class SurfaceDrawContext::QuadOptimization {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization(
|
SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization(
|
||||||
const GrClip* clip, const GrUserStencilSettings* stencilSettings, GrAA* aa, DrawQuad* quad,
|
const GrClip* clip,
|
||||||
|
const GrUserStencilSettings* stencilSettings,
|
||||||
|
DrawQuad* quad,
|
||||||
GrPaint* paint) {
|
GrPaint* paint) {
|
||||||
// Optimization requirements:
|
// Optimization requirements:
|
||||||
// 1. kDiscard applies when clip bounds and quad bounds do not intersect
|
// 1. kDiscard applies when clip bounds and quad bounds do not intersect
|
||||||
@ -454,17 +456,18 @@ SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization
|
|||||||
return QuadOptimization::kCropped;
|
return QuadOptimization::kCropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GrAA drawUsesAA{quad->fEdgeFlags != GrQuadAAFlags::kNone};
|
||||||
auto conservativeCrop = [&]() {
|
auto conservativeCrop = [&]() {
|
||||||
static constexpr int kLargeDrawLimit = 15000;
|
static constexpr int kLargeDrawLimit = 15000;
|
||||||
// Crop the quad to the render target. This doesn't change the visual results of drawing but
|
// Crop the quad to the render target. This doesn't change the visual results of drawing but
|
||||||
// is meant to help numerical stability for excessively large draws.
|
// is meant to help numerical stability for excessively large draws.
|
||||||
if (drawBounds.width() > kLargeDrawLimit || drawBounds.height() > kLargeDrawLimit) {
|
if (drawBounds.width() > kLargeDrawLimit || drawBounds.height() > kLargeDrawLimit) {
|
||||||
GrQuadUtils::CropToRect(rtRect, *aa, quad, /* compute local */ !constColor);
|
GrQuadUtils::CropToRect(rtRect, drawUsesAA, quad, /* compute local */ !constColor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool simpleColor = !stencilSettings && constColor;
|
bool simpleColor = !stencilSettings && constColor;
|
||||||
GrClip::PreClipResult result = clip ? clip->preApply(drawBounds, *aa)
|
GrClip::PreClipResult result = clip ? clip->preApply(drawBounds, drawUsesAA)
|
||||||
: GrClip::PreClipResult(GrClip::Effect::kUnclipped);
|
: GrClip::PreClipResult(GrClip::Effect::kUnclipped);
|
||||||
switch(result.fEffect) {
|
switch(result.fEffect) {
|
||||||
case GrClip::Effect::kClippedOut:
|
case GrClip::Effect::kClippedOut:
|
||||||
@ -479,13 +482,11 @@ SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization
|
|||||||
// that any geometric clipping doesn't need to change aa or edge flags (since we
|
// that any geometric clipping doesn't need to change aa or edge flags (since we
|
||||||
// know this is on pixel boundaries, it will draw the same regardless).
|
// know this is on pixel boundaries, it will draw the same regardless).
|
||||||
// See skbug.com/13114 for more details.
|
// See skbug.com/13114 for more details.
|
||||||
GrAA clipAA = (*aa == GrAA::kNo || quad->fEdgeFlags == GrQuadAAFlags::kNone) ?
|
result = GrClip::PreClipResult(SkRRect::MakeRect(rtRect), drawUsesAA);
|
||||||
GrAA::kNo : GrAA::kYes;
|
|
||||||
result = GrClip::PreClipResult(SkRRect::MakeRect(rtRect), clipAA);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GrClip::Effect::kClipped:
|
case GrClip::Effect::kClipped:
|
||||||
if (!result.fIsRRect || (stencilSettings && result.fAA != *aa) ||
|
if (!result.fIsRRect || (stencilSettings && result.fAA != drawUsesAA) ||
|
||||||
(!result.fRRect.isRect() && !simpleColor)) {
|
(!result.fRRect.isRect() && !simpleColor)) {
|
||||||
// The clip and draw state are too complicated to try and reduce
|
// The clip and draw state are too complicated to try and reduce
|
||||||
conservativeCrop();
|
conservativeCrop();
|
||||||
@ -533,18 +534,6 @@ SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// else the draw and clip were combined so just update the AA to reflect combination
|
|
||||||
if (*aa == GrAA::kNo && result.fAA == GrAA::kYes &&
|
|
||||||
quad->fEdgeFlags != GrQuadAAFlags::kNone) {
|
|
||||||
// The clip was anti-aliased and now the draw needs to be upgraded to AA to
|
|
||||||
// properly reflect the smooth edge of the clip.
|
|
||||||
*aa = GrAA::kYes;
|
|
||||||
}
|
|
||||||
// We intentionally do not downgrade AA here because we don't know if we need to
|
|
||||||
// preserve MSAA (see GrQuadAAFlags docs). But later in the pipeline, the ops can
|
|
||||||
// use GrResolveAATypeForQuad() to turn off coverage AA when all flags are off.
|
|
||||||
// deviceQuad is exactly the intersection of original quad and clip, so it can be
|
|
||||||
// drawn with no clip (submitted by caller)
|
|
||||||
return QuadOptimization::kClipApplied;
|
return QuadOptimization::kClipApplied;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -571,7 +560,6 @@ SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization
|
|||||||
|
|
||||||
void SurfaceDrawContext::drawFilledQuad(const GrClip* clip,
|
void SurfaceDrawContext::drawFilledQuad(const GrClip* clip,
|
||||||
GrPaint&& paint,
|
GrPaint&& paint,
|
||||||
GrAA aa,
|
|
||||||
DrawQuad* quad,
|
DrawQuad* quad,
|
||||||
const GrUserStencilSettings* ss) {
|
const GrUserStencilSettings* ss) {
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
@ -581,10 +569,12 @@ void SurfaceDrawContext::drawFilledQuad(const GrClip* clip,
|
|||||||
|
|
||||||
AutoCheckFlush acf(this->drawingManager());
|
AutoCheckFlush acf(this->drawingManager());
|
||||||
|
|
||||||
QuadOptimization opt = this->attemptQuadOptimization(clip, ss, &aa, quad, &paint);
|
QuadOptimization opt = this->attemptQuadOptimization(clip, ss, quad, &paint);
|
||||||
if (opt >= QuadOptimization::kClipApplied) {
|
if (opt >= QuadOptimization::kClipApplied) {
|
||||||
// These optimizations require caller to add an op themselves
|
// These optimizations require caller to add an op themselves
|
||||||
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
|
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
|
||||||
|
// The quad being drawn requires AA if any of its edges requires AA
|
||||||
|
GrAA aa{quad->fEdgeFlags != GrQuadAAFlags::kNone};
|
||||||
GrAAType aaType;
|
GrAAType aaType;
|
||||||
if (ss) {
|
if (ss) {
|
||||||
aaType = (aa == GrAA::kYes) ? GrAAType::kMSAA : GrAAType::kNone;
|
aaType = (aa == GrAA::kYes) ? GrAAType::kMSAA : GrAAType::kNone;
|
||||||
@ -611,13 +601,14 @@ void SurfaceDrawContext::drawTexture(const GrClip* clip,
|
|||||||
const SkPMColor4f& color,
|
const SkPMColor4f& color,
|
||||||
const SkRect& srcRect,
|
const SkRect& srcRect,
|
||||||
const SkRect& dstRect,
|
const SkRect& dstRect,
|
||||||
GrAA aa,
|
|
||||||
GrQuadAAFlags edgeAA,
|
GrQuadAAFlags edgeAA,
|
||||||
SkCanvas::SrcRectConstraint constraint,
|
SkCanvas::SrcRectConstraint constraint,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
sk_sp<GrColorSpaceXform> colorSpaceXform) {
|
sk_sp<GrColorSpaceXform> colorSpaceXform) {
|
||||||
// If we are using dmsaa then go through FillRRectOp (via fillRectToRect).
|
// If we are using dmsaa then go through FillRRectOp (via fillRectToRect).
|
||||||
if ((this->alwaysAntialias() || this->caps()->reducedShaderMode()) && aa == GrAA::kYes) {
|
if ((this->alwaysAntialias() || this->caps()->reducedShaderMode()) &&
|
||||||
|
edgeAA != GrQuadAAFlags::kNone) {
|
||||||
|
|
||||||
GrPaint paint;
|
GrPaint paint;
|
||||||
paint.setColor4f(color);
|
paint.setColor4f(color);
|
||||||
std::unique_ptr<GrFragmentProcessor> fp;
|
std::unique_ptr<GrFragmentProcessor> fp;
|
||||||
@ -645,7 +636,7 @@ void SurfaceDrawContext::drawTexture(const GrClip* clip,
|
|||||||
DrawQuad quad{GrQuad::MakeFromRect(dstRect, viewMatrix), GrQuad(srcRect), edgeAA};
|
DrawQuad quad{GrQuad::MakeFromRect(dstRect, viewMatrix), GrQuad(srcRect), edgeAA};
|
||||||
|
|
||||||
this->drawTexturedQuad(clip, std::move(view), srcAlphaType, std::move(colorSpaceXform), filter,
|
this->drawTexturedQuad(clip, std::move(view), srcAlphaType, std::move(colorSpaceXform), filter,
|
||||||
mm, color, blendMode, aa, &quad, subset);
|
mm, color, blendMode, &quad, subset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDrawContext::drawTexturedQuad(const GrClip* clip,
|
void SurfaceDrawContext::drawTexturedQuad(const GrClip* clip,
|
||||||
@ -656,7 +647,6 @@ void SurfaceDrawContext::drawTexturedQuad(const GrClip* clip,
|
|||||||
GrSamplerState::MipmapMode mm,
|
GrSamplerState::MipmapMode mm,
|
||||||
const SkPMColor4f& color,
|
const SkPMColor4f& color,
|
||||||
SkBlendMode blendMode,
|
SkBlendMode blendMode,
|
||||||
GrAA aa,
|
|
||||||
DrawQuad* quad,
|
DrawQuad* quad,
|
||||||
const SkRect* subset) {
|
const SkRect* subset) {
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
@ -669,14 +659,14 @@ void SurfaceDrawContext::drawTexturedQuad(const GrClip* clip,
|
|||||||
|
|
||||||
// Functionally this is very similar to drawFilledQuad except that there's no constColor to
|
// Functionally this is very similar to drawFilledQuad except that there's no constColor to
|
||||||
// enable the kSubmitted optimizations, no stencil settings support, and its a TextureOp.
|
// enable the kSubmitted optimizations, no stencil settings support, and its a TextureOp.
|
||||||
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, &aa, quad,
|
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, quad,
|
||||||
nullptr/*paint*/);
|
nullptr/*paint*/);
|
||||||
|
|
||||||
SkASSERT(opt != QuadOptimization::kSubmitted);
|
SkASSERT(opt != QuadOptimization::kSubmitted);
|
||||||
if (opt != QuadOptimization::kDiscarded) {
|
if (opt != QuadOptimization::kDiscarded) {
|
||||||
// And the texture op if not discarded
|
// Add the texture op if not discarded
|
||||||
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
|
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
|
||||||
GrAAType aaType = this->chooseAAType(aa);
|
GrAAType aaType = this->chooseAAType(GrAA{quad->fEdgeFlags != GrQuadAAFlags::kNone});
|
||||||
auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
|
auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
|
||||||
auto saturate = clampType == GrClampType::kManual ? TextureOp::Saturate::kYes
|
auto saturate = clampType == GrClampType::kManual ? TextureOp::Saturate::kYes
|
||||||
: TextureOp::Saturate::kNo;
|
: TextureOp::Saturate::kNo;
|
||||||
@ -757,7 +747,7 @@ void SurfaceDrawContext::fillRectToRect(const GrClip* clip,
|
|||||||
aa == GrAA::kYes) { // If aa is kNo when using dmsaa, the rect is axis aligned. Don't use
|
aa == GrAA::kYes) { // If aa is kNo when using dmsaa, the rect is axis aligned. Don't use
|
||||||
// FillRRectOp because it might require dual source blending.
|
// FillRRectOp because it might require dual source blending.
|
||||||
// http://skbug.com/11756
|
// http://skbug.com/11756
|
||||||
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, &aa, &quad,
|
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, &quad,
|
||||||
&paint);
|
&paint);
|
||||||
if (opt < QuadOptimization::kClipApplied) {
|
if (opt < QuadOptimization::kClipApplied) {
|
||||||
// The optimization was completely handled inside attempt().
|
// The optimization was completely handled inside attempt().
|
||||||
@ -795,16 +785,15 @@ void SurfaceDrawContext::fillRectToRect(const GrClip* clip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert_alive(paint);
|
assert_alive(paint);
|
||||||
this->drawFilledQuad(clip, std::move(paint), aa, &quad);
|
this->drawFilledQuad(clip, std::move(paint), &quad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceDrawContext::drawQuadSet(const GrClip* clip,
|
void SurfaceDrawContext::drawQuadSet(const GrClip* clip,
|
||||||
GrPaint&& paint,
|
GrPaint&& paint,
|
||||||
GrAA aa,
|
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
const GrQuadSetEntry quads[],
|
const GrQuadSetEntry quads[],
|
||||||
int cnt) {
|
int cnt) {
|
||||||
GrAAType aaType = this->chooseAAType(aa);
|
GrAAType aaType = this->chooseAAType(GrAA::kYes);
|
||||||
|
|
||||||
FillRectOp::AddFillRectOps(this, clip, fContext, std::move(paint), aaType, viewMatrix,
|
FillRectOp::AddFillRectOps(this, clip, fContext, std::move(paint), aaType, viewMatrix,
|
||||||
quads, cnt);
|
quads, cnt);
|
||||||
@ -917,7 +906,6 @@ void SurfaceDrawContext::drawTextureSet(const GrClip* clip,
|
|||||||
GrSamplerState::Filter filter,
|
GrSamplerState::Filter filter,
|
||||||
GrSamplerState::MipmapMode mm,
|
GrSamplerState::MipmapMode mm,
|
||||||
SkBlendMode mode,
|
SkBlendMode mode,
|
||||||
GrAA aa,
|
|
||||||
SkCanvas::SrcRectConstraint constraint,
|
SkCanvas::SrcRectConstraint constraint,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
sk_sp<GrColorSpaceXform> texXform) {
|
sk_sp<GrColorSpaceXform> texXform) {
|
||||||
@ -929,7 +917,7 @@ void SurfaceDrawContext::drawTextureSet(const GrClip* clip,
|
|||||||
// Create the minimum number of GrTextureOps needed to draw this set. Individual
|
// Create the minimum number of GrTextureOps needed to draw this set. Individual
|
||||||
// GrTextureOps can rebind the texture between draws thus avoiding GrPaint (re)creation.
|
// GrTextureOps can rebind the texture between draws thus avoiding GrPaint (re)creation.
|
||||||
AutoCheckFlush acf(this->drawingManager());
|
AutoCheckFlush acf(this->drawingManager());
|
||||||
GrAAType aaType = this->chooseAAType(aa);
|
GrAAType aaType = this->chooseAAType(GrAA::kYes);
|
||||||
auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
|
auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
|
||||||
auto saturate = clampType == GrClampType::kManual ? TextureOp::Saturate::kYes
|
auto saturate = clampType == GrClampType::kManual ? TextureOp::Saturate::kYes
|
||||||
: TextureOp::Saturate::kNo;
|
: TextureOp::Saturate::kNo;
|
||||||
@ -1734,7 +1722,7 @@ void SurfaceDrawContext::drawStrokedLine(const GrClip* clip,
|
|||||||
GrQuadAAFlags edgeAA = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
GrQuadAAFlags edgeAA = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||||
|
|
||||||
assert_alive(paint);
|
assert_alive(paint);
|
||||||
this->fillQuadWithEdgeAA(clip, std::move(paint), aa, edgeAA, viewMatrix, corners, nullptr);
|
this->fillQuadWithEdgeAA(clip, std::move(paint), edgeAA, viewMatrix, corners, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SurfaceDrawContext::drawSimpleShape(const GrClip* clip,
|
bool SurfaceDrawContext::drawSimpleShape(const GrClip* clip,
|
||||||
|
@ -185,7 +185,7 @@ public:
|
|||||||
SkRect rect = SkRect::Make(bounds);
|
SkRect rect = SkRect::Make(bounds);
|
||||||
DrawQuad quad{GrQuad::MakeFromRect(rect, SkMatrix::I()),
|
DrawQuad quad{GrQuad::MakeFromRect(rect, SkMatrix::I()),
|
||||||
GrQuad::MakeFromRect(rect, localMatrix), GrQuadAAFlags::kNone};
|
GrQuad::MakeFromRect(rect, localMatrix), GrQuadAAFlags::kNone};
|
||||||
this->drawFilledQuad(clip, std::move(paint), GrAA::kNo, &quad);
|
this->drawFilledQuad(clip, std::move(paint), &quad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,17 +194,17 @@ public:
|
|||||||
* This is a specialized version of fillQuadWithEdgeAA, but is kept separate since knowing
|
* This is a specialized version of fillQuadWithEdgeAA, but is kept separate since knowing
|
||||||
* the geometry is a rectangle affords more optimizations.
|
* the geometry is a rectangle affords more optimizations.
|
||||||
*/
|
*/
|
||||||
void fillRectWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
|
void fillRectWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrQuadAAFlags edgeAA,
|
||||||
const SkMatrix& viewMatrix, const SkRect& rect,
|
const SkMatrix& viewMatrix, const SkRect& rect,
|
||||||
const SkRect* optionalLocalRect = nullptr) {
|
const SkRect* optionalLocalRect = nullptr) {
|
||||||
if (edgeAA == GrQuadAAFlags::kAll) {
|
if (edgeAA == GrQuadAAFlags::kAll) {
|
||||||
this->fillRectToRect(clip, std::move(paint), aa, viewMatrix, rect,
|
this->fillRectToRect(clip, std::move(paint), GrAA::kYes, viewMatrix, rect,
|
||||||
(optionalLocalRect) ? *optionalLocalRect : rect);
|
(optionalLocalRect) ? *optionalLocalRect : rect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const SkRect& localRect = optionalLocalRect ? *optionalLocalRect : rect;
|
const SkRect& localRect = optionalLocalRect ? *optionalLocalRect : rect;
|
||||||
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(localRect), edgeAA};
|
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(localRect), edgeAA};
|
||||||
this->drawFilledQuad(clip, std::move(paint), aa, &quad);
|
this->drawFilledQuad(clip, std::move(paint), &quad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,17 +219,17 @@ public:
|
|||||||
* The last argument, 'optionalLocalQuad', can be null if no separate local coordinates are
|
* The last argument, 'optionalLocalQuad', can be null if no separate local coordinates are
|
||||||
* necessary.
|
* necessary.
|
||||||
*/
|
*/
|
||||||
void fillQuadWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
|
void fillQuadWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrQuadAAFlags edgeAA,
|
||||||
const SkMatrix& viewMatrix, const SkPoint points[4],
|
const SkMatrix& viewMatrix, const SkPoint points[4],
|
||||||
const SkPoint optionalLocalPoints[4]) {
|
const SkPoint optionalLocalPoints[4]) {
|
||||||
const SkPoint* localPoints = optionalLocalPoints ? optionalLocalPoints : points;
|
const SkPoint* localPoints = optionalLocalPoints ? optionalLocalPoints : points;
|
||||||
DrawQuad quad{GrQuad::MakeFromSkQuad(points, viewMatrix),
|
DrawQuad quad{GrQuad::MakeFromSkQuad(points, viewMatrix),
|
||||||
GrQuad::MakeFromSkQuad(localPoints, SkMatrix::I()), edgeAA};
|
GrQuad::MakeFromSkQuad(localPoints, SkMatrix::I()), edgeAA};
|
||||||
this->drawFilledQuad(clip, std::move(paint), aa, &quad);
|
this->drawFilledQuad(clip, std::move(paint), &quad);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
|
// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
|
||||||
void drawQuadSet(const GrClip* clip, GrPaint&& paint, GrAA aa, const SkMatrix& viewMatrix,
|
void drawQuadSet(const GrClip* clip, GrPaint&& paint, const SkMatrix& viewMatrix,
|
||||||
const GrQuadSetEntry[], int cnt);
|
const GrQuadSetEntry[], int cnt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,7 +247,6 @@ public:
|
|||||||
const SkPMColor4f&,
|
const SkPMColor4f&,
|
||||||
const SkRect& srcRect,
|
const SkRect& srcRect,
|
||||||
const SkRect& dstRect,
|
const SkRect& dstRect,
|
||||||
GrAA,
|
|
||||||
GrQuadAAFlags,
|
GrQuadAAFlags,
|
||||||
SkCanvas::SrcRectConstraint,
|
SkCanvas::SrcRectConstraint,
|
||||||
const SkMatrix&,
|
const SkMatrix&,
|
||||||
@ -269,7 +268,6 @@ public:
|
|||||||
const SkPMColor4f& color,
|
const SkPMColor4f& color,
|
||||||
const SkPoint srcQuad[4],
|
const SkPoint srcQuad[4],
|
||||||
const SkPoint dstQuad[4],
|
const SkPoint dstQuad[4],
|
||||||
GrAA aa,
|
|
||||||
GrQuadAAFlags edgeAA,
|
GrQuadAAFlags edgeAA,
|
||||||
const SkRect* subset,
|
const SkRect* subset,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
@ -277,7 +275,7 @@ public:
|
|||||||
DrawQuad quad{GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
|
DrawQuad quad{GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
|
||||||
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), edgeAA};
|
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), edgeAA};
|
||||||
this->drawTexturedQuad(clip, std::move(view), srcAlphaType, std::move(texXform), filter, mm,
|
this->drawTexturedQuad(clip, std::move(view), srcAlphaType, std::move(texXform), filter, mm,
|
||||||
color, mode, aa, &quad, subset);
|
color, mode, &quad, subset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -298,7 +296,6 @@ public:
|
|||||||
GrSamplerState::Filter,
|
GrSamplerState::Filter,
|
||||||
GrSamplerState::MipmapMode,
|
GrSamplerState::MipmapMode,
|
||||||
SkBlendMode mode,
|
SkBlendMode mode,
|
||||||
GrAA aa,
|
|
||||||
SkCanvas::SrcRectConstraint,
|
SkCanvas::SrcRectConstraint,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
sk_sp<GrColorSpaceXform> texXform);
|
sk_sp<GrColorSpaceXform> texXform);
|
||||||
@ -559,7 +556,7 @@ public:
|
|||||||
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix),
|
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix),
|
||||||
localMatrix ? GrQuad::MakeFromRect(rect, *localMatrix) : GrQuad(rect),
|
localMatrix ? GrQuad::MakeFromRect(rect, *localMatrix) : GrQuad(rect),
|
||||||
doStencilMSAA == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone};
|
doStencilMSAA == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone};
|
||||||
this->drawFilledQuad(clip, std::move(paint), doStencilMSAA, &quad, ss);
|
this->drawFilledQuad(clip, std::move(paint), &quad, ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fills the user stencil bits with a non-zero value at every sample inside the path. This will
|
// Fills the user stencil bits with a non-zero value at every sample inside the path. This will
|
||||||
@ -663,23 +660,22 @@ private:
|
|||||||
// 'stencilSettings' are provided merely for decision making purposes; When non-null,
|
// 'stencilSettings' are provided merely for decision making purposes; When non-null,
|
||||||
// optimization strategies that submit special ops are avoided.
|
// optimization strategies that submit special ops are avoided.
|
||||||
//
|
//
|
||||||
// 'aa' and 'quad' should be the original draw request on input, and will be updated as
|
// 'quad' should be the original draw request on input, and will be updated as
|
||||||
// appropriate depending on the returned optimization level.
|
// appropriate depending on the returned optimization level.
|
||||||
//
|
//
|
||||||
// If kSubmitted is returned, the provided paint was consumed. Otherwise it is left unchanged.
|
// If kSubmitted is returned, the provided paint was consumed. Otherwise it is left unchanged.
|
||||||
QuadOptimization attemptQuadOptimization(const GrClip* clip,
|
QuadOptimization attemptQuadOptimization(const GrClip* clip,
|
||||||
const GrUserStencilSettings* stencilSettings,
|
const GrUserStencilSettings* stencilSettings,
|
||||||
GrAA* aa,
|
|
||||||
DrawQuad* quad,
|
DrawQuad* quad,
|
||||||
GrPaint* paint);
|
GrPaint* paint);
|
||||||
|
|
||||||
// If stencil settings, 'ss', are non-null, AA controls MSAA or no AA. If they are null, then AA
|
// The overall AA policy is determined by the quad's edge flags: kNone is no AA, and anything
|
||||||
// can choose between coverage, MSAA as per chooseAAType(). This will always attempt to apply
|
// else uses some form of anti-aliasing. If 'ss' is non-null, that will be MSAA; otherwise it's
|
||||||
|
// MSAA or analytic coverage per chooseAAType(). This will always attempt to apply
|
||||||
// quad optimizations, so all quad/rect public APIs should rely on this function for consistent
|
// quad optimizations, so all quad/rect public APIs should rely on this function for consistent
|
||||||
// clipping behavior. 'quad' will be modified in place to reflect final rendered geometry.
|
// clipping behavior. 'quad' will be modified in place to reflect final rendered geometry.
|
||||||
void drawFilledQuad(const GrClip* clip,
|
void drawFilledQuad(const GrClip* clip,
|
||||||
GrPaint&& paint,
|
GrPaint&& paint,
|
||||||
GrAA aa,
|
|
||||||
DrawQuad* quad,
|
DrawQuad* quad,
|
||||||
const GrUserStencilSettings* ss = nullptr);
|
const GrUserStencilSettings* ss = nullptr);
|
||||||
|
|
||||||
@ -693,7 +689,6 @@ private:
|
|||||||
GrSamplerState::MipmapMode,
|
GrSamplerState::MipmapMode,
|
||||||
const SkPMColor4f& color,
|
const SkPMColor4f& color,
|
||||||
SkBlendMode blendMode,
|
SkBlendMode blendMode,
|
||||||
GrAA aa,
|
|
||||||
DrawQuad* quad,
|
DrawQuad* quad,
|
||||||
const SkRect* subset = nullptr);
|
const SkRect* subset = nullptr);
|
||||||
|
|
||||||
|
@ -402,7 +402,6 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> draw_mipmap_into_new_rende
|
|||||||
{1, 1, 1, 1},
|
{1, 1, 1, 1},
|
||||||
SkRect::MakeWH(4, 4),
|
SkRect::MakeWH(4, 4),
|
||||||
SkRect::MakeWH(1, 1),
|
SkRect::MakeWH(1, 1),
|
||||||
GrAA::kYes,
|
|
||||||
GrQuadAAFlags::kAll,
|
GrQuadAAFlags::kAll,
|
||||||
SkCanvas::kFast_SrcRectConstraint,
|
SkCanvas::kFast_SrcRectConstraint,
|
||||||
SkMatrix::I(),
|
SkMatrix::I(),
|
||||||
|
@ -198,7 +198,6 @@ public:
|
|||||||
{1.0f, 1.0f, 1.0f, 1.0f},
|
{1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
SkRect::MakeWH(wh, wh),
|
SkRect::MakeWH(wh, wh),
|
||||||
SkRect::MakeWH(wh, wh),
|
SkRect::MakeWH(wh, wh),
|
||||||
GrAA::kNo,
|
|
||||||
GrQuadAAFlags::kNone,
|
GrQuadAAFlags::kNone,
|
||||||
SkCanvas::kFast_SrcRectConstraint,
|
SkCanvas::kFast_SrcRectConstraint,
|
||||||
SkMatrix::I(),
|
SkMatrix::I(),
|
||||||
|
Loading…
Reference in New Issue
Block a user