aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-06-25 21:29:25 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-25 21:29:25 -0700
commitf9ad558943ee14bdff824ebfb33988bece8ed3db (patch)
tree869701a9a9798dc74ccc51e2a14a131d33be7c9e
parente1b8958877a512bf83cbc2c72bb31e7d71b06f43 (diff)
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
-rw-r--r--gm/imagefromyuvtextures.cpp4
-rw-r--r--src/gpu/GrGpu.h4
-rw-r--r--src/gpu/GrTest.cpp7
-rw-r--r--src/gpu/GrTest.h12
-rw-r--r--src/gpu/gl/GrGLContext.h2
-rw-r--r--src/gpu/gl/GrGLGpu.h6
-rw-r--r--tests/ResourceCacheTest.cpp2
-rw-r--r--tests/SurfaceTest.cpp2
8 files changed, 19 insertions, 20 deletions
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index b618abe2a4..b39a4dceab 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -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;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 3bb84a4485..8d449b7606 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -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
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 470bc5873e..3e1ef6c3d9 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -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());
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrTest.h b/src/gpu/GrTest.h
index f1f3cf6c14..7e2ffed540 100644
--- a/src/gpu/GrTest.h
+++ b/src/gpu/GrTest.h
@@ -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
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index f86007a217..6016f6859a 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -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; }
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 98d0ffcd33..4872db7309 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -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();
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index f0e7bfa284..6f1d40450c 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -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;
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index cfaa669262..c45e94e883 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -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;
}