I’m having a very productive day today. Panic will do that to you.
Read more...Here we go… ruby-prof said wxRuby was spending a lot of time initializing memory device contexts (canvases to draw on)…
%self total self wait child calls name 45.42 5.63 5.63 0.00 0.00 120 Kernel#sleep 8.85 2.05 1.10 0.00 0.95 28440 WxRubyStyleAccessors#method_missing 5.16 0.64 0.64 0.00 0.00 9520 Wxruby2::MemoryDC#initialize 4.42 5.14 0.55 0.00 4.59 9520 Wxruby2::Bitmap#draw
That would be because I was doing so before each line I drew.
def draw_line(options = {})
buffer.draw do |surface|
surface.pen = Wx::Pen.new(
...
end
endSo as a quick fix, I’m queueing my shapes and drawing everything at once. This brought me about in line with Ruby-Gnome2, speed-wise:
def draw_line(options = {})
@line_queue << options
end
def render_lines
buffer.draw do |surface|
while options = @line_queue.shift do
surface.pen = Wx::Pen.new(
...
end
end
end%self total self wait child calls name 69.41 11.27 11.27 0.00 0.00 240 Kernel#sleep 4.24 1.83 0.69 0.00 1.14 30600 WxRubyStyleAccessors#method_missing 2.96 4.17 0.48 0.00 3.69 480 Wxruby2::Bitmap#draw 2.41 0.39 0.39 0.00 0.00 40640 Regexp#===
Though I made a pretty big memory structure to do it. I’ll have to slim that down at some point.
Now it says it’s spending a lot of time initializing colors (Colours?) and pens. Will I have to cache those? Hope not.
Read more...The Tivo gets a lot of tech podcasts, and I told Lenny I wanted to pick the next show after his cartoon was done.
Lenny (sincerely): “You mean that show where they talk about a lot of cell phones? Like nerds?” Me (laughing): “Yes, that show.”
Read more...Mario Steele from the wxRuby list solved my problem - I was creating an extra device context and then not even using it. draw_bitmap works a lot better, too.
It’s working within Zyps as well, but it’s about 50% slower than Ruby-Gnome2. :( Now to find out if that’s my fault or the library’s.
Read more...wxRuby animation demo not quite working...
Posted this to the wxruby-users mailing list. Let’s see if anyone else has attempted anything like this.
OK, I have a basic blit demo working (thanks to Alex Fenton for his reply, which I finally saw). However, there's a great deal of "tearing" on the screen - flickering grey lines in the black background. It looks like the blit isn't always complete when the screen refreshes. Can anyone look at this and tell me what I might be doing wrong? Any help would be most appreciated! -Jay McGavren http://jay.mcgavren.com/zypsRead more...