blob: 75eb53ac64123b668e1af8f1c72a5c7093af39c1 [file] [log] [blame]
commit-bot@chromium.org78a10782013-08-21 19:27:48 +00001
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"
reedf9ad5582015-06-25 21:29:25 -070014#include "gl/GrGLContext.h"
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000015
joshualitt7f9c9eb2015-08-21 11:08:00 -070016namespace 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
joshualitt04194f32016-01-13 10:08:27 -080024/** 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.org78a10782013-08-21 19:27:48 +000026 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. */
28class GrTestTarget {
29public:
jvanverth672bb7f2015-07-13 07:19:57 -070030 GrTestTarget() {};
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000031
robertphillips0dfa62c2015-11-16 06:23:31 -080032 void init(GrContext*, GrDrawTarget*, GrRenderTarget*);
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000033
34 GrDrawTarget* target() { return fDrawTarget.get(); }
bsalomon0aff2fa2015-07-31 06:48:27 -070035 GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000036
37private:
egdaniel1d512732015-11-13 13:42:55 -080038 SkAutoTUnref<GrContext> fContext;
robertphillips0dfa62c2015-11-16 06:23:31 -080039 SkAutoTUnref<GrDrawTarget> fDrawTarget;
40 SkAutoTUnref<GrRenderTarget> fRenderTarget;
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000041};
42
43#endif