178a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 278a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org/* 378a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org * Copyright 2013 Google Inc. 478a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org * 578a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be 678a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org * found in the LICENSE file. 778a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org */ 878a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 978a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org#ifndef GrTest_DEFINED 1078a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org#define GrTest_DEFINED 1178a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 1278a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org#include "GrContext.h" 1378a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org#include "GrDrawTarget.h" 1478a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 1578a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this 1678a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or 1778a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org GrContext. In the future this object may provide some guards to prevent this. */ 1878a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.orgclass GrTestTarget { 1978a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.orgpublic: 2078a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org GrTestTarget() {}; 2178a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 2278a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org void init(GrContext*, GrDrawTarget*); 2378a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 2478a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org GrDrawTarget* target() { return fDrawTarget.get(); } 2578a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 2678a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.orgprivate: 2778a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org SkTLazy<GrDrawTarget::AutoStateRestore> fASR; 2878a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org SkTLazy<GrDrawTarget::AutoClipRestore> fACR; 2978a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org SkTLazy<GrDrawTarget::AutoGeometryPush> fAGP; 3078a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 3178a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org SkAutoTUnref<GrDrawTarget> fDrawTarget; 3278a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org SkAutoTUnref<GrContext> fContext; 3378a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org}; 3478a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org 3578a1078f17f4f0ae63415298517262a64f706af6commit-bot@chromium.org#endif 36