2013-08-21 19:27:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrTest_DEFINED
|
|
|
|
#define GrTest_DEFINED
|
|
|
|
|
|
|
|
#include "GrContext.h"
|
|
|
|
#include "GrDrawTarget.h"
|
2015-06-26 04:29:25 +00:00
|
|
|
#include "gl/GrGLContext.h"
|
2013-08-21 19:27:48 +00:00
|
|
|
|
|
|
|
/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
|
|
|
|
should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
|
|
|
|
GrContext. In the future this object may provide some guards to prevent this. */
|
|
|
|
class GrTestTarget {
|
|
|
|
public:
|
2015-07-13 14:19:57 +00:00
|
|
|
GrTestTarget() {};
|
2013-08-21 19:27:48 +00:00
|
|
|
|
2015-07-13 14:19:57 +00:00
|
|
|
void init(GrContext*, GrDrawTarget*);
|
2013-08-21 19:27:48 +00:00
|
|
|
|
|
|
|
GrDrawTarget* target() { return fDrawTarget.get(); }
|
2015-07-31 13:48:27 +00:00
|
|
|
GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
|
2013-08-21 19:27:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkAutoTUnref<GrDrawTarget> fDrawTarget;
|
|
|
|
SkAutoTUnref<GrContext> fContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|