Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: gm/gmmain.cpp

Issue 23567032: Have GMs read the GrContext via a setter/getter rather than a global. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: use Brian's suggestion Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/gm.cpp ('k') | gm/image.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gmmain.cpp
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 018dfe6cedb4678bb6b9c0c534bdc6533fa879ed..493962405526226a4aab85d96f4ba1936e244471 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1464,48 +1464,6 @@ static const PDFRasterizerData* findPDFRasterizer(const char rasterizer[]) {
return NULL;
}
-namespace skiagm {
-#if SK_SUPPORT_GPU
-SkAutoTUnref<GrContext> gGrContext;
-/**
- * Sets the global GrContext, accessible by individual GMs
- */
-static void SetGr(GrContext* grContext) {
- SkSafeRef(grContext);
- gGrContext.reset(grContext);
-}
-
-/**
- * Gets the global GrContext, can be called by GM tests.
- */
-GrContext* GetGr();
-GrContext* GetGr() {
- return gGrContext.get();
-}
-
-/**
- * Sets the global GrContext and then resets it to its previous value at
- * destruction.
- */
-class AutoResetGr : SkNoncopyable {
-public:
- AutoResetGr() : fOld(NULL) {}
- void set(GrContext* context) {
- SkASSERT(NULL == fOld);
- fOld = GetGr();
- SkSafeRef(fOld);
- SetGr(context);
- }
- ~AutoResetGr() { SetGr(fOld); SkSafeUnref(fOld); }
-private:
- GrContext* fOld;
-};
-#else
-GrContext* GetGr();
-GrContext* GetGr() { return NULL; }
-#endif
-}
-
template <typename T> void appendUnique(SkTDArray<T>* array, const T& value) {
int index = array->find(value);
if (index < 0) {
@@ -1573,7 +1531,6 @@ ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
GrSurface* gpuTarget = NULL;
#if SK_SUPPORT_GPU
SkAutoTUnref<GrSurface> auGpuTarget;
- AutoResetGr autogr;
if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend)) {
GrContext* gr = grFactory->get(config.fGLContextType);
bool grSuccess = false;
@@ -1589,7 +1546,6 @@ ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
if (NULL != auGpuTarget) {
gpuTarget = auGpuTarget;
grSuccess = true;
- autogr.set(gr);
// Set the user specified cache limits if non-default.
size_t bytes;
int count;
« no previous file with comments | « gm/gm.cpp ('k') | gm/image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698