| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrTest_DEFINED |
| 9 | #define GrTest_DEFINED |
| 10 | |
| 11 | #include "GrContext.h" |
| 12 | #include "GrDrawTarget.h" |
| reed | f9ad558 | 2015-06-25 21:29:25 -0700 | [diff] [blame] | 13 | #include "gl/GrGLContext.h" |
| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 14 | |
| joshualitt | 7f9c9eb | 2015-08-21 11:08:00 -0700 | [diff] [blame] | 15 | namespace GrTest { |
| 16 | /** |
| 17 | * Forces the GrContext to use a small atlas which only has room for one plot and will thus |
| 18 | * constantly be evicting entries |
| 19 | */ |
| 20 | void SetupAlwaysEvictAtlas(GrContext*); |
| 21 | }; |
| 22 | |
| joshualitt | 04194f3 | 2016-01-13 10:08:27 -0800 | [diff] [blame] | 23 | /** TODO Please do not use this if you can avoid it. We are in the process of deleting it. |
| 24 | 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] | 25 | should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or |
| 26 | GrContext. In the future this object may provide some guards to prevent this. */ |
| 27 | class GrTestTarget { |
| 28 | public: |
| jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame] | 29 | GrTestTarget() {}; |
| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 30 | |
| robertphillips | 0dfa62c | 2015-11-16 06:23:31 -0800 | [diff] [blame] | 31 | void init(GrContext*, GrDrawTarget*, GrRenderTarget*); |
| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 32 | |
| 33 | GrDrawTarget* target() { return fDrawTarget.get(); } |
| bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 34 | GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); } |
| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 35 | |
| 36 | private: |
| egdaniel | 1d51273 | 2015-11-13 13:42:55 -0800 | [diff] [blame] | 37 | SkAutoTUnref<GrContext> fContext; |
| robertphillips | 0dfa62c | 2015-11-16 06:23:31 -0800 | [diff] [blame] | 38 | SkAutoTUnref<GrDrawTarget> fDrawTarget; |
| 39 | SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | #endif |