Remove 'dst' argument from GrOpList::copySurface

The dst should always be fTarget. Otherwise we need to rethink our
model of when to mark mipmaps, etc. as dirty.

Bug: skia:
Change-Id: Ie4e98374df40d825801494bf335b0a5a2c6f459f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230916
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Chris Dalton 2019-08-02 12:55:23 -06:00 committed by Skia Commit-Bot
parent 8ee6cf3691
commit f8e5aadbd4
6 changed files with 15 additions and 34 deletions

View File

@ -23,8 +23,16 @@ public:
GrOpList(sk_sp<GrOpMemoryPool>, sk_sp<GrSurfaceProxy>, GrAuditTrail*); GrOpList(sk_sp<GrOpMemoryPool>, sk_sp<GrSurfaceProxy>, GrAuditTrail*);
~GrOpList() override; ~GrOpList() override;
/**
* Copies a pixel rectangle from a proxy into this opLists's target. This call may finalize
* reserved vertex/index data (as though a draw call was made). The src pixels copied are
* specified by srcRect. They are copied to a rect of the same size in this opList's target with
* top left at dstPoint. If the src rect is clipped by the src bounds then pixel values in the
* dst rect corresponding to area clipped by the src rect are not overwritten. This method is
* not guaranteed to succeed depending on the type of surface, configs, etc, and the
* backend-specific limitations.
*/
virtual bool copySurface(GrRecordingContext*, virtual bool copySurface(GrRecordingContext*,
GrSurfaceProxy* dst,
GrSurfaceProxy* src, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) = 0; const SkIPoint& dstPoint) = 0;

View File

@ -585,12 +585,11 @@ bool GrRenderTargetOpList::resetForFullscreenClear(CanDiscardPreviousOps canDisc
// This closely parallels GrTextureOpList::copySurface but renderTargetOpLists // This closely parallels GrTextureOpList::copySurface but renderTargetOpLists
// also store the applied clip and dest proxy with the op // also store the applied clip and dest proxy with the op
bool GrRenderTargetOpList::copySurface(GrRecordingContext* context, bool GrRenderTargetOpList::copySurface(GrRecordingContext* context,
GrSurfaceProxy* dst,
GrSurfaceProxy* src, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) { const SkIPoint& dstPoint) {
SkASSERT(dst->asRenderTargetProxy() == fTarget.get()); std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(
std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(context, dst, src, srcRect, dstPoint); context, fTarget.get(), src, srcRect, dstPoint);
if (!op) { if (!op) {
return false; return false;
} }

View File

@ -94,18 +94,7 @@ public:
void discard(); void discard();
/**
* Copies a pixel rectangle from one surface to another. This call may finalize
* reserved vertex/index data (as though a draw call was made). The src pixels
* copied are specified by srcRect. They are copied to a rect of the same
* size in dst with top left at dstPoint. If the src rect is clipped by the
* src bounds then pixel values in the dst rect corresponding to area clipped
* by the src rect are not overwritten. This method is not guaranteed to succeed
* depending on the type of surface, configs, etc, and the backend-specific
* limitations.
*/
bool copySurface(GrRecordingContext*, bool copySurface(GrRecordingContext*,
GrSurfaceProxy* dst,
GrSurfaceProxy* src, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) override; const SkIPoint& dstPoint) override;

View File

@ -417,13 +417,11 @@ bool GrSurfaceContext::copy(GrSurfaceProxy* src, const SkIRect& srcRect, const S
caps->makeConfigSpecific(this->asSurfaceProxy()->config(), caps->makeConfigSpecific(this->asSurfaceProxy()->config(),
this->asSurfaceProxy()->backendFormat())); this->asSurfaceProxy()->backendFormat()));
GrSurfaceProxy* dst = this->asSurfaceProxy(); if (!caps->canCopySurface(this->asSurfaceProxy(), src, srcRect, dstPoint)) {
if (!caps->canCopySurface(dst, src, srcRect, dstPoint)) {
return false; return false;
} }
return this->getOpList()->copySurface(fContext, dst, src, srcRect, dstPoint); return this->getOpList()->copySurface(fContext, src, srcRect, dstPoint);
} }
sk_sp<GrRenderTargetContext> GrSurfaceContext::rescale(const SkImageInfo& info, sk_sp<GrRenderTargetContext> GrSurfaceContext::rescale(const SkImageInfo& info,

View File

@ -151,13 +151,11 @@ void GrTextureOpList::endFlush() {
// This closely parallels GrRenderTargetOpList::copySurface but renderTargetOpList // This closely parallels GrRenderTargetOpList::copySurface but renderTargetOpList
// stores extra data with the op // stores extra data with the op
bool GrTextureOpList::copySurface(GrRecordingContext* context, bool GrTextureOpList::copySurface(GrRecordingContext* context,
GrSurfaceProxy* dst,
GrSurfaceProxy* src, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) { const SkIPoint& dstPoint) {
SkASSERT(dst == fTarget.get()); std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(
context, fTarget.get(), src, srcRect, dstPoint);
std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(context, dst, src, srcRect, dstPoint);
if (!op) { if (!op) {
return false; return false;
} }

View File

@ -38,18 +38,7 @@ public:
void onPrepare(GrOpFlushState* flushState) override; void onPrepare(GrOpFlushState* flushState) override;
bool onExecute(GrOpFlushState* flushState) override; bool onExecute(GrOpFlushState* flushState) override;
/**
* Copies a pixel rectangle from one surface to another. This call may finalize
* reserved vertex/index data (as though a draw call was made). The src pixels
* copied are specified by srcRect. They are copied to a rect of the same
* size in dst with top left at dstPoint. If the src rect is clipped by the
* src bounds then pixel values in the dst rect corresponding to area clipped
* by the src rect are not overwritten. This method is not guaranteed to succeed
* depending on the type of surface, configs, etc, and the backend-specific
* limitations.
*/
bool copySurface(GrRecordingContext*, bool copySurface(GrRecordingContext*,
GrSurfaceProxy* dst,
GrSurfaceProxy* src, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) override; const SkIPoint& dstPoint) override;