helpers: refactor class member vars (#10218)
This commit is contained in:
parent
b8a204c21d
commit
50e1bec85f
63 changed files with 1770 additions and 1769 deletions
|
|
@ -30,7 +30,7 @@ void CRenderPass::simplify() {
|
|||
// if there is live blur, we need to NOT occlude any area where it will be influenced
|
||||
const auto WILLBLUR = std::ranges::any_of(m_vPassElements, [](const auto& el) { return el->element->needsLiveBlur(); });
|
||||
|
||||
CRegion newDamage = damage.copy().intersect(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize});
|
||||
CRegion newDamage = damage.copy().intersect(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_transformedSize});
|
||||
for (auto& el : m_vPassElements | std::views::reverse) {
|
||||
|
||||
if (newDamage.empty() && !el->element->undiscardable()) {
|
||||
|
|
@ -43,7 +43,7 @@ void CRenderPass::simplify() {
|
|||
if (!bb1 || newDamage.empty())
|
||||
continue;
|
||||
|
||||
auto bb = bb1->scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
auto bb = bb1->scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
|
||||
// drop if empty
|
||||
if (CRegion copy = newDamage.copy(); copy.intersect(bb).empty()) {
|
||||
|
|
@ -54,7 +54,7 @@ void CRenderPass::simplify() {
|
|||
auto opaque = el->element->opaqueRegion();
|
||||
|
||||
if (!opaque.empty()) {
|
||||
opaque.scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
opaque.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
|
||||
// if this intersects the liveBlur region, allow live blur to operate correctly.
|
||||
// do not occlude a border near it.
|
||||
|
|
@ -76,7 +76,7 @@ void CRenderPass::simplify() {
|
|||
}
|
||||
|
||||
// expand the region: this area needs to be proper to blur it right.
|
||||
liveBlurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale).expand(oneBlurRadius() * 2.F);
|
||||
liveBlurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).expand(oneBlurRadius() * 2.F);
|
||||
|
||||
if (auto infringement = opaque.copy().intersect(liveBlurRegion); !infringement.empty()) {
|
||||
// eh, this is not the correct solution, but it will do...
|
||||
|
|
@ -98,7 +98,7 @@ void CRenderPass::simplify() {
|
|||
const auto BB = el2->element->boundingBox();
|
||||
RASSERT(BB, "No bounding box for an element with live blur is illegal");
|
||||
|
||||
totalLiveBlurRegion.add(BB->copy().scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale));
|
||||
totalLiveBlurRegion.add(BB->copy().scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ CRegion CRenderPass::render(const CRegion& damage_) {
|
|||
blurRegion.add(*BB);
|
||||
}
|
||||
|
||||
blurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
blurRegion.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
|
||||
blurRegion.intersect(damage).expand(oneBlurRadius());
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ CRegion CRenderPass::render(const CRegion& damage_) {
|
|||
}
|
||||
|
||||
void CRenderPass::renderDebugData() {
|
||||
CBox box = {{}, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize};
|
||||
CBox box = {{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_transformedSize};
|
||||
for (const auto& rg : occludedRegions) {
|
||||
g_pHyprOpenGL->renderRectWithDamage(box, Colors::RED.modifyA(0.1F), rg);
|
||||
}
|
||||
|
|
@ -219,9 +219,9 @@ void CRenderPass::renderDebugData() {
|
|||
if (!bb.has_value())
|
||||
return;
|
||||
|
||||
CBox box = bb->copy().translate(-g_pHyprOpenGL->m_RenderData.pMonitor->vecPosition).scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
CBox box = bb->copy().translate(-g_pHyprOpenGL->m_RenderData.pMonitor->m_position).scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
|
||||
if (box.intersection(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize}).empty())
|
||||
if (box.intersection(CBox{{}, g_pHyprOpenGL->m_RenderData.pMonitor->m_size}).empty())
|
||||
return;
|
||||
|
||||
g_pHyprOpenGL->renderRectWithDamage(box, color, CRegion{0, 0, INT32_MAX, INT32_MAX});
|
||||
|
|
@ -251,8 +251,8 @@ void CRenderPass::renderDebugData() {
|
|||
auto BOX = hlSurface->getSurfaceBoxGlobal();
|
||||
if (BOX) {
|
||||
auto region = g_pSeatManager->state.pointerFocus->current.input.copy()
|
||||
.scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale)
|
||||
.translate(BOX->pos() - g_pHyprOpenGL->m_RenderData.pMonitor->vecPosition);
|
||||
.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale)
|
||||
.translate(BOX->pos() - g_pHyprOpenGL->m_RenderData.pMonitor->m_position);
|
||||
g_pHyprOpenGL->renderRectWithDamage(box, CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}, region);
|
||||
}
|
||||
}
|
||||
|
|
@ -261,11 +261,11 @@ void CRenderPass::renderDebugData() {
|
|||
|
||||
const auto DISCARDED_ELEMENTS = std::count_if(m_vPassElements.begin(), m_vPassElements.end(), [](const auto& e) { return e->discard; });
|
||||
auto tex = g_pHyprOpenGL->renderText(std::format("occlusion layers: {}\npass elements: {} ({} discarded)\nviewport: {:X0}", occludedRegions.size(), m_vPassElements.size(),
|
||||
DISCARDED_ELEMENTS, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize),
|
||||
DISCARDED_ELEMENTS, g_pHyprOpenGL->m_RenderData.pMonitor->m_pixelSize),
|
||||
Colors::WHITE, 12);
|
||||
|
||||
if (tex) {
|
||||
box = CBox{{0.F, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y - tex->m_vSize.y}, tex->m_vSize}.scale(g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
box = CBox{{0.F, g_pHyprOpenGL->m_RenderData.pMonitor->m_size.y - tex->m_vSize.y}, tex->m_vSize}.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
g_pHyprOpenGL->renderTexture(tex, box, 1.F);
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +282,8 @@ void CRenderPass::renderDebugData() {
|
|||
|
||||
tex = g_pHyprOpenGL->renderText(passStructure, Colors::WHITE, 12);
|
||||
if (tex) {
|
||||
box = CBox{{g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x - tex->m_vSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y - tex->m_vSize.y}, tex->m_vSize}.scale(
|
||||
g_pHyprOpenGL->m_RenderData.pMonitor->scale);
|
||||
box = CBox{{g_pHyprOpenGL->m_RenderData.pMonitor->m_size.x - tex->m_vSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->m_size.y - tex->m_vSize.y}, tex->m_vSize}.scale(
|
||||
g_pHyprOpenGL->m_RenderData.pMonitor->m_scale);
|
||||
g_pHyprOpenGL->renderTexture(tex, box, 1.F);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ bool CRectPassElement::needsPrecomputeBlur() {
|
|||
}
|
||||
|
||||
std::optional<CBox> CRectPassElement::boundingBox() {
|
||||
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->scale).round();
|
||||
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).round();
|
||||
}
|
||||
|
||||
CRegion CRectPassElement::opaqueRegion() {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
|
||||
const auto PROJSIZEUNSCALED = windowBox.size();
|
||||
|
||||
windowBox.scale(data.pMonitor->scale);
|
||||
windowBox.scale(data.pMonitor->m_scale);
|
||||
windowBox.round();
|
||||
|
||||
if (windowBox.width <= 1 || windowBox.height <= 1) {
|
||||
|
|
@ -72,14 +72,14 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
return;
|
||||
}
|
||||
|
||||
const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->scale) != data.pMonitor->scale /* Fractional */ && data.surface->current.scale == 1 /* fs protocol */ &&
|
||||
const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->m_scale) != data.pMonitor->m_scale /* Fractional */ && data.surface->current.scale == 1 /* fs protocol */ &&
|
||||
windowBox.size() != data.surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->current.bufferSize.x, 3) &&
|
||||
DELTALESSTHAN(windowBox.height, data.surface->current.bufferSize.y, 3) /* off by one-or-two */ &&
|
||||
(!data.pWindow || (!data.pWindow->m_realSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
|
||||
|
||||
if (data.surface->colorManagement.valid())
|
||||
Debug::log(TRACE, "FIXME: rendering surface with color management enabled, should apply necessary transformations");
|
||||
g_pHyprRenderer->calculateUVForSurface(data.pWindow, data.surface, data.pMonitor->self.lock(), data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
|
||||
g_pHyprRenderer->calculateUVForSurface(data.pWindow, data.surface, data.pMonitor->m_self.lock(), data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
|
||||
|
||||
auto cancelRender = false;
|
||||
g_pHyprOpenGL->m_RenderData.clipRegion = visibleRegion(cancelRender);
|
||||
|
|
@ -127,7 +127,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
}
|
||||
|
||||
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback)
|
||||
data.surface->presentFeedback(data.when, data.pMonitor->self.lock());
|
||||
data.surface->presentFeedback(data.when, data.pMonitor->m_self.lock());
|
||||
|
||||
// add async (dmabuf) buffers to usedBuffers so we can handle release later
|
||||
// sync (shm) buffers will be released in commitState, so no need to track them here
|
||||
|
|
@ -138,7 +138,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
}
|
||||
|
||||
CBox CSurfacePassElement::getTexBox() {
|
||||
const double outputX = -data.pMonitor->vecPosition.x, outputY = -data.pMonitor->vecPosition.y;
|
||||
const double outputX = -data.pMonitor->m_position.x, outputY = -data.pMonitor->m_position.y;
|
||||
|
||||
const auto INTERACTIVERESIZEINPROGRESS = data.pWindow && g_pInputManager->currentlyDraggedWindow && g_pInputManager->dragMode == MBIND_RESIZE;
|
||||
auto PSURFACE = CWLSurface::fromResource(data.surface);
|
||||
|
|
@ -230,7 +230,7 @@ CRegion CSurfacePassElement::opaqueRegion() {
|
|||
CRegion opaqueSurf = data.surface->current.opaque.copy().intersect(CBox{{}, {data.w, data.h}});
|
||||
const auto texBox = getTexBox();
|
||||
opaqueSurf.scale(texBox.size() / Vector2D{data.w, data.h});
|
||||
return opaqueSurf.translate(data.pos + data.localPos - data.pMonitor->vecPosition).expand(-data.rounding);
|
||||
return opaqueSurf.translate(data.pos + data.localPos - data.pMonitor->m_position).expand(-data.rounding);
|
||||
}
|
||||
|
||||
return data.texture && data.texture->m_bOpaque ? boundingBox()->expand(-data.rounding) : CRegion{};
|
||||
|
|
@ -269,11 +269,11 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
|
|||
visibleRegion.translate(-uvTL * bufferSize);
|
||||
|
||||
auto texBox = getTexBox();
|
||||
texBox.scale(data.pMonitor->scale);
|
||||
texBox.scale(data.pMonitor->m_scale);
|
||||
texBox.round();
|
||||
|
||||
visibleRegion.scale((Vector2D(1, 1) / (uvBR - uvTL)) * (texBox.size() / bufferSize));
|
||||
visibleRegion.translate((data.pos + data.localPos) * data.pMonitor->scale - data.pMonitor->vecPosition);
|
||||
visibleRegion.translate((data.pos + data.localPos) * data.pMonitor->m_scale - data.pMonitor->m_position);
|
||||
|
||||
return visibleRegion;
|
||||
}
|
||||
|
|
@ -281,6 +281,6 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
|
|||
void CSurfacePassElement::discard() {
|
||||
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) {
|
||||
Debug::log(TRACE, "discard for invisible surface");
|
||||
data.surface->presentFeedback(data.when, data.pMonitor->self.lock(), true);
|
||||
data.surface->presentFeedback(data.when, data.pMonitor->m_self.lock(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void CTexPassElement::draw(const CRegion& damage) {
|
|||
g_pHyprOpenGL->m_RenderData.monitorProjection = *data.replaceProjection;
|
||||
g_pHyprOpenGL->renderTextureInternalWithDamage(data.tex, data.box, data.a, data.damage.empty() ? damage : data.damage, data.round, data.roundingPower);
|
||||
if (data.replaceProjection)
|
||||
g_pHyprOpenGL->m_RenderData.monitorProjection = g_pHyprOpenGL->m_RenderData.pMonitor->projMatrix;
|
||||
g_pHyprOpenGL->m_RenderData.monitorProjection = g_pHyprOpenGL->m_RenderData.pMonitor->m_projMatrix;
|
||||
}
|
||||
|
||||
bool CTexPassElement::needsLiveBlur() {
|
||||
|
|
@ -36,7 +36,7 @@ bool CTexPassElement::needsPrecomputeBlur() {
|
|||
}
|
||||
|
||||
std::optional<CBox> CTexPassElement::boundingBox() {
|
||||
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->scale).round();
|
||||
return data.box.copy().scale(1.F / g_pHyprOpenGL->m_RenderData.pMonitor->m_scale).round();
|
||||
}
|
||||
|
||||
CRegion CTexPassElement::opaqueRegion() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue