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

Unified Diff: tools/viewer/sk_app/win/GLWindowContext_win.cpp

Issue 1990893002: Revert of Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « tools/viewer/sk_app/win/GLWindowContext_win.h ('k') | tools/viewer/sk_app/win/VulkanWindowContext_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/win/GLWindowContext_win.cpp
diff --git a/tools/viewer/sk_app/win/GLWindowContext_win.cpp b/tools/viewer/sk_app/win/GLWindowContext_win.cpp
deleted file mode 100644
index 0694db308ff59736be165d38b6184f0418ebd96a..0000000000000000000000000000000000000000
--- a/tools/viewer/sk_app/win/GLWindowContext_win.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GLWindowContext_win.h"
-
-#include <GL/gl.h>
-
- // windows stuff
-#include "win/SkWGL.h"
-#include "Window_win.h"
-
-namespace sk_app {
-
-// platform-dependent create
-GLWindowContext* GLWindowContext::Create(void* platformData, const DisplayParams& params) {
- GLWindowContext_win* ctx = new GLWindowContext_win(platformData, params);
- if (!ctx->isValid()) {
- delete ctx;
- return nullptr;
- }
- return ctx;
-}
-
-GLWindowContext_win::GLWindowContext_win(void* platformData, const DisplayParams& params)
- : GLWindowContext(platformData, params)
- , fHWND(0)
- , fHGLRC(NULL) {
-
- // any config code here (particularly for msaa)?
-
- this->initializeContext(platformData, params);
-}
-
-GLWindowContext_win::~GLWindowContext_win() {
- this->destroyContext();
-}
-
-void GLWindowContext_win::onInitializeContext(void* platformData, const DisplayParams& params) {
-
- ContextPlatformData_win* winPlatformData =
- reinterpret_cast<ContextPlatformData_win*>(platformData);
-
- if (winPlatformData) {
- fHWND = winPlatformData->fHWnd;
- }
- HDC dc = GetDC(fHWND);
-
- fHGLRC = SkCreateWGLContext(dc, params.fMSAASampleCount, params.fDeepColor,
- kGLPreferCompatibilityProfile_SkWGLContextRequest);
- if (NULL == fHGLRC) {
- return;
- }
-
- if (wglMakeCurrent(dc, fHGLRC)) {
- glClearStencil(0);
- glClearColor(0, 0, 0, 0);
- glStencilMask(0xffffffff);
- glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- // use DescribePixelFormat to get the stencil and color bit depth.
- int pixelFormat = GetPixelFormat(dc);
- PIXELFORMATDESCRIPTOR pfd;
- DescribePixelFormat(dc, pixelFormat, sizeof(pfd), &pfd);
- fStencilBits = pfd.cStencilBits;
- // pfd.cColorBits includes alpha, so it will be 32 in 8/8/8/8 and 10/10/10/2
- fColorBits = pfd.cRedBits + pfd.cGreenBits + pfd.cBlueBits;
-
- // Get sample count if the MSAA WGL extension is present
- SkWGLExtensions extensions;
- if (extensions.hasExtension(dc, "WGL_ARB_multisample")) {
- static const int kSampleCountAttr = SK_WGL_SAMPLES;
- extensions.getPixelFormatAttribiv(dc,
- pixelFormat,
- 0,
- 1,
- &kSampleCountAttr,
- &fSampleCount);
- } else {
- fSampleCount = 0;
- }
-
- RECT rect;
- GetClientRect(fHWND, &rect);
- fWidth = rect.right - rect.left;
- fHeight = rect.bottom - rect.top;
- glViewport(0, 0, fWidth, fHeight);
- }
-}
-
-
-void GLWindowContext_win::onDestroyContext() {
- wglMakeCurrent(wglGetCurrentDC(), NULL);
- wglDeleteContext(fHGLRC);
- fHGLRC = NULL;
-}
-
-
-void GLWindowContext_win::onSwapBuffers() {
- HDC dc = GetDC((HWND)fHWND);
- SwapBuffers(dc);
- ReleaseDC((HWND)fHWND, dc);
-}
-
-
-} //namespace sk_app
« no previous file with comments | « tools/viewer/sk_app/win/GLWindowContext_win.h ('k') | tools/viewer/sk_app/win/VulkanWindowContext_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698