Skip to content

Commit

Permalink
ignore invalid image.
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 26, 2010
1 parent f332d9e commit 56e9437
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ def render_to_surface(surface, scale, paper, info, font)
loader = Gdk::PixbufLoader.new
loader.write(image_data)
pixbuf = loader.pixbuf
context.save do
context.translate(paper.width - image_width - margin,
paper.height - image_height - margin)
context.scale(image_width / pixbuf.width, image_height / pixbuf.height)
context.set_source_pixbuf(pixbuf, 0, 0)
context.paint
if pixbuf
context.save do
context.translate(paper.width - image_width - margin,
paper.height - image_height - margin)
context.scale(image_width / pixbuf.width, image_height / pixbuf.height)
context.set_source_pixbuf(pixbuf, 0, 0)
context.paint
end
end

context.show_page
Expand Down

0 comments on commit 56e9437

Please sign in to comment.