Skip to content

Commit

Permalink
wpewebkit: Add a patch to fix LBSE blurriness
Browse files Browse the repository at this point in the history
  • Loading branch information
obyknovenius committed Mar 21, 2024
1 parent 84523e3 commit cef349e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
68 changes: 68 additions & 0 deletions recipes-browser/wpewebkit/wpewebkit/Fix-LBSE-blurriness.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Fix blurry image when LBSE is on

Upstream-Status: Inappropriate [meta-wpe-image specific]

diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h
index bd13b594389b..55a82d13e218 100644
--- a/Source/WebCore/platform/graphics/GraphicsLayer.h
+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h
@@ -623,6 +623,7 @@ public:

virtual void deviceOrPageScaleFactorChanged() { }
virtual void setShouldUpdateRootRelativeScaleFactor(bool) { }
+ virtual void setShouldDoubleScaleFactor(bool) { }

WEBCORE_EXPORT void noteDeviceOrPageScaleFactorChangedIncludingDescendants();

diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
index a1e13176ee67..c9a2f2abbb16 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
@@ -1088,7 +1088,10 @@ void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged()

float CoordinatedGraphicsLayer::effectiveContentsScale()
{
- return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor();
+ float contentsScale = selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor();
+ if (m_shouldDoubleScaleFactor)
+ return contentsScale * 2;
+ return contentsScale;
}

IntRect CoordinatedGraphicsLayer::transformedVisibleRect()
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
index 8d8fdb71d6eb..6a36bd8beb46 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
@@ -110,6 +110,7 @@ public:
void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer) override;
void setContentsNeedsDisplay() override;
void deviceOrPageScaleFactorChanged() override;
+ void setShouldDoubleScaleFactor(bool shouldDoubleScaleFactor) override { m_shouldDoubleScaleFactor = shouldDoubleScaleFactor; }
void flushCompositingState(const FloatRect&) override;
void flushCompositingStateForThisLayerOnly() override;
bool setFilters(const FilterOperations&) override;
@@ -224,6 +225,7 @@ private:
bool m_pendingContentsScaleAdjustment : 1;
bool m_pendingVisibleRectAdjustment : 1;
bool m_shouldUpdatePlatformLayer : 1;
+ bool m_shouldDoubleScaleFactor : 1 { false };

CoordinatedGraphicsLayerClient* m_coordinator;

diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp
index 054f14b16dcd..d3fd48368048 100644
--- a/Source/WebCore/rendering/RenderLayerBacking.cpp
+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp
@@ -364,6 +364,11 @@ Ref<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, G
if (renderer().isSVGLayerAwareRenderer() && renderer().document().settings().layerBasedSVGEngineEnabled())
graphicsLayer->setShouldUpdateRootRelativeScaleFactor(true);
#endif
+
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ if (renderer().isSVGLayerAwareRenderer() && renderer().document().settings().layerBasedSVGEngineEnabled())
+ graphicsLayer->setShouldDoubleScaleFactor(true);
+#endif

return graphicsLayer;
}
1 change: 1 addition & 0 deletions recipes-browser/wpewebkit/wpewebkit_2.42.%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://0001-Add-LAYER_BASED_SVG_ENGINE-envvar_v2.42.patch \
file://0001-LBSE-Correct-animation-boundaries-avoiding-excessive.patch \
file://Fix-LBSE-blurriness.patch \
"

SRC_URI:class-devupstream = "git://github.com/WebKit/webkit.git;protocol=https;branch=main"
Expand Down

0 comments on commit cef349e

Please sign in to comment.