diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/src/gpu/GrTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/src/gpu/GrTest.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,35 @@ + +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrTest_DEFINED +#define GrTest_DEFINED + +#include "GrContext.h" +#include "GrDrawTarget.h" + +/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this + should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or + GrContext. In the future this object may provide some guards to prevent this. */ +class GrTestTarget { +public: + GrTestTarget() {}; + + void init(GrContext*, GrDrawTarget*); + + GrDrawTarget* target() { return fDrawTarget.get(); } + +private: + SkTLazy fASR; + SkTLazy fACR; + SkTLazy fAGP; + + SkAutoTUnref fDrawTarget; + SkAutoTUnref fContext; +}; + +#endif