commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 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" |
reed | f9ad558 | 2015-06-25 21:29:25 -0700 | [diff] [blame] | 14 | #include "gl/GrGLContext.h" |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 15 | |
joshualitt | 7f9c9eb | 2015-08-21 11:08:00 -0700 | [diff] [blame] | 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 | |
joshualitt | 04194f3 | 2016-01-13 10:08:27 -0800 | [diff] [blame] | 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 |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 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: |
jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame] | 30 | GrTestTarget() {}; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 31 | |
robertphillips | 0dfa62c | 2015-11-16 06:23:31 -0800 | [diff] [blame] | 32 | void init(GrContext*, GrDrawTarget*, GrRenderTarget*); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 33 | |
| 34 | GrDrawTarget* target() { return fDrawTarget.get(); } |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 35 | GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); } |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 36 | |
| 37 | private: |
egdaniel | 1d51273 | 2015-11-13 13:42:55 -0800 | [diff] [blame] | 38 | SkAutoTUnref<GrContext> fContext; |
robertphillips | 0dfa62c | 2015-11-16 06:23:31 -0800 | [diff] [blame] | 39 | SkAutoTUnref<GrDrawTarget> fDrawTarget; |
| 40 | SkAutoTUnref<GrRenderTarget> fRenderTarget; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | #endif |