@@ -242,7 +242,10 @@ void GlesRenderBackend::makeCurrent(RenderTarget& target) {
242242void GlesRenderBackend::beginFrame (RenderTarget& target) {
243243 makeCurrent (target);
244244
245- setViewport (target.bufferWidth (), target.bufferHeight ());
245+ m_bufferWidth = target.bufferWidth ();
246+ m_bufferHeight = target.bufferHeight ();
247+
248+ setViewport (m_bufferWidth, m_bufferHeight);
246249 setBlendMode (RenderBlendMode::PremultipliedAlpha);
247250 disableScissor ();
248251 clear (rgba (0 .0f , 0 .0f , 0 .0f , 0 .0f ));
@@ -425,8 +428,48 @@ void GlesRenderBackend::drawWallpaper(
425428 WallpaperSourceKind sourceKind2, TextureId texture2, const Color& sourceColor2, float surfaceWidth,
426429 float surfaceHeight, float width, float height, float imageWidth1, float imageHeight1, float imageWidth2,
427430 float imageHeight2, float progress, float fillMode, const TransitionParams& params, const Color& fillColor,
428- const Mat3& transform
431+ const Mat3& transform, float blurRadius, const Color& tintColor
429432) {
433+ if (blurRadius > 0 .0f ) {
434+ const std::uint32_t targetWidth = m_bufferWidth > 0 ? m_bufferWidth : static_cast <std::uint32_t >(surfaceWidth);
435+ const std::uint32_t targetHeight = m_bufferHeight > 0 ? m_bufferHeight : static_cast <std::uint32_t >(surfaceHeight);
436+ const std::uint32_t fbWidth = std::max (1u , targetWidth / 4 );
437+ const std::uint32_t fbHeight = std::max (1u , targetHeight / 4 );
438+
439+ auto fb1 = createFramebuffer (fbWidth, fbHeight);
440+ auto fb2 = createFramebuffer (fbWidth, fbHeight);
441+
442+ if (fb1 != nullptr && fb2 != nullptr && fb1->valid () && fb2->valid ()) {
443+ bindFramebuffer (*fb1);
444+ setViewport (fbWidth, fbHeight);
445+ clear (rgba (0 .0f , 0 .0f , 0 .0f , 0 .0f ));
446+
447+ m_wallpaperProgram.ensureInitialized ();
448+ m_wallpaperProgram.draw (
449+ transition, sourceKind1, texture1, sourceColor1, sourceKind2, texture2, sourceColor2, surfaceWidth,
450+ surfaceHeight, width, height, imageWidth1, imageHeight1, imageWidth2, imageHeight2, progress, fillMode,
451+ params, fillColor, transform
452+ );
453+
454+ bindFramebuffer (*fb2);
455+ setViewport (fbWidth, fbHeight);
456+ clear (rgba (0 .0f , 0 .0f , 0 .0f , 0 .0f ));
457+ drawFramebufferBlur (fb1->colorTexture (), fbWidth, fbHeight, 1 .0f , 0 .0f , blurRadius);
458+
459+ bindDefaultFramebuffer ();
460+ setViewport (targetWidth, targetHeight);
461+ drawFramebufferBlur (fb2->colorTexture (), fbWidth, fbHeight, 0 .0f , 1 .0f , blurRadius);
462+
463+ if (tintColor.a > 0 .0f ) {
464+ setBlendMode (RenderBlendMode::StraightAlpha);
465+ drawFullscreenTint (tintColor);
466+ setBlendMode (RenderBlendMode::PremultipliedAlpha);
467+ }
468+ return ;
469+ }
470+ }
471+
472+ >>>>>>> b798c8b (feat: add Synced (Blur) theme option with background blur and tint)
430473 m_wallpaperProgram.ensureInitialized ();
431474 m_wallpaperProgram.draw (
432475 transition, sourceKind1, texture1, sourceColor1, sourceKind2, texture2, sourceColor2, surfaceWidth, surfaceHeight,
0 commit comments