Revert of Revert of Return GrGLContext from GrTestTarget (patchset #1 id:1 of https://codereview.chromium.org/1211123004/)

Reason for revert:
un-referting, did not help DEPS roll

Original issue's description:
> 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:
>
> Committed: https://skia.googlesource.com/skia/+/1852ec2b46a2a0efbb3550ff4d8b640f56a810e9

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

Review URL: https://codereview.chromium.org/1215593002
This commit is contained in:
reed 2015-06-25 21:29:25 -07:00 committed by Commit bot
parent e1b8958877
commit f9ad558943
8 changed files with 19 additions and 20 deletions

View File

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

View File

@ -17,7 +17,7 @@
class GrBatchTracker;
class GrContext;
struct GrGLInterface;
class GrGLContext;
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 GrGLInterface* glInterfaceForTesting() const { return NULL; }
virtual const GrGLContext* glContextForTesting() const { return NULL; }
protected:
// Functions used to map clip-respecting stencil tests into normal

View File

@ -11,15 +11,14 @@
#include "GrGpuResourceCacheAccess.h"
#include "GrInOrderDrawBuffer.h"
#include "GrResourceCache.h"
#include "gl/GrGLInterface.h"
#include "SkString.h"
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterface* gl) {
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext* gl) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
fDrawTarget.reset(SkRef(target));
fGLInterface.reset(SkSafeRef(gl));
fGLContext.reset(SkRef(gl));
}
void GrContext::getTestTarget(GrTestTarget* tar) {
@ -28,7 +27,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->glInterfaceForTesting());
tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting());
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -11,26 +11,26 @@
#include "GrContext.h"
#include "GrDrawTarget.h"
#include "gl/GrGLInterface.h"
#include "gl/GrGLContext.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() {};
GrTestTarget() : fGLContext(NULL) {};
void init(GrContext*, GrDrawTarget*, const GrGLInterface*);
void init(GrContext*, GrDrawTarget*, const GrGLContext*);
GrDrawTarget* target() { return fDrawTarget.get(); }
/** Returns a GrGLInterface if the GrContext is backed by OpenGL. */
const GrGLInterface* glInterface() { return fGLInterface.get(); }
/** Returns a GrGLContext if the GrContext is backed by OpenGL. */
const GrGLContext* glContext() { return fGLContext; }
private:
SkAutoTUnref<GrDrawTarget> fDrawTarget;
SkAutoTUnref<GrContext> fContext;
SkAutoTUnref<const GrGLInterface> fGLInterface;
SkAutoTUnref<const GrGLContext> fGLContext;
};
#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 SkNoncopyable {
class GrGLContextInfo : public SkRefCnt {
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;
virtual const GrGLInterface* glInterfaceForTesting() const {
return this->glInterface();
const GrGLContext* glContextForTesting() const override {
return &this->glContext();
}
private:
@ -300,7 +300,7 @@ private:
void unbindTextureFromFBO(GrGLenum fboTarget);
SkAutoTDelete<GrGLContext> fGLContext;
SkAutoTUnref<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.glInterface();
const GrGLInterface* gl = tt.glContext()->interface();
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.glInterface();
const GrGLInterface* gl = tt.glContext()->interface();
if (!gl) {
return;
}