diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-05 20:06:05 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-05 20:06:05 +0000 |
commit | 64cc810ad165724f9c666a75bd52e41c67f13564 (patch) | |
tree | dc05e9b5db78f18c9dcf75f9c62d2d05ea84a66f /src/views/unix | |
parent | acf3ecc7f70567a26f1435b5d3de45b316338b3e (diff) |
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
Diffstat (limited to 'src/views/unix')
-rw-r--r-- | src/views/unix/SkOSWindow_Unix.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
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; } |