Merge viewer-cougar

master
Ansariel 2018-11-14 19:44:40 +01:00
commit fcb454cbd7
13 changed files with 57 additions and 19 deletions

View File

@ -3292,7 +3292,8 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
menu->arrangeAndClear();
LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x/dev_scale_factor, mouse_y/dev_scale_factor);
const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect();

View File

@ -263,9 +263,10 @@ void LLUI::dirtyRect(LLRect rect)
//static
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
S32 screen_x, screen_y;
screen_x = ll_round((F32)x * getScaleFactor().mV[VX]);
screen_y = ll_round((F32)y * getScaleFactor().mV[VY]);
screen_x = ll_round(((F32)x * getScaleFactor().mV[VX]) / dev_scale_factor);
screen_y = ll_round(((F32)y * getScaleFactor().mV[VY]) / dev_scale_factor);
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
@ -274,10 +275,11 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
{
LLCoordWindow cursor_pos_window;
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
getWindow()->getCursorPosition(&cursor_pos_window);
LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
*x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
*x = ll_round(((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]) * dev_scale_factor);
*y = ll_round(((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]) * dev_scale_factor);
}
//static

View File

@ -167,6 +167,9 @@ attributedStringInfo getSegments(NSAttributedString *str)
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification
object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification
object:[self window]];
NSRect wnd_rect = [[self window] frame];
@ -206,6 +209,11 @@ attributedStringInfo getSegments(NSAttributedString *str)
mModifiers = [NSEvent modifierFlags];
}
-(void)windowDidChangeScreen:(NSNotification *)notification;
{
callWindowDidChangeScreen();
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -180,6 +180,11 @@ BOOL LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor,
return FALSE;
}
BOOL LLWindowCallbacks::handleWindowDidChangeScreen(LLWindow *window)
{
return FALSE;
}
void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
{

View File

@ -66,6 +66,7 @@ public:
virtual BOOL handleTimerEvent(LLWindow *window);
virtual BOOL handleDeviceChange(LLWindow *window);
virtual BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
virtual BOOL handleWindowDidChangeScreen(LLWindow *window);
enum DragNDropAction {
DNDA_START_TRACKING = 0,// Start tracking an incoming drag

View File

@ -148,6 +148,7 @@ void callWindowFocus();
void callWindowUnfocus();
void callWindowHide();
void callWindowUnhide();
void callWindowDidChangeScreen();
void callDeltaUpdate(float *delta, unsigned int mask);
void callMiddleMouseDown(float *pos, unsigned int mask);
void callMiddleMouseUp(float *pos, unsigned int mask);

View File

@ -409,6 +409,14 @@ void callWindowUnhide()
}
}
void callWindowDidChangeScreen()
{
if ( gWindowImplementation && gWindowImplementation->getCallbacks() )
{
gWindowImplementation->getCallbacks()->handleWindowDidChangeScreen(gWindowImplementation);
}
}
void callDeltaUpdate(float *delta, MASK mask)
{
gWindowImplementation->updateMouseDeltas(delta);
@ -1328,9 +1336,8 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to)
convertScreenToWindow(mWindow, mouse_point);
float scale_factor = getDeviceScaleFactor();
to->mX = mouse_point[0] * scale_factor;
to->mY = mouse_point[1] * scale_factor;
to->mX = mouse_point[0];
to->mY = mouse_point[1];
return TRUE;
}
@ -1348,9 +1355,8 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to)
convertWindowToScreen(mWindow, mouse_point);
float scale_factor = getDeviceScaleFactor();
to->mX = mouse_point[0] / scale_factor;
to->mY = mouse_point[1] / scale_factor;
to->mX = mouse_point[0];
to->mY = mouse_point[1];
return TRUE;
}

View File

@ -1687,6 +1687,14 @@ BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32
}
}
BOOL LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window)
{
LLCoordScreen window_rect;
mWindow->getSize(&window_rect);
reshape(window_rect.mX, window_rect.mY);
return TRUE;
}
void LLViewerWindow::handlePingWatchdog(LLWindow *window, const char * msg)
{
LLAppViewer::instance()->pingMainloopTimeout(msg);
@ -3477,12 +3485,12 @@ void LLViewerWindow::moveCursorToCenter()
S32 x = getWorldViewWidthScaled() / 2;
S32 y = getWorldViewHeightScaled() / 2;
LLUI::setMousePositionScreen(x, y);
//on a forced move, all deltas get zeroed out to prevent jumping
mCurrentMousePoint.set(x,y);
mLastMousePoint.set(x,y);
mCurrentMouseDelta.set(0,0);
LLUI::setMousePositionScreen(x, y);
mCurrentMouseDelta.set(0,0);
}
}

View File

@ -213,6 +213,7 @@ public:
/*virtual*/ BOOL handleTimerEvent(LLWindow *window);
/*virtual*/ BOOL handleDeviceChange(LLWindow *window);
/*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
/*virtual*/ BOOL handleWindowDidChangeScreen(LLWindow *window);
/*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg);
/*virtual*/ void handlePauseWatchdog(LLWindow *window);

View File

@ -4690,7 +4690,10 @@ static LLTrace::BlockTimerStatHandle FTM_REGISTER_FACE("Register Face");
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
{
LL_RECORD_BLOCK_TIME(FTM_REGISTER_FACE);
if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT))
if ( type == LLRenderPass::PASS_ALPHA
&& facep->getTextureEntry()->getMaterialParams().notNull()
&& !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)
&& LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1)
{
LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
}

View File

@ -281,6 +281,5 @@ bool LLWeb::useExternalBrowser(const std::string &url)
boost::match_results<std::string::const_iterator> matches;
return boost::regex_search(url, matches, pattern);
}
//return false; //<FS:LO> Fix unreachable code
#endif
}

View File

@ -1051,8 +1051,8 @@ void LLWorldMapView::drawFrustum()
// Compute the frustum coordinates. Take the UI scale into account.
F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
F32 ctr_x = (getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor;
F32 ctr_y = (getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor;
F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor) * LLUI::getScaleFactor().mV[VX];
F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor) * LLUI::getScaleFactor().mV[VY];
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

View File

@ -2771,9 +2771,12 @@ void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& d
if (scratch_space)
{
GLint bits = 0;
bits |= (source.hasStencil() && dest.hasStencil()) ? GL_STENCIL_BUFFER_BIT : 0;
bits |= GL_DEPTH_BUFFER_BIT;
scratch_space->copyContents(source,
0, 0, source.getWidth(), source.getHeight(),
0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);
0, 0, scratch_space->getWidth(), scratch_space->getHeight(), bits, GL_NEAREST);
}
dest.bindTarget();