Files
angle/util/OSWindow.cpp
Jamie Madill 77a72f6ecf Release Surface when calling makeCurrent with null.
Refactorings to egl::Surface to enable ref-counting were causing
a situation where we could have two Window surfaces alive at the
same time. This would confuse the window procedure logic in
SurfaceD3D. Releasing the surface fixes this issue and conforms
closely to the wording on the spec on when Surfaces should be
deleted. Also add a test for message loops and surfaces.

BUG=475085
BUG=angleproject:963

Change-Id: Icdee3a7db97c9b54d779dabf1e1f82a89fefc546
Reviewed-on: https://chromium-review.googlesource.com/265064
Reviewed-by: Kenneth Russell <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-04-14 20:45:57 +00:00

68 lines
1.0 KiB
C++

//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "OSWindow.h"
OSWindow::OSWindow()
: mWidth(0),
mHeight(0)
{
}
OSWindow::~OSWindow()
{}
int OSWindow::getWidth() const
{
return mWidth;
}
int OSWindow::getHeight() const
{
return mHeight;
}
bool OSWindow::popEvent(Event *event)
{
if (mEvents.size() > 0 && event)
{
*event = mEvents.front();
mEvents.pop_front();
return true;
}
else
{
return false;
}
}
void OSWindow::pushEvent(Event event)
{
switch (event.Type)
{
case Event::EVENT_RESIZED:
mWidth = event.Size.Width;
mHeight = event.Size.Height;
break;
}
mEvents.push_back(event);
}
bool OSWindow::didTestEventFire()
{
Event topEvent;
while (popEvent(&topEvent))
{
if (topEvent.Type == Event::EVENT_TEST)
{
return true;
}
}
return false;
}