1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/GrTest.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 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 +#ifndef GrTest_DEFINED 1.13 +#define GrTest_DEFINED 1.14 + 1.15 +#include "GrContext.h" 1.16 +#include "GrDrawTarget.h" 1.17 + 1.18 +/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this 1.19 + should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or 1.20 + GrContext. In the future this object may provide some guards to prevent this. */ 1.21 +class GrTestTarget { 1.22 +public: 1.23 + GrTestTarget() {}; 1.24 + 1.25 + void init(GrContext*, GrDrawTarget*); 1.26 + 1.27 + GrDrawTarget* target() { return fDrawTarget.get(); } 1.28 + 1.29 +private: 1.30 + SkTLazy<GrDrawTarget::AutoStateRestore> fASR; 1.31 + SkTLazy<GrDrawTarget::AutoClipRestore> fACR; 1.32 + SkTLazy<GrDrawTarget::AutoGeometryPush> fAGP; 1.33 + 1.34 + SkAutoTUnref<GrDrawTarget> fDrawTarget; 1.35 + SkAutoTUnref<GrContext> fContext; 1.36 +}; 1.37 + 1.38 +#endif