mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 16:25:59 +01:00
fixup LS scaling impl
This commit is contained in:
parent
3d83a0bc5f
commit
ef12120270
3 changed files with 19 additions and 8 deletions
|
@ -247,9 +247,8 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||
(int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width,
|
||||
(int)layersurface->layerSurface->surface->current.height};
|
||||
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
||||
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->current.actual_width, (int)layersurface->layerSurface->current.actual_height};
|
||||
// layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
||||
}
|
||||
|
||||
void Events::listener_commitLayerSurface(void* owner, void* data) {
|
||||
|
@ -311,8 +310,8 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
|
|||
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
|
||||
|
||||
// update geom if it changed
|
||||
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width,
|
||||
layersurface->layerSurface->surface->current.height};
|
||||
// layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->current.actual_width,
|
||||
// (int)layersurface->layerSurface->current.actual_height};
|
||||
|
||||
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
|
||||
|
||||
|
|
|
@ -39,6 +39,10 @@ class Vector2D {
|
|||
return Vector2D(this->x * a.x, this->y * a.y);
|
||||
}
|
||||
|
||||
Vector2D operator/(const Vector2D& a) const {
|
||||
return Vector2D(this->x / a.x, this->y / a.y);
|
||||
}
|
||||
|
||||
Vector2D clamp(const Vector2D& min, const Vector2D& max = Vector2D());
|
||||
|
||||
Vector2D floor();
|
||||
|
|
|
@ -356,8 +356,8 @@ void CHyprRenderer::renderLayer(SLayerSurface* pLayer, CMonitor* pMonitor, times
|
|||
renderdata.blur = pLayer->forceBlur;
|
||||
renderdata.surface = pLayer->layerSurface->surface;
|
||||
renderdata.decorate = false;
|
||||
renderdata.w = pLayer->layerSurface->surface->current.width;
|
||||
renderdata.h = pLayer->layerSurface->surface->current.height;
|
||||
renderdata.w = pLayer->geometry.width;
|
||||
renderdata.h = pLayer->geometry.height;
|
||||
renderdata.blockBlurOptimization = pLayer->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM || pLayer->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND;
|
||||
wlr_surface_for_each_surface(pLayer->layerSurface->surface, renderSurface, &renderdata);
|
||||
|
||||
|
@ -550,7 +550,7 @@ void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurfac
|
|||
|
||||
Vector2D bufferSize = Vector2D(pSurface->buffer->texture->width, pSurface->buffer->texture->height);
|
||||
|
||||
// calculate UV for the basic src_box. Assume dest == size. TODO: don't.
|
||||
// calculate UV for the basic src_box. Assume dest == size. Scale to dest later
|
||||
uvTL = Vector2D(bufferSource.x / bufferSize.x, bufferSource.y / bufferSize.y);
|
||||
uvBR = Vector2D((bufferSource.x + bufferSource.width) / bufferSize.x, (bufferSource.y + bufferSource.height) / bufferSize.y);
|
||||
|
||||
|
@ -560,6 +560,14 @@ void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurfac
|
|||
}
|
||||
}
|
||||
|
||||
const auto DESTVP = Vector2D{pSurface->current.viewport.dst_width, pSurface->current.viewport.dst_height};
|
||||
|
||||
if (DESTVP != Vector2D{} && !pWindow /* Layersurface. TODO: is this correct? */) {
|
||||
const auto DESTSCALE = DESTVP / Vector2D(pSurface->buffer->texture->width, pSurface->buffer->texture->height);
|
||||
uvTL = uvTL * DESTSCALE;
|
||||
uvBR = uvBR * DESTSCALE;
|
||||
}
|
||||
|
||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = uvTL;
|
||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight = uvBR;
|
||||
|
||||
|
|
Loading…
Reference in a new issue