aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-06 21:17:15 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-06 21:17:26 +0000
commit9a121cc6ad746c37611229dc0ec1805545c4d2e0 (patch)
treebac71009c511cb048a6152e3b5698aea5c735b01 /src/gpu/ops
parent7754ccce726b09e78d269804c1c11e1718965301 (diff)
Revert "Make GrCopySurfaceOp friendlier to GrSurfaceProxy"
This reverts commit d7cda9a6f050c30e65b0744b3cfb45cecdc40834. Reason for revert: Tegra3!!!! Original change's description: > Make GrCopySurfaceOp friendlier to GrSurfaceProxy > > Change-Id: Iba8c068bd96ab154d466e485a9db31dd552138de > Reviewed-on: https://skia-review.googlesource.com/11325 > Commit-Queue: Robert Phillips <robertphillips@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Idc31d469d94e6e2772ee5714987b3a05bb902d88 Reviewed-on: https://skia-review.googlesource.com/11580 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrCopySurfaceOp.cpp44
-rw-r--r--src/gpu/ops/GrCopySurfaceOp.h51
2 files changed, 38 insertions, 57 deletions
diff --git a/src/gpu/ops/GrCopySurfaceOp.cpp b/src/gpu/ops/GrCopySurfaceOp.cpp
index 5feed18f76..87c490b110 100644
--- a/src/gpu/ops/GrCopySurfaceOp.cpp
+++ b/src/gpu/ops/GrCopySurfaceOp.cpp
@@ -8,12 +8,12 @@
#include "GrCopySurfaceOp.h"
// returns true if the read/written rect intersects the src/dst and false if not.
-static bool clip_src_rect_and_dst_point(const GrSurfaceProxy* dst,
- const GrSurfaceProxy* src,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint,
- SkIRect* clippedSrcRect,
- SkIPoint* clippedDstPoint) {
+bool GrCopySurfaceOp::ClipSrcRectAndDstPoint(const GrSurface* dst,
+ const GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint,
+ SkIRect* clippedSrcRect,
+ SkIPoint* clippedDstPoint) {
*clippedSrcRect = srcRect;
*clippedDstPoint = dstPoint;
@@ -58,37 +58,21 @@ static bool clip_src_rect_and_dst_point(const GrSurfaceProxy* dst,
return !clippedSrcRect->isEmpty();
}
-std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrResourceProvider* resourceProvider,
- GrSurfaceProxy* dstProxy, GrSurfaceProxy* srcProxy,
- const SkIRect& srcRect,
+std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(dstProxy);
- SkASSERT(srcProxy);
- if (GrPixelConfigIsSint(dstProxy->config()) != GrPixelConfigIsSint(srcProxy->config())) {
+ SkASSERT(dst);
+ SkASSERT(src);
+ if (GrPixelConfigIsSint(dst->config()) != GrPixelConfigIsSint(src->config())) {
return nullptr;
}
- if (GrPixelConfigIsCompressed(dstProxy->config())) {
+ if (GrPixelConfigIsCompressed(dst->config())) {
return nullptr;
}
SkIRect clippedSrcRect;
SkIPoint clippedDstPoint;
- // If the rect is outside the srcProxy or dstProxy then we've already succeeded.
- if (!clip_src_rect_and_dst_point(dstProxy, srcProxy, srcRect, dstPoint,
- &clippedSrcRect, &clippedDstPoint)) {
+ // If the rect is outside the src or dst then we've already succeeded.
+ if (!ClipSrcRectAndDstPoint(dst, src, srcRect, dstPoint, &clippedSrcRect, &clippedDstPoint)) {
return nullptr;
}
-
- // MDB TODO: remove this instantiation
- GrSurface* dstTex = dstProxy->instantiate(resourceProvider);
- if (!dstTex) {
- return nullptr;
- }
- GrSurface* srcTex = srcProxy->instantiate(resourceProvider);
- if (!srcTex) {
- return nullptr;
- }
-
- return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dstTex, srcTex,
- dstProxy->uniqueID(), srcProxy->uniqueID(),
- clippedSrcRect, clippedDstPoint));
+ return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dst, src, clippedSrcRect, clippedDstPoint));
}
diff --git a/src/gpu/ops/GrCopySurfaceOp.h b/src/gpu/ops/GrCopySurfaceOp.h
index 05ee8d0a00..4c4500b445 100644
--- a/src/gpu/ops/GrCopySurfaceOp.h
+++ b/src/gpu/ops/GrCopySurfaceOp.h
@@ -8,44 +8,45 @@
#ifndef GrCopySurfaceOp_DEFINED
#define GrCopySurfaceOp_DEFINED
+#include "GrGpu.h"
#include "GrOp.h"
#include "GrOpFlushState.h"
+#include "GrRenderTarget.h"
class GrCopySurfaceOp final : public GrOp {
public:
DEFINE_OP_CLASS_ID
- // MDB TODO: remove the resourceProvider parameter
- static std::unique_ptr<GrOp> Make(GrResourceProvider*,
- GrSurfaceProxy* dst, GrSurfaceProxy* src,
- const SkIRect& srcRect,
+ /** This should not really be exposed as Create() will apply this clipping, but there is
+ * currently a workaround in GrContext::copySurface() for non-render target dsts that relies
+ * on it. */
+ static bool ClipSrcRectAndDstPoint(const GrSurface* dst,
+ const GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint,
+ SkIRect* clippedSrcRect,
+ SkIPoint* clippedDstPoint);
+
+ static std::unique_ptr<GrOp> Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
const SkIPoint& dstPoint);
const char* name() const override { return "CopySurface"; }
SkString dumpInfo() const override {
SkString string;
- string.printf("src: (proxyID: %d, rtID: %d), dst: (proxyID: %d, rtID: %d), "
- "srcRect: [L: %d, T: %d, R: %d, B: %d], dstPt: [X: %d, Y: %d]",
- fSrcProxyID.asUInt(), fSrc.get()->uniqueID().asUInt(),
- fDstProxyID.asUInt(), fDst.get()->uniqueID().asUInt(),
- fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
- fDstPoint.fX, fDstPoint.fY);
+ string.printf(
+ "SRC: 0x%p, DST: 0x%p, SRECT: [L: %d, T: %d, R: %d, B: %d], "
+ "DPT:[X: %d, Y: %d]",
+ fDst.get(), fSrc.get(), fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight,
+ fSrcRect.fBottom, fDstPoint.fX, fDstPoint.fY);
string.append(INHERITED::dumpInfo());
return string;
}
private:
- GrCopySurfaceOp(GrSurface* dst, GrSurface* src,
- GrSurfaceProxy::UniqueID dstID, GrSurfaceProxy::UniqueID srcID,
- const SkIRect& srcRect, const SkIPoint& dstPoint)
- : INHERITED(ClassID())
- , fDstProxyID(dstID)
- , fSrcProxyID(srcID)
- , fDst(dst)
- , fSrc(src)
- , fSrcRect(srcRect)
- , fDstPoint(dstPoint) {
+ GrCopySurfaceOp(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint)
+ : INHERITED(ClassID()), fDst(dst), fSrc(src), fSrcRect(srcRect), fDstPoint(dstPoint) {
SkRect bounds =
SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dstPoint.fY),
SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height()));
@@ -66,14 +67,10 @@ private:
}
}
- // MDB TODO: remove the proxy IDs once the GrSurfaceProxy carries the ref since they will
- // be redundant
- GrSurfaceProxy::UniqueID fDstProxyID;
- GrSurfaceProxy::UniqueID fSrcProxyID;
GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
- GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
- SkIRect fSrcRect;
- SkIPoint fDstPoint;
+ GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
+ SkIRect fSrcRect;
+ SkIPoint fDstPoint;
typedef GrOp INHERITED;
};