2016-03-31 01:56:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2016-03-31 17:59:06 +00:00
|
|
|
#include "NullGLTestContext.h"
|
2016-03-31 01:56:19 +00:00
|
|
|
#include "gl/GrGLTestInterface.h"
|
|
|
|
#include "gl/GrGLDefines.h"
|
|
|
|
#include "gl/GrGLInterface.h"
|
|
|
|
#include "gl/GrGLTypes.h"
|
|
|
|
#include "SkMutex.h"
|
|
|
|
#include "SkTDArray.h"
|
|
|
|
|
|
|
|
namespace {
|
2016-03-31 17:59:06 +00:00
|
|
|
class NullGLContext : public sk_gpu_test::GLTestContext {
|
2016-03-31 01:56:19 +00:00
|
|
|
public:
|
2016-04-20 07:36:53 +00:00
|
|
|
NullGLContext(bool enableNVPR) { this->init(GrGLCreateNullInterface(enableNVPR)); }
|
2016-03-31 01:56:19 +00:00
|
|
|
~NullGLContext() override { this->teardown(); }
|
|
|
|
|
2016-04-20 07:36:53 +00:00
|
|
|
private:
|
2016-09-27 13:34:10 +00:00
|
|
|
void onPlatformMakeCurrent() const override {}
|
2016-03-31 01:56:19 +00:00
|
|
|
void onPlatformSwapBuffers() const override {}
|
|
|
|
GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; }
|
|
|
|
};
|
2016-04-01 16:04:35 +00:00
|
|
|
|
2016-03-31 01:56:19 +00:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace sk_gpu_test {
|
2017-02-21 21:58:08 +00:00
|
|
|
GLTestContext* CreateNullGLTestContext(bool enableNVPR, GLTestContext* shareContext) {
|
|
|
|
if (shareContext) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-04-20 07:36:53 +00:00
|
|
|
GLTestContext* ctx = new NullGLContext(enableNVPR);
|
2016-03-31 01:56:19 +00:00
|
|
|
if (ctx->isValid()) {
|
|
|
|
return ctx;
|
|
|
|
}
|
|
|
|
delete ctx;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
} // namespace sk_gpu_test
|
|
|
|
|