Chromium Code Reviews| Index: include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| diff --git a/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h b/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8be64c69060ee8a6cfc4cd56b70689662a0cd7fe |
| --- /dev/null |
| +++ b/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| @@ -0,0 +1,66 @@ |
| + |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| +#ifndef SKCOMMANDBUFFERGLCONTEXT_DEFINED |
| +#define SKCOMMANDBUFFERGLCONTEXT_DEFINED |
| + |
| +#if SK_COMMAND_BUFFER |
| + |
| +#include "gl/SkGLContext.h" |
| + |
| +class SkCommandBufferGLContext : public SkGLContext { |
| +public: |
| + ~SkCommandBufferGLContext() override; |
| + |
| + static SkCommandBufferGLContext* Create(GrGLStandard forcedGpuAPI) { |
| + if (kGL_GrGLStandard == forcedGpuAPI) { |
| + return nullptr; |
| + } |
| + SkCommandBufferGLContext* ctx = SkNEW(SkCommandBufferGLContext); |
| + if (!ctx->isValid()) { |
| + SkDELETE(ctx); |
| + return nullptr; |
| + } |
| + return ctx; |
| + } |
| + |
| + static SkCommandBufferGLContext* Create(void* nativeWindow, int msaaSampleCount) { |
| + SkCommandBufferGLContext* ctx = SkNEW_ARGS(SkCommandBufferGLContext, |
|
bsalomon
2015/08/27 13:47:13
can just use plain old new. (We're expunging the m
hendrikw
2015/08/27 14:41:57
Ah, great, I wasn't a big fan of these macros :D
|
| + (nativeWindow, msaaSampleCount)); |
| + if (!ctx->isValid()) { |
| + SkDELETE(ctx); |
|
bsalomon
2015/08/27 13:47:13
delete
hendrikw
2015/08/27 14:41:58
Done.
|
| + return nullptr; |
| + } |
| + return ctx; |
| + } |
| + |
| + void presentCommandBuffer(); |
| + |
| + bool makeCurrent(); |
| + int getStencilBits(); |
| + int getSampleCount(); |
| + |
| +private: |
| + SkCommandBufferGLContext(); |
| + SkCommandBufferGLContext(void* nativeWindow, int msaaSampleCount); |
| + void initializeGLContext(void* nativeWindow, const int* configAttribs, |
| + const int* surfaceAttribs); |
| + void destroyGLContext(); |
| + |
| + void onPlatformMakeCurrent() const override; |
| + void onPlatformSwapBuffers() const override; |
| + GrGLFuncPtr onPlatformGetProcAddress(const char* name) const override; |
| + |
| + void* fContext; |
| + void* fDisplay; |
| + void* fSurface; |
| + void* fConfig; |
| +}; |
| + |
| +#endif // SK_COMMAND_BUFFER |
| + |
| +#endif |