michael@0: michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #include "GrTest.h" michael@0: michael@0: #include "GrGpu.h" michael@0: #include "GrResourceCache.h" michael@0: michael@0: void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { michael@0: SkASSERT(!fContext); michael@0: michael@0: fContext.reset(SkRef(ctx)); michael@0: fDrawTarget.reset(SkRef(target)); michael@0: michael@0: SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget::kReset_ASRInit)); michael@0: SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target)); michael@0: SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target)); michael@0: } michael@0: michael@0: void GrContext::getTestTarget(GrTestTarget* tar) { michael@0: this->flush(); michael@0: // We could create a proxy GrDrawTarget that passes through to fGpu until ~GrTextTarget() and michael@0: // then disconnects. This would help prevent test writers from mixing using the returned michael@0: // GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods michael@0: // until ~GrTestTarget(). michael@0: tar->init(this, fGpu); michael@0: } michael@0: michael@0: /////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) { michael@0: fMaxTextureSizeOverride = maxTextureSizeOverride; michael@0: } michael@0: michael@0: void GrContext::purgeAllUnlockedResources() { michael@0: fTextureCache->purgeAllUnlocked(); michael@0: }