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:
parent
9c310473c6
commit
205224fbd5
@ -931,9 +931,12 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_sp<GrTextureProxy
|
|||||||
RETURN_IF_ABANDONED
|
RETURN_IF_ABANDONED
|
||||||
SkDEBUGCODE(this->validate();)
|
SkDEBUGCODE(this->validate();)
|
||||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTexture", fContext);
|
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTexture", fContext);
|
||||||
|
|
||||||
|
const SkRect* domain = nullptr;
|
||||||
if (constraint == SkCanvas::kStrict_SrcRectConstraint &&
|
if (constraint == SkCanvas::kStrict_SrcRectConstraint &&
|
||||||
srcRect.contains(proxy->getWorstCaseBoundsRect())) {
|
!srcRect.contains(proxy->getWorstCaseBoundsRect())) {
|
||||||
constraint = SkCanvas::kFast_SrcRectConstraint;
|
// The domain coordinates will be the original src rect, not the clipped src rect
|
||||||
|
domain = &srcRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrAAType aaType = this->chooseAAType(aa);
|
GrAAType aaType = this->chooseAAType(aa);
|
||||||
@ -945,9 +948,10 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_sp<GrTextureProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoCheckFlush acf(this->drawingManager());
|
AutoCheckFlush acf(this->drawingManager());
|
||||||
auto op = GrTextureOp::Make(fContext, std::move(proxy), filter, color, clippedSrcRect,
|
auto op = GrTextureOp::Make(
|
||||||
clippedDstRect, aaType, aaFlags, constraint, viewMatrix,
|
fContext, std::move(proxy), std::move(textureColorSpaceXform), filter, color, mode,
|
||||||
std::move(textureColorSpaceXform), mode);
|
aaType, aaFlags, GrQuad::MakeFromRect(clippedDstRect, viewMatrix),
|
||||||
|
GrQuad(clippedSrcRect), domain);
|
||||||
this->addDrawOp(clip, std::move(op));
|
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
|
// Unlike drawTexture(), don't bother cropping or optimizing the filter type since we're
|
||||||
// sampling an arbitrary quad of the texture.
|
// sampling an arbitrary quad of the texture.
|
||||||
AutoCheckFlush acf(this->drawingManager());
|
AutoCheckFlush acf(this->drawingManager());
|
||||||
auto op = GrTextureOp::MakeQuad(fContext, std::move(proxy), filter, color, srcQuad, dstQuad,
|
auto op = GrTextureOp::Make(fContext, std::move(proxy), std::move(texXform), filter, color,
|
||||||
aaType, aaFlags, domain, viewMatrix, std::move(texXform), mode);
|
mode, aaType, aaFlags, GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
|
||||||
|
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain);
|
||||||
this->addDrawOp(clip, std::move(op));
|
this->addDrawOp(clip, std::move(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,17 +607,17 @@ private:
|
|||||||
|
|
||||||
namespace GrTextureOp {
|
namespace GrTextureOp {
|
||||||
|
|
||||||
std::unique_ptr<GrDrawOp> MakeGeneral(GrRecordingContext* context,
|
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||||
sk_sp<GrTextureProxy> proxy,
|
sk_sp<GrTextureProxy> proxy,
|
||||||
sk_sp<GrColorSpaceXform> textureXform,
|
sk_sp<GrColorSpaceXform> textureXform,
|
||||||
GrSamplerState::Filter filter,
|
GrSamplerState::Filter filter,
|
||||||
const SkPMColor4f& color,
|
const SkPMColor4f& color,
|
||||||
SkBlendMode blendMode,
|
SkBlendMode blendMode,
|
||||||
GrAAType aaType,
|
GrAAType aaType,
|
||||||
GrQuadAAFlags aaFlags,
|
GrQuadAAFlags aaFlags,
|
||||||
const GrQuad& deviceQuad,
|
const GrQuad& deviceQuad,
|
||||||
const GrQuad& localQuad,
|
const GrQuad& localQuad,
|
||||||
const SkRect* domain) {
|
const SkRect* domain) {
|
||||||
// Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp
|
// Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp
|
||||||
if (domain && domain->contains(proxy->getWorstCaseBoundsRect())) {
|
if (domain && domain->contains(proxy->getWorstCaseBoundsRect())) {
|
||||||
// No need for a shader-based domain if hardware clamping achieves the same effect
|
// 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,
|
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
|
||||||
const GrRenderTargetContext::TextureSetEntry set[],
|
const GrRenderTargetContext::TextureSetEntry set[],
|
||||||
int cnt,
|
int cnt,
|
||||||
@ -755,10 +721,11 @@ GR_DRAW_OP_TEST_DEFINE(TextureOp) {
|
|||||||
aaFlags |= random->nextBool() ? GrQuadAAFlags::kTop : GrQuadAAFlags::kNone;
|
aaFlags |= random->nextBool() ? GrQuadAAFlags::kTop : GrQuadAAFlags::kNone;
|
||||||
aaFlags |= random->nextBool() ? GrQuadAAFlags::kRight : GrQuadAAFlags::kNone;
|
aaFlags |= random->nextBool() ? GrQuadAAFlags::kRight : GrQuadAAFlags::kNone;
|
||||||
aaFlags |= random->nextBool() ? GrQuadAAFlags::kBottom : GrQuadAAFlags::kNone;
|
aaFlags |= random->nextBool() ? GrQuadAAFlags::kBottom : GrQuadAAFlags::kNone;
|
||||||
auto constraint = random->nextBool() ? SkCanvas::kStrict_SrcRectConstraint
|
bool useDomain = random->nextBool();
|
||||||
: SkCanvas::kFast_SrcRectConstraint;
|
return GrTextureOp::Make(context, std::move(proxy), std::move(texXform), filter, color,
|
||||||
return GrTextureOp::Make(context, std::move(proxy), filter, color, srcRect, rect, aaType,
|
SkBlendMode::kSrcOver, aaType, aaFlags,
|
||||||
aaFlags, constraint, viewMatrix, std::move(texXform));
|
GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(srcRect),
|
||||||
|
useDomain ? &srcRect : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,48 +31,17 @@ namespace GrTextureOp {
|
|||||||
* deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is
|
* 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.
|
* src over, this will return a GrFillRectOp with a paint that samples the proxy.
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<GrDrawOp> MakeGeneral(GrRecordingContext* context,
|
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||||
sk_sp<GrTextureProxy> proxy,
|
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,
|
|
||||||
sk_sp<GrColorSpaceXform> textureXform,
|
sk_sp<GrColorSpaceXform> textureXform,
|
||||||
SkBlendMode blendMode = SkBlendMode::kSrcOver);
|
GrSamplerState::Filter filter,
|
||||||
|
const SkPMColor4f& color,
|
||||||
// Generalizes the above subrect drawing operation to draw a subquad of an image, where srcQuad
|
SkBlendMode blendMode,
|
||||||
// and dstQuad correspond to srcRect and dstRect. If domain is not null, this behaves as if it
|
GrAAType aaType,
|
||||||
// had a strict constraint relying on the given domain.
|
GrQuadAAFlags aaFlags,
|
||||||
// FIXME (michaelludwig) - To be removed
|
const GrQuad& deviceQuad,
|
||||||
std::unique_ptr<GrDrawOp> MakeQuad(GrRecordingContext* context,
|
const GrQuad& localQuad,
|
||||||
sk_sp<GrTextureProxy>,
|
const SkRect* domain = nullptr);
|
||||||
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);
|
|
||||||
|
|
||||||
// Unlike the single-proxy factory, this only supports src-over blending.
|
// Unlike the single-proxy factory, this only supports src-over blending.
|
||||||
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext*,
|
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext*,
|
||||||
|
Loading…
Reference in New Issue
Block a user