gfx/skia/trunk/src/gpu/GrTest.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/gpu/GrTest.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2013 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +#include "GrTest.h"
    1.13 +
    1.14 +#include "GrGpu.h"
    1.15 +#include "GrResourceCache.h"
    1.16 +
    1.17 +void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
    1.18 +    SkASSERT(!fContext);
    1.19 +
    1.20 +    fContext.reset(SkRef(ctx));
    1.21 +    fDrawTarget.reset(SkRef(target));
    1.22 +
    1.23 +    SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget::kReset_ASRInit));
    1.24 +    SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target));
    1.25 +    SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target));
    1.26 +}
    1.27 +
    1.28 +void GrContext::getTestTarget(GrTestTarget* tar) {
    1.29 +    this->flush();
    1.30 +    // We could create a proxy GrDrawTarget that passes through to fGpu until ~GrTextTarget() and
    1.31 +    // then disconnects. This would help prevent test writers from mixing using the returned
    1.32 +    // GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
    1.33 +    // until ~GrTestTarget().
    1.34 +    tar->init(this, fGpu);
    1.35 +}
    1.36 +
    1.37 +///////////////////////////////////////////////////////////////////////////////
    1.38 +
    1.39 +void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) {
    1.40 +    fMaxTextureSizeOverride = maxTextureSizeOverride;
    1.41 +}
    1.42 +
    1.43 +void GrContext::purgeAllUnlockedResources() {
    1.44 +    fTextureCache->purgeAllUnlocked();
    1.45 +}

mercurial