blob: 297f51c11369e163be15a4d61a3dd1c887ec7f2c [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
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000024/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
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. */
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