• R/O
  • HTTP
  • SSH
  • HTTPS

ruby-gtk3: Commit

Ruby GTK3移行後のメインリポジトリ


Commit MetaInfo

Revision45271493e539933bbe6f78ae6eced9ca989c4fb2 (tree)
Time2019-01-03 22:31:19
AuthorShyouzou Sugitani <shy@user...>
CommiterShyouzou Sugitani

Log Message

reduce the drawing load

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
1+Thu January 3 2019 Shyouzou Sugitani <shy@users.osdn.me>
2+ * 5.0.7のバルーンに対する変更から着想を得て
3+ 描画処理の負荷低減を更に進め、
4+ 適用対象もサーフェスまで拡大した.
5+ (「猫どりふ」、「きのこ」、"easyballoon"は対象外.)
6+
17 Wed January 2 2019 Shyouzou Sugitani <shy@users.osdn.me>
8+ * バージョン5.0.7リリース.
29 * バルーンの描画処理の負荷を低減した。
310 * Copyrightを2019年に更新した.
411
--- a/lib/ninix/balloon.rb
+++ b/lib/ninix/balloon.rb
@@ -455,6 +455,7 @@ module Balloon
455455 @x_fractions = 0
456456 @y_fractions = 0
457457 @reshape = true
458+ @translate = [0, 0]
458459 @darea = @window.darea
459460 @darea.set_events(Gdk::EventMask::EXPOSURE_MASK|
460461 Gdk::EventMask::BUTTON_PRESS_MASK|
@@ -805,10 +806,10 @@ module Balloon
805806 if y < top # XXX
806807 y = top
807808 end
809+ @translate = [x, y].zip(@position).map {|new, prev| new - prev}
808810 @position = [x, y]
809811 __move()
810- @reshape = true
811- end
812+ end
812813
813814 def get_position
814815 @position
@@ -1056,8 +1057,11 @@ module Balloon
10561057 redraw_arrow1(widget, cr)
10571058 if @reshape
10581059 @window.set_shape(cr)
1059- @reshape = false
1060+ else
1061+ @window.translate(cr, *@translate)
10601062 end
1063+ @reshape = false
1064+ @translate = [0, 0]
10611065 return false
10621066 end
10631067
--- a/lib/ninix/pix.rb
+++ b/lib/ninix/pix.rb
@@ -96,6 +96,7 @@ module Pix
9696 @darea.set_size_request(*size) # XXX
9797 @darea.show()
9898 add(@darea)
99+ @region = nil
99100 end
100101
101102 def move(x, y)
@@ -141,6 +142,22 @@ module Pix
141142 shape_combine_region(nil)
142143 shape_combine_region(region)
143144 end
145+ @region = region
146+ end
147+
148+ def translate(cr, x, y)
149+ if @region.nil?
150+ set_shape(cr)
151+ else
152+ @region.translate!(x, y)
153+ if @supports_alpha
154+ input_shape_combine_region(nil)
155+ input_shape_combine_region(@region)
156+ else
157+ shape_combine_region(nil)
158+ shape_combine_region(@region)
159+ end
160+ end
144161 end
145162 end
146163
--- a/lib/ninix/surface.rb
+++ b/lib/ninix/surface.rb
@@ -911,6 +911,8 @@ module Surface
911911 @y_root = nil
912912 @click_count = 0
913913 @__balloon_offset = nil
914+ @reshape = true
915+ @translate = [0, 0]
914916 @window.signal_connect('leave_notify_event') do |w, e|
915917 next window_leave_notify(w, e) # XXX
916918 end
@@ -973,6 +975,7 @@ module Surface
973975
974976 def display_changed(screen)
975977 return unless @side.zero?
978+ @reshape = true # XXX
976979 @parent.handle_request('NOTIFY', 'reset_position') # XXX
977980 left, top, scrn_w, scrn_h = @window.workarea
978981 @parent.handle_request(
@@ -1097,6 +1100,7 @@ module Surface
10971100 else
10981101 @surface_id = surface_id
10991102 end
1103+ @reshape = true
11001104 @seriko.reset(self, surface_id)
11011105 # define collision areas
11021106 @collisions = @region[@surface_id]
@@ -1304,6 +1308,7 @@ module Surface
13041308
13051309 def update_frame_buffer
13061310 return if @parent.handle_request('GET', 'lock_repaint')
1311+ @reshape = true
13071312 new_surface = create_image_surface(@seriko.get_base_id)
13081313 fail "assert" if new_surface.nil?
13091314 # update collision areas
@@ -1345,7 +1350,13 @@ module Surface
13451350 unless @parent.handle_request('GET', 'get_preference', 'check_collision').zero?
13461351 draw_region(cr)
13471352 end
1348- @window.set_shape(cr)
1353+ if @reshape
1354+ @window.set_shape(cr)
1355+ else
1356+ @window.translate(cr, *@translate)
1357+ end
1358+ @reshape = false
1359+ @translate = [0, 0]
13491360 end
13501361
13511362 def remove_overlay(actor)
@@ -1461,6 +1472,7 @@ module Surface
14611472
14621473 def set_position(x, y)
14631474 return if @parent.handle_request('GET', 'lock_repaint')
1475+ @translate = [x, y].zip(@position).map {|new, prev| new - prev}
14641476 @position = [x, y]
14651477 new_x, new_y = get_position()
14661478 @window.move(new_x, new_y)
Show on old repository browser