summaryrefslogtreecommitdiffstats
path: root/app/gfx
diff options
context:
space:
mode:
authorvangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 20:05:39 +0000
committervangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 20:05:39 +0000
commit13806e11b81310f1ad147764079c6cad45294af9 (patch)
treefac1cd7d2fc77c427359aff8594321a476761433 /app/gfx
parent6fe1a1310d47287d88e920c5cc54c3c2be3431d5 (diff)
downloadchromium_src-13806e11b81310f1ad147764079c6cad45294af9.zip
chromium_src-13806e11b81310f1ad147764079c6cad45294af9.tar.gz
chromium_src-13806e11b81310f1ad147764079c6cad45294af9.tar.bz2
Reverting checkin in rev 48521 as creating a child window for GL rendering creates more problems than it solves.
Hopefully either we'll find a more elegant solution or the problem will go away with the introduction of ANGLE. This patch is identical to: http://codereview.chromium.org/2644001/show which was checked in and reverted due to a build failure (which I believe was unrelated) Review URL: http://codereview.chromium.org/2721001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r--app/gfx/gl/gl_context_win.cc68
1 files changed, 5 insertions, 63 deletions
diff --git a/app/gfx/gl/gl_context_win.cc b/app/gfx/gl/gl_context_win.cc
index b6bac4d..e481325 100644
--- a/app/gfx/gl/gl_context_win.cc
+++ b/app/gfx/gl/gl_context_win.cc
@@ -20,15 +20,12 @@ namespace gfx {
typedef HGLRC GLContextHandle;
typedef HPBUFFERARB PbufferHandle;
-const wchar_t kNativeViewGLClass[] = L"NativeViewGLWindow";
-
// This class is a wrapper around a GL context that renders directly to a
// window.
class NativeViewGLContext : public GLContext {
public:
explicit NativeViewGLContext(gfx::PluginWindowHandle window)
: window_(window),
- content_window_(NULL),
device_context_(NULL),
context_(NULL) {
DCHECK(window);
@@ -46,10 +43,7 @@ class NativeViewGLContext : public GLContext {
virtual void* GetHandle();
private:
- HWND CreateContentWindow(HWND parent);
-
gfx::PluginWindowHandle window_;
- HWND content_window_;
HDC device_context_;
GLContextHandle context_;
@@ -300,46 +294,9 @@ static bool InitializeOneOff() {
return true;
}
-HWND NativeViewGLContext::CreateContentWindow(HWND parent) {
- WNDCLASS window_class = {0};
- if (!GetClassInfo(GetModuleHandle(0), kNativeViewGLClass, &window_class)) {
- window_class.style = CS_OWNDC;
- window_class.hInstance = GetModuleHandle(0);
- window_class.lpfnWndProc = DefWindowProc;
- window_class.lpszClassName = kNativeViewGLClass;
- if (!RegisterClass(&window_class)) {
- DLOG(ERROR) << "Failed to register window class";
- return 0;
- }
- }
-
- // The content window's size matches the size of the hosting window at
- // creation time. If the size of the hosting window changes, SwapBuffers
- // must be called to resize the content window appropriately.
- RECT rect;
- GetClientRect(window_, &rect);
- HWND content_window = CreateWindow(kNativeViewGLClass, L"NativeViewGLcontent",
- WS_CHILD | WS_VISIBLE | WS_DISABLED,
- 0, 0, rect.right - rect.left, rect.bottom - rect.top, parent, 0,
- GetModuleHandle(0), 0);
-
- if (!content_window)
- UnregisterClass(kNativeViewGLClass, GetModuleHandle(0));
-
- return content_window;
-}
-
bool NativeViewGLContext::Initialize(bool multisampled) {
- // Create a new window to be used by the GL context. The content window is a
- // child of hosting window and renders on top of it. Currently the content
- // window gets resized when SwapBuffers() gets called to match the size of
- // the host.
- content_window_ = CreateContentWindow(window_);
- if (!content_window_)
- return false;
-
// The GL context will render to this window.
- device_context_ = GetDC(content_window_);
+ device_context_ = GetDC(window_);
int pixel_format =
multisampled ? g_multisampled_pixel_format : g_regular_pixel_format;
@@ -377,12 +334,10 @@ void NativeViewGLContext::Destroy() {
context_ = NULL;
}
- if (content_window_ && device_context_) {
- ReleaseDC(content_window_, device_context_);
- ::DestroyWindow(content_window_);
- UnregisterClass(kNativeViewGLClass, GetModuleHandle(0));
- }
- content_window_ = NULL;
+ if (window_ && device_context_)
+ ReleaseDC(window_, device_context_);
+
+ window_ = NULL;
device_context_ = NULL;
}
@@ -409,20 +364,7 @@ bool NativeViewGLContext::IsOffscreen() {
void NativeViewGLContext::SwapBuffers() {
DCHECK(device_context_);
-
::SwapBuffers(device_context_);
-
- // Adjust the size of the content window to always match that of the hosting
- // window.
- RECT host_window_rect;
- GetClientRect(window_, &host_window_rect);
- RECT content_window_rect;
- GetClientRect(content_window_, &content_window_rect);
- if (!EqualRect(&host_window_rect, &content_window_rect)){
- SetWindowPos(content_window_, NULL, 0, 0,
- host_window_rect.right - host_window_rect.left,
- host_window_rect.bottom - host_window_rect.top, 0);
- }
}
gfx::Size NativeViewGLContext::GetSize() {