Move prepareForExternalIO implementation from GrContext to GrDrawingManager

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324473002

Review-Url: https://codereview.chromium.org/2324473002
This commit is contained in:
bsalomon 2016-09-08 11:28:59 -07:00 committed by Commit bot
parent 9441af52aa
commit 6a2b1941c1
4 changed files with 22 additions and 8 deletions

View File

@ -518,13 +518,7 @@ void GrContext::prepareSurfaceForExternalIO(GrSurface* surface) {
RETURN_IF_ABANDONED
SkASSERT(surface);
ASSERT_OWNED_RESOURCE(surface);
if (surface->surfacePriv().hasPendingIO()) {
this->flush();
}
GrRenderTarget* rt = surface->asRenderTarget();
if (fGpu && rt) {
fGpu->resolveRenderTarget(rt);
}
fDrawingManager->prepareSurfaceForExternalIO(surface);
}
bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,

View File

@ -1115,7 +1115,7 @@ void GrDrawContext::prepareForExternalIO() {
ASSERT_OWNED_RESOURCE(fRenderTarget);
fDrawingManager->getContext()->prepareSurfaceForExternalIO(fRenderTarget.get());
fDrawingManager->prepareSurfaceForExternalIO(fRenderTarget.get());
}
void GrDrawContext::drawNonAAFilledRect(const GrClip& clip,

View File

@ -13,6 +13,7 @@
#include "GrPathRenderingDrawContext.h"
#include "GrResourceProvider.h"
#include "GrSoftwarePathRenderer.h"
#include "GrSurfacePriv.h"
#include "SkSurface_Gpu.h"
#include "SkTTopoSort.h"
@ -135,6 +136,23 @@ void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) {
fFlushing = false;
}
void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) {
if (this->wasAbandoned()) {
return;
}
SkASSERT(surface);
SkASSERT(surface->getContext() == fContext);
if (surface->surfacePriv().hasPendingIO()) {
this->flush();
}
GrRenderTarget* rt = surface->asRenderTarget();
if (fContext->getGpu() && rt) {
fContext->getGpu()->resolveRenderTarget(rt);
}
}
GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
SkASSERT(fContext);

View File

@ -60,6 +60,8 @@ public:
static bool ProgramUnitTest(GrContext* context, int maxStages);
void prepareSurfaceForExternalIO(GrSurface*);
private:
GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets,
bool isImmediateMode, GrSingleOwner* singleOwner)