File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -135,21 +135,23 @@ public interface Gala.Background.Background : Object, Gdk.Paintable {
135135
136136 switch (style) {
137137 case ZOOM :
138+ /* We scale according to the bigger scale factor. Therefore the texture will be pushed off screen
139+ * in the other direction so center it in that direction. */
138140 var x_scale = (float ) width / texture. width;
139141 var y_scale = (float ) height / texture. height;
140142 if (x_scale > y_scale) {
141- snapshot. translate ({0 , (float ) (height - texture. width * x_scale) / 2 });
143+ snapshot. translate ({0 , (float ) (height - texture. height * x_scale) / 2 }); // Center it vertically
142144 snapshot. scale (x_scale, x_scale);
143145 } else {
144- snapshot. translate ({(float ) (width - (texture. width * y_scale)) / 2 , 0 });
146+ snapshot. translate ({(float ) (width - (texture. width * y_scale)) / 2 , 0 }); // Center it horizontally
145147 snapshot. scale (y_scale, y_scale);
146148 }
147149 texture. snapshot (snapshot, texture. width, texture. height);
148150 break ;
149151
150152 case CENTERED :
151- snapshot. translate ({(float ) (width - texture. width) / 2 , (float ) (height - texture. height) / 2 });
152- texture. snapshot (snapshot, texture. width, texture. height);
153+ snapshot. translate ({(float ) (width - texture. width) / 2 , (float ) (height - texture. height) / 2 }); // Center it
154+ texture. snapshot (snapshot, texture. width, texture. height); // Draw at original texture size
153155 break ;
154156
155157 default:
You can’t perform that action at this time.
0 commit comments