Revert "Remove support for copyAsDraw in gpu copySurface."
This reverts commit 6565506463db042d3d543a1707f473cdf1ef4e9e.
Reason for revert: seems to break things?
Original change's description:
> Remove support for copyAsDraw in gpu copySurface.
>
> The major changes on a higher lever are:
> 1) The majority of all copies now go through GrSurfaceProxy::Copy which
> takes in a proxy and returns a new one with the data copied to it. This
> is the most common use case within Ganesh.
>
> 2) The backend copy calls no longer do draws, require origins to be the
> same, and won't do any swizzling or adjustment of subrects. They are
> all implemented to be dumb copy this data to this other spot.
>
> 3) The GrSurfaceContext copy call has now been moved to priv and renamed
> copyNoDraw, and a new priv copyAsDraw was added to GrRenderTargetContext.
>
> 4) WritePixels and ReplaceRenderTarget both need to specifiy the destination
> of copies. They are the only users (besides the GrSurfaceProxy::Copy) which
> call the priv methods on GrSurfaceContext.
>
> Change-Id: Iaf1eb3a73ccaf39a75af77e281dae594f809186f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217459
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Id43aa8aa1451e794342e930441d9975b90e6b59f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218549
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index bedb5c3..2b6987c 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
-#include "src/gpu/GrSurfaceContext.h"
-
#include "include/private/GrAuditTrail.h"
#include "include/private/GrOpList.h"
#include "include/private/GrRecordingContext.h"
@@ -17,7 +15,7 @@
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
-#include "src/gpu/GrSurfaceContextPriv.h"
+#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/GrSurfacePriv.h"
#include "src/gpu/GrTextureContext.h"
#include "src/gpu/SkGr.h"
@@ -373,7 +371,7 @@
}
auto tempProxy = direct->priv().proxyProvider()->createProxy(
- format, desc, dstProxy->origin(), SkBackingFit::kApprox, SkBudgeted::kYes);
+ format, desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
if (!tempProxy) {
return false;
}
@@ -395,7 +393,7 @@
}
if (this->asRenderTargetContext()) {
- std::unique_ptr<GrFragmentProcessor> fp;
+ std::unique_ptr<GrFragmentProcessor> fp;
if (canvas2DFastPath) {
fp = direct->priv().createUPMToPMEffect(
GrSimpleTextureEffect::Make(std::move(tempProxy), SkMatrix::I()));
@@ -417,9 +415,10 @@
} else {
SkIRect srcRect = SkIRect::MakeWH(width, height);
SkIPoint dstPoint = SkIPoint::Make(left, top);
- if (this->copy(tempProxy.get(), srcRect, dstPoint)) {
+ if (!caps->canCopySurface(this->asSurfaceProxy(), tempProxy.get(), srcRect, dstPoint)) {
return false;
}
+ SkAssertResult(this->copy(tempProxy.get(), srcRect, dstPoint));
}
return true;
}
@@ -526,17 +525,13 @@
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContextPriv::copy");
+ GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::copy");
- SkASSERT(src->backendFormat().textureType() != GrTextureType::kExternal);
- SkASSERT(src->origin() == this->asSurfaceProxy()->origin());
-
- GrSurfaceProxy* dst = this->asSurfaceProxy();
-
- if (!this->fContext->priv().caps()->canCopySurface(dst, src, srcRect, dstPoint)) {
+ if (!fContext->priv().caps()->canCopySurface(this->asSurfaceProxy(), src, srcRect,
+ dstPoint)) {
return false;
}
- return this->getOpList()->copySurface(this->fContext, dst, src, srcRect, dstPoint);
+ return this->getOpList()->copySurface(fContext, this->asSurfaceProxy(),
+ src, srcRect, dstPoint);
}
-