Merge lp:~samuel-thibault/compiz/smooth into lp:compiz/0.9.13

Proposed by Samuel thibault
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4135
Merged at revision: 4139
Proposed branch: lp:~samuel-thibault/compiz/smooth
Merge into: lp:compiz/0.9.13
Diff against target: 99 lines (+51/-0)
2 files modified
plugins/ezoom/ezoom.xml.in (+15/-0)
plugins/ezoom/src/ezoom.cpp (+36/-0)
To merge this branch: bzr merge lp:~samuel-thibault/compiz/smooth
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+334765@code.launchpad.net

Commit message

ezoom: Add option to choose between no smoothing and linear smoothing

Description of the change

This is to fix bug #1736446

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

ACK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/ezoom/ezoom.xml.in'
2--- plugins/ezoom/ezoom.xml.in 2016-07-01 15:37:19 +0000
3+++ plugins/ezoom/ezoom.xml.in 2017-12-05 14:52:40 +0000
4@@ -70,6 +70,21 @@
5 <alpha>0x4fff</alpha>
6 </default>
7 </option>
8+ <option name="zoom_smoothing" type="int">
9+ <_short>Zoom Smoothing Algorithm</_short>
10+ <_long>Select algorithm for smoothing the zoom rendering</_long>
11+ <min>0</min>
12+ <max>1</max>
13+ <default>1</default>
14+ <desc>
15+ <value>0</value>
16+ <_name>None</_name>
17+ </desc>
18+ <desc>
19+ <value>1</value>
20+ <_name>Bilinear</_name>
21+ </desc>
22+ </option>
23 </group>
24 <group>
25 <_short>Mouse Behaviour</_short>
26
27=== modified file 'plugins/ezoom/src/ezoom.cpp'
28--- plugins/ezoom/src/ezoom.cpp 2016-07-01 15:37:19 +0000
29+++ plugins/ezoom/src/ezoom.cpp 2017-12-05 14:52:40 +0000
30@@ -140,6 +140,34 @@
31 return false;
32 }
33
34+static inline GLenum
35+setZoomSmoothing (GLScreen *gScreen)
36+{
37+ ZOOM_SCREEN (screen);
38+
39+ GLenum oldFilter = zs->gScreen->textureFilter ();
40+ switch (zs->optionGetZoomSmoothing ())
41+ {
42+ case EzoomOptions::ZoomSmoothingNone:
43+ zs->gScreen->setTextureFilter (GL_NEAREST);
44+ break;
45+
46+ case EzoomOptions::ZoomSmoothingBilinear:
47+ zs->gScreen->setTextureFilter (GL_LINEAR);
48+ break;
49+ }
50+
51+ return oldFilter;
52+}
53+
54+static void
55+restoreZoomSmoothing (GLScreen *gScreen, GLenum oldFilter)
56+{
57+ ZOOM_SCREEN (screen);
58+
59+ zs->gScreen->setTextureFilter (oldFilter);
60+}
61+
62 /* Returns the distance to the defined edge in zoomed pixels. */
63 int
64 EZoomScreen::distanceToEdge (int out,
65@@ -502,6 +530,8 @@
66 bool status;
67 int out = output->id ();
68
69+ GLenum oldFilter = setZoomSmoothing (gScreen);
70+
71 if (isActive (out))
72 {
73 GLScreenPaintAttrib sa = attrib;
74@@ -529,6 +559,8 @@
75 if (grabIndex)
76 drawBox (transform, output, box);
77
78+ restoreZoomSmoothing (gScreen, oldFilter);
79+
80 return status;
81 }
82
83@@ -1158,6 +1190,8 @@
84 return;
85 }
86
87+ GLenum oldFilter = setZoomSmoothing (gScreen);
88+
89 GLMatrix sTransform = transform;
90 float scaleFactor;
91 int ax, ay;
92@@ -1220,6 +1254,8 @@
93
94 glBindTexture (GL_TEXTURE_2D, 0);
95 glDisable (GL_BLEND);
96+
97+ restoreZoomSmoothing (gScreen, oldFilter);
98 }
99 }
100

Subscribers

People subscribed via source and target branches