gl: Fix padding in icon library
authorBenjamin Otte <otte@redhat.com>
Wed, 25 Oct 2023 19:12:23 +0000 (21:12 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 17 Nov 2023 19:59:02 +0000 (14:59 -0500)
The previous code would not pad the left side with the left column of
pixels but with the top row.

Test attached.

gsk/gl/gskgliconlibrary.c
testsuite/gsk/compare/blurred-lines.node [new file with mode: 0644]
testsuite/gsk/compare/blurred-lines.png [new file with mode: 0644]
testsuite/gsk/meson.build

index e57016a1a244fb690fd822453ad007308d46a764..9040d8e1d9122916bab6d515b4eb2e4c384c9419 100644 (file)
@@ -148,6 +148,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
                    gl_format, gl_type,
                    pixel_data);
   /* Padding left */
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
   glTexSubImage2D (GL_TEXTURE_2D, 0,
                    packed_x, packed_y + 1,
                    1, height,
@@ -161,7 +162,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
                    pixel_data);
 
   /* Padding right */
-  glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
   glPixelStorei (GL_UNPACK_SKIP_PIXELS, width - 1);
   glTexSubImage2D (GL_TEXTURE_2D, 0,
                    packed_x + width + 1, packed_y + 1,
diff --git a/testsuite/gsk/compare/blurred-lines.node b/testsuite/gsk/compare/blurred-lines.node
new file mode 100644 (file)
index 0000000..e3b85c8
--- /dev/null
@@ -0,0 +1,6 @@
+texture {
+  bounds: 0 0 20 20;
+  texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAHElEQVQokWP8z8D6n4EIwESMolGF\
+1FM4CgYrAACekgIXqju67AAAAABJRU5ErkJggg==\
+");
+}
diff --git a/testsuite/gsk/compare/blurred-lines.png b/testsuite/gsk/compare/blurred-lines.png
new file mode 100644 (file)
index 0000000..bb55317
Binary files /dev/null and b/testsuite/gsk/compare/blurred-lines.png differ
index 9d8271988217123363aee7e6bb6051a44fc70852..7c7e3e97698319077b479e8fdbad2baceb98a784 100644 (file)
@@ -19,6 +19,7 @@ compare_render_tests = [
   'blend-invisible-child',
   'blend-in-rotate',
   'blend-normal',
+  'blurred-lines',
   'border-bottom-right',
   'border-one-rounded',
   'borders-rotated',