Revert of Return GrGLContext from GrTestTarget (patchset #3 id:40001 of https://codereview.chromium.org/1207393002/)

Reason for revert:
speculative revert to unblock DEPS roll (layout-tests)

Original issue's description:
> Return GrGLContext from GrTestTarget
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b6d93ea428ca5d13641c35faca7d0380980a3a17

TBR=bsalomon@google.com,joshualitt@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1211123004
This commit is contained in:
reed 2015-06-25 18:59:32 -07:00 committed by Commit bot
parent ca10953d9c
commit 1852ec2b46
8 changed files with 20 additions and 19 deletions

View File

@ -105,7 +105,7 @@ protected:
}
// We currently hav only implemented the texture uploads for GL.
const GrGLInterface* gl = tt.glContext()->interface();
const GrGLInterface* gl = tt.glInterface();
if (!gl) {
return;
}
@ -139,7 +139,7 @@ protected:
return;
}
const GrGLInterface* gl = tt.glContext()->interface();
const GrGLInterface* gl = tt.glInterface();
if (!gl) {
return;
}

View File

@ -17,7 +17,7 @@
class GrBatchTracker;
class GrContext;
class GrGLContext;
struct GrGLInterface;
class GrIndexBuffer;
class GrNonInstancedVertices;
class GrPath;
@ -366,7 +366,7 @@ public:
bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
// This is only to be used in tests.
virtual const GrGLContext* glContextForTesting() const { return NULL; }
virtual const GrGLInterface* glInterfaceForTesting() const { return NULL; }
protected:
// Functions used to map clip-respecting stencil tests into normal

View File

@ -11,14 +11,15 @@
#include "GrGpuResourceCacheAccess.h"
#include "GrInOrderDrawBuffer.h"
#include "GrResourceCache.h"
#include "gl/GrGLInterface.h"
#include "SkString.h"
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext* gl) {
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterface* gl) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
fDrawTarget.reset(SkRef(target));
fGLContext.reset(SkRef(gl));
fGLInterface.reset(SkSafeRef(gl));
}
void GrContext::getTestTarget(GrTestTarget* tar) {
@ -27,7 +28,7 @@ void GrContext::getTestTarget(GrTestTarget* tar) {
// then disconnects. This would help prevent test writers from mixing using the returned
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
// until ~GrTestTarget().
tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting());
tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glInterfaceForTesting());
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -11,26 +11,26 @@
#include "GrContext.h"
#include "GrDrawTarget.h"
#include "gl/GrGLContext.h"
#include "gl/GrGLInterface.h"
/** 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:
GrTestTarget() : fGLContext(NULL) {};
GrTestTarget() {};
void init(GrContext*, GrDrawTarget*, const GrGLContext*);
void init(GrContext*, GrDrawTarget*, const GrGLInterface*);
GrDrawTarget* target() { return fDrawTarget.get(); }
/** Returns a GrGLContext if the GrContext is backed by OpenGL. */
const GrGLContext* glContext() { return fGLContext; }
/** Returns a GrGLInterface if the GrContext is backed by OpenGL. */
const GrGLInterface* glInterface() { return fGLInterface.get(); }
private:
SkAutoTUnref<GrDrawTarget> fDrawTarget;
SkAutoTUnref<GrContext> fContext;
SkAutoTUnref<const GrGLContext> fGLContext;
SkAutoTUnref<const GrGLInterface> fGLInterface;
};
#endif

View File

@ -20,7 +20,7 @@ struct GrContextOptions;
* Encapsulates information about an OpenGL context including the OpenGL
* version, the GrGLStandard type of the context, and GLSL version.
*/
class GrGLContextInfo : public SkRefCnt {
class GrGLContextInfo : public SkNoncopyable {
public:
GrGLStandard standard() const { return fInterface->fStandard; }
GrGLVersion version() const { return fGLVersion; }

View File

@ -109,8 +109,8 @@ public:
const GrPipeline&,
const GrBatchTracker&) const override;
const GrGLContext* glContextForTesting() const override {
return &this->glContext();
virtual const GrGLInterface* glInterfaceForTesting() const {
return this->glInterface();
}
private:
@ -300,7 +300,7 @@ private:
void unbindTextureFromFBO(GrGLenum fboTarget);
SkAutoTUnref<GrGLContext> fGLContext;
SkAutoTDelete<GrGLContext> fGLContext;
void createCopyProgram();

View File

@ -181,7 +181,7 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
GrTestTarget tt;
context->getTestTarget(&tt);
const GrGLInterface* gl = tt.glContext()->interface();
const GrGLInterface* gl = tt.glInterface();
if (!gl) {
return;
}

View File

@ -115,7 +115,7 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
}
// We currently have only implemented the texture uploads for GL.
const GrGLInterface* gl = tt.glContext()->interface();
const GrGLInterface* gl = tt.glInterface();
if (!gl) {
return;
}