Remove old texture op factories

Change-Id: I526cd01be501bf356307f00deb2c3067ab16de8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223927
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Michael Ludwig 2019-06-27 10:47:42 -04:00 committed by Skia Commit-Bot
parent 9c310473c6
commit 205224fbd5
3 changed files with 38 additions and 97 deletions

View File

@ -931,9 +931,12 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_sp<GrTextureProxy
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTexture", fContext);
const SkRect* domain = nullptr;
if (constraint == SkCanvas::kStrict_SrcRectConstraint &&
srcRect.contains(proxy->getWorstCaseBoundsRect())) {
constraint = SkCanvas::kFast_SrcRectConstraint;
!srcRect.contains(proxy->getWorstCaseBoundsRect())) {
// The domain coordinates will be the original src rect, not the clipped src rect
domain = &srcRect;
}
GrAAType aaType = this->chooseAAType(aa);
@ -945,9 +948,10 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_sp<GrTextureProxy
}
AutoCheckFlush acf(this->drawingManager());
auto op = GrTextureOp::Make(fContext, std::move(proxy), filter, color, clippedSrcRect,
clippedDstRect, aaType, aaFlags, constraint, viewMatrix,
std::move(textureColorSpaceXform), mode);
auto op = GrTextureOp::Make(
fContext, std::move(proxy), std::move(textureColorSpaceXform), filter, color, mode,
aaType, aaFlags, GrQuad::MakeFromRect(clippedDstRect, viewMatrix),
GrQuad(clippedSrcRect), domain);
this->addDrawOp(clip, std::move(op));
}
@ -971,8 +975,9 @@ void GrRenderTargetContext::drawTextureQuad(const GrClip& clip, sk_sp<GrTextureP
// Unlike drawTexture(), don't bother cropping or optimizing the filter type since we're
// sampling an arbitrary quad of the texture.
AutoCheckFlush acf(this->drawingManager());
auto op = GrTextureOp::MakeQuad(fContext, std::move(proxy), filter, color, srcQuad, dstQuad,
aaType, aaFlags, domain, viewMatrix, std::move(texXform), mode);
auto op = GrTextureOp::Make(fContext, std::move(proxy), std::move(texXform), filter, color,
mode, aaType, aaFlags, GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain);
this->addDrawOp(clip, std::move(op));
}

View File

@ -607,17 +607,17 @@ private:
namespace GrTextureOp {
std::unique_ptr<GrDrawOp> MakeGeneral(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> textureXform,
GrSamplerState::Filter filter,
const SkPMColor4f& color,
SkBlendMode blendMode,
GrAAType aaType,
GrQuadAAFlags aaFlags,
const GrQuad& deviceQuad,
const GrQuad& localQuad,
const SkRect* domain) {
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> textureXform,
GrSamplerState::Filter filter,
const SkPMColor4f& color,
SkBlendMode blendMode,
GrAAType aaType,
GrQuadAAFlags aaFlags,
const GrQuad& deviceQuad,
const GrQuad& localQuad,
const SkRect* domain) {
// Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp
if (domain && domain->contains(proxy->getWorstCaseBoundsRect())) {
// No need for a shader-based domain if hardware clamping achieves the same effect
@ -658,40 +658,6 @@ std::unique_ptr<GrDrawOp> MakeGeneral(GrRecordingContext* context,
}
}
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
GrSamplerState::Filter filter,
const SkPMColor4f& color,
const SkRect& srcRect,
const SkRect& dstRect,
GrAAType aaType,
GrQuadAAFlags aaFlags,
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> textureColorSpaceXform,
SkBlendMode blendMode) {
return MakeGeneral(context, std::move(proxy), textureColorSpaceXform, filter, color, blendMode,
aaType, aaFlags, GrQuad::MakeFromRect(dstRect, viewMatrix), GrQuad(srcRect),
constraint == SkCanvas::kStrict_SrcRectConstraint ? &srcRect : nullptr);
}
std::unique_ptr<GrDrawOp> MakeQuad(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
GrSamplerState::Filter filter,
const SkPMColor4f& color,
const SkPoint srcQuad[4],
const SkPoint dstQuad[4],
GrAAType aaType,
GrQuadAAFlags aaFlags,
const SkRect* domain,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> textureXform,
SkBlendMode blendMode) {
return MakeGeneral(context, std::move(proxy), textureXform, filter, color, blendMode,
aaType, aaFlags, GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain);
}
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
const GrRenderTargetContext::TextureSetEntry set[],
int cnt,
@ -755,10 +721,11 @@ GR_DRAW_OP_TEST_DEFINE(TextureOp) {
aaFlags |= random->nextBool() ? GrQuadAAFlags::kTop : GrQuadAAFlags::kNone;
aaFlags |= random->nextBool() ? GrQuadAAFlags::kRight : GrQuadAAFlags::kNone;
aaFlags |= random->nextBool() ? GrQuadAAFlags::kBottom : GrQuadAAFlags::kNone;
auto constraint = random->nextBool() ? SkCanvas::kStrict_SrcRectConstraint
: SkCanvas::kFast_SrcRectConstraint;
return GrTextureOp::Make(context, std::move(proxy), filter, color, srcRect, rect, aaType,
aaFlags, constraint, viewMatrix, std::move(texXform));
bool useDomain = random->nextBool();
return GrTextureOp::Make(context, std::move(proxy), std::move(texXform), filter, color,
SkBlendMode::kSrcOver, aaType, aaFlags,
GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(srcRect),
useDomain ? &srcRect : nullptr);
}
#endif

View File

@ -31,48 +31,17 @@ namespace GrTextureOp {
* deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is
* src over, this will return a GrFillRectOp with a paint that samples the proxy.
*/
std::unique_ptr<GrDrawOp> MakeGeneral(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> textureXform,
GrSamplerState::Filter filter,
const SkPMColor4f& color,
SkBlendMode blendMode,
GrAAType aaType,
GrQuadAAFlags aaFlags,
const GrQuad& deviceQuad,
const GrQuad& localQuad,
const SkRect* domain = nullptr);
// FIXME (michaelludwig) - To be removed
std::unique_ptr<GrDrawOp> Make(GrRecordingContext*,
sk_sp<GrTextureProxy>,
GrSamplerState::Filter,
const SkPMColor4f&,
const SkRect& srcRect,
const SkRect& dstRect,
GrAAType,
GrQuadAAFlags,
SkCanvas::SrcRectConstraint,
const SkMatrix& viewMatrix,
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> textureXform,
SkBlendMode blendMode = SkBlendMode::kSrcOver);
// Generalizes the above subrect drawing operation to draw a subquad of an image, where srcQuad
// and dstQuad correspond to srcRect and dstRect. If domain is not null, this behaves as if it
// had a strict constraint relying on the given domain.
// FIXME (michaelludwig) - To be removed
std::unique_ptr<GrDrawOp> MakeQuad(GrRecordingContext* context,
sk_sp<GrTextureProxy>,
GrSamplerState::Filter,
const SkPMColor4f&,
const SkPoint srcQuad[4],
const SkPoint dstQuad[4],
GrAAType,
GrQuadAAFlags,
const SkRect* domain,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> textureXform,
SkBlendMode blendMode = SkBlendMode::kSrcOver);
GrSamplerState::Filter filter,
const SkPMColor4f& color,
SkBlendMode blendMode,
GrAAType aaType,
GrQuadAAFlags aaFlags,
const GrQuad& deviceQuad,
const GrQuad& localQuad,
const SkRect* domain = nullptr);
// Unlike the single-proxy factory, this only supports src-over blending.
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext*,