From 64cc810ad165724f9c666a75bd52e41c67f13564 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Tue, 5 Mar 2013 20:06:05 +0000 Subject: Make SkOSWindow return the sample count and stencil bit count for its GL context. Review URL: https://codereview.chromium.org/12437010 git-svn-id: http://skia.googlecode.com/svn/trunk@7995 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/views/unix/SkOSWindow_Unix.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/views/unix') diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp index 7da04bdc7c..f6e32e42f2 100644 --- a/src/views/unix/SkOSWindow_Unix.cpp +++ b/src/views/unix/SkOSWindow_Unix.cpp @@ -37,7 +37,7 @@ SkOSWindow::SkOSWindow(void* unused) , fMSAASampleCount(0) { fUnixWindow.fDisplay = NULL; fUnixWindow.fGLContext = NULL; - this->initWindow(0); + this->initWindow(0, NULL); this->resize(WIDTH, HEIGHT); } @@ -59,12 +59,21 @@ void SkOSWindow::closeWindow() { } } -void SkOSWindow::initWindow(int requestedMSAASampleCount) { +void SkOSWindow::initWindow(int requestedMSAASampleCount, AttachmentInfo* info) { if (fMSAASampleCount != requestedMSAASampleCount) { this->closeWindow(); } // presence of fDisplay means we already have a window if (NULL != fUnixWindow.fDisplay) { + if (NULL != info) { + if (NULL != fVi) { + glXGetConfig(fUnixWindow.fDisplay, fVi, GLX_SAMPLES_ARB, &info->fSampleCount); + glXGetConfig(fUnixWindow.fDisplay, fVi, GLX_STENCIL_SIZE, &info->fStencilBits); + } else { + info->fSampleCount = 0; + info->fStencilBits = 0; + } + } return; } fUnixWindow.fDisplay = XOpenDisplay(NULL); @@ -101,6 +110,10 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount) { } if (fVi) { + if (NULL != info) { + glXGetConfig(dsp, fVi, GLX_SAMPLES_ARB, &info->fSampleCount); + glXGetConfig(dsp, fVi, GLX_STENCIL_SIZE, &info->fStencilBits); + } Colormap colorMap = XCreateColormap(dsp, RootWindow(dsp, fVi->screen), fVi->visual, @@ -119,6 +132,10 @@ void SkOSWindow::initWindow(int requestedMSAASampleCount) { CWEventMask | CWColormap, &swa); } else { + if (NULL != info) { + info->fSampleCount = 0; + info->fStencilBits = 0; + } // Create a simple window instead. We will not be able to show GL fUnixWindow.fWin = XCreateSimpleWindow(dsp, DefaultRootWindow(dsp), @@ -250,8 +267,9 @@ void SkOSWindow::mapWindowAndWait() { } -bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int msaaSampleCount) { - this->initWindow(msaaSampleCount); +bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* info) { + this->initWindow(msaaSampleCount, info); + if (NULL == fUnixWindow.fDisplay) { return false; } -- cgit v1.2.3