blob: 53aaac34e48afc5920d7f16d3a72e9cce182eb78 [file] [log] [blame]
commit-bot@chromium.org78a10782013-08-21 19:27:48 +00001/*
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"
reedf9ad5582015-06-25 21:29:25 -070013#include "gl/GrGLContext.h"
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000014
joshualitt7f9c9eb2015-08-21 11:08:00 -070015namespace 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
joshualitt04194f32016-01-13 10:08:27 -080023/** 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.org78a10782013-08-21 19:27:48 +000025 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. */
27class GrTestTarget {
28public:
jvanverth672bb7f2015-07-13 07:19:57 -070029 GrTestTarget() {};
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000030
robertphillips0dfa62c2015-11-16 06:23:31 -080031 void init(GrContext*, GrDrawTarget*, GrRenderTarget*);
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000032
33 GrDrawTarget* target() { return fDrawTarget.get(); }
bsalomon0aff2fa2015-07-31 06:48:27 -070034 GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000035
36private:
egdaniel1d512732015-11-13 13:42:55 -080037 SkAutoTUnref<GrContext> fContext;
robertphillips0dfa62c2015-11-16 06:23:31 -080038 SkAutoTUnref<GrDrawTarget> fDrawTarget;
39 SkAutoTUnref<GrRenderTarget> fRenderTarget;
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000040};
41
42#endif