[adwaita-icon-theme] anicursorgen: sort cursors (hires ones first)
- From: Jakub Steiner <jimmac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [adwaita-icon-theme] anicursorgen: sort cursors (hires ones first)
- Date: Mon, 22 Aug 2016 18:53:58 +0000 (UTC)
commit b8a84340bd97732804047e71e8227fe211d1810f
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Mon Aug 22 15:21:28 2016 +0000
anicursorgen: sort cursors (hires ones first)
This should not affect anything, but Windows cursors have
multi-resolution frames sorted in larger-frames-first order,
so we should probably do the same.
src/cursors/anicursorgen.py | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/cursors/anicursorgen.py b/src/cursors/anicursorgen.py
index 40a7b6f..425eb73 100755
--- a/src/cursors/anicursorgen.py
+++ b/src/cursors/anicursorgen.py
@@ -132,6 +132,17 @@ def make_cur (frames, args):
buf = io.BytesIO ()
buf.write (p ('<HHH', 0, 2, len (frames)))
frame_offsets = []
+
+ def frame_size_cmp (f1, f2):
+ if f1[0] < f2[0]:
+ return -1
+ elif f1[0] > f2[0]:
+ return 1
+ else:
+ return 0
+
+ frames = sorted (frames, frame_size_cmp, reverse=True)
+
for frame in frames:
width = frame[0]
if width > 255:
@@ -206,6 +217,16 @@ def make_framesets (frames):
print ("Frameset {} has duration {} for framesize {}, but {} for framesize {}".format (i,
frameset[i][4], frameset[i][0], frameset[i - 1][4], frameset[i - 1][0]), file=sys.stderr)
return None
+ def frameset_size_cmp (f1, f2):
+ if f1[0][0] < f2[0][0]:
+ return -1
+ elif f1[0][0] > f2[0][0]:
+ return 1
+ else:
+ return 0
+
+ framesets = sorted (framesets, frameset_size_cmp, reverse=True)
+
return framesets
def make_ani (frames, out, args):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]