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 | |
| 16 | /** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this |
| 17 | should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or |
| 18 | GrContext. In the future this object may provide some guards to prevent this. */ |
| 19 | class GrTestTarget { |
| 20 | public: |
jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame^] | 21 | GrTestTarget() {}; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 22 | |
jvanverth | 672bb7f | 2015-07-13 07:19:57 -0700 | [diff] [blame^] | 23 | void init(GrContext*, GrDrawTarget*); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 24 | |
| 25 | GrDrawTarget* target() { return fDrawTarget.get(); } |
| 26 | |
| 27 | private: |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 28 | SkAutoTUnref<GrDrawTarget> fDrawTarget; |
| 29 | SkAutoTUnref<GrContext> fContext; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | #endif |