• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2013 Google Inc.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 #ifndef GrTest_DEFINED
10 #define GrTest_DEFINED
11 
12 #include "GrContext.h"
13 #include "GrDrawTarget.h"
14 #include "gl/GrGLContext.h"
15 
16 namespace GrTest {
17     /**
18      * Forces the GrContext to use a small atlas which only has room for one plot and will thus
19      * constantly be evicting entries
20      */
21     void SetupAlwaysEvictAtlas(GrContext*);
22 };
23 
24 /** TODO Please do not use this if you can avoid it.  We are in the process of deleting it.
25     Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
26     should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
27     GrContext. In the future this object may provide some guards to prevent this. */
28 class GrTestTarget {
29 public:
GrTestTarget()30     GrTestTarget() {};
31 
32     void init(GrContext*, GrDrawTarget*, GrRenderTarget*);
33 
target()34     GrDrawTarget* target() { return fDrawTarget.get(); }
resourceProvider()35     GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
36 
37 private:
38     SkAutoTUnref<GrContext>                 fContext;
39     SkAutoTUnref<GrDrawTarget>              fDrawTarget;
40     SkAutoTUnref<GrRenderTarget>            fRenderTarget;
41 };
42 
43 #endif
44