diff options
author | 2017-08-17 15:58:06 -0400 | |
---|---|---|
committer | 2017-08-18 12:47:28 +0000 | |
commit | 3fd295550f8c4fecd4bc61ce916738d49310eb67 (patch) | |
tree | 551160c13d73e996e8f624f21d6f9ba94ca711dd /src/gpu/GrRenderTargetContext.cpp | |
parent | cc4221be586a00d5190e765ebdb6c5e5731eefa9 (diff) |
Add GrTextureOp and use to implement SkGpuDevice::drawImage[Rect]() when possible
This op draws a texture rectangle in src over blending with no edge antialiasing. It less powerful than NonAAFillRectOp/GrPaint but has less CPU overhead.
Change-Id: Ia6107bb67c1c2a83de14c665aff64b0de2750fba
Reviewed-on: https://skia-review.googlesource.com/33802
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 39515adc0a..3f9dcbb0bd 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -43,6 +43,7 @@ #include "ops/GrSemaphoreOp.h" #include "ops/GrShadowRRectOp.h" #include "ops/GrStencilPathOp.h" +#include "ops/GrTextureOp.h" #include "text/GrAtlasTextContext.h" #include "text/GrStencilAndCoverTextContext.h" @@ -769,6 +770,21 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip, this->internalDrawPath(clip, std::move(paint), aa, viewAndUnLocalMatrix, path, GrStyle()); } +void GrRenderTargetContext::drawTextureAffine(const GrClip& clip, sk_sp<GrTextureProxy> proxy, + GrSamplerParams::FilterMode filter, GrColor color, + const SkRect& srcRect, const SkRect& dstRect, + const SkMatrix& viewMatrix, + sk_sp<GrColorSpaceXform> colorSpaceXform) { + ASSERT_SINGLE_OWNER + RETURN_IF_ABANDONED + SkDEBUGCODE(this->validate();) + GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTextureAffine", fContext); + SkASSERT(!viewMatrix.hasPerspective()); + bool allowSRGB = SkToBool(this->getColorSpace()); + this->addDrawOp(clip, GrTextureOp::Make(std::move(proxy), filter, color, srcRect, dstRect, + viewMatrix, std::move(colorSpaceXform), allowSRGB)); +} + void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip, GrPaint&& paint, GrAA aa, |