Re: Bug with large line width near edge of window?
Matt Peterson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CACEDMXL2N4-s92=C1miymeR_AOT4sz-FxkEd=fk09K03zmA8wg@mail.gmail.com> |
I wrote a quick test case in Python. The bug seems very easy to reproduce here. -- Matt Peterson On Tue, Oct 15, 2013 at 2:54 AM, Chris Wilson <[email protected]>wrote: > > Sorry, I can see it matches your description, but I don't have enough > context to see that it is the wrong behaviour. Would it be possible to > generate a small series of snapshots that show the sudden snapping to > the corners? If you can automate and produce a test case... :) > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo
bug.py
(application/octet-stream, 1.4 KB)
#! /usr/bin/env python
import pygtk
from gi.repository import GObject, Gtk, Gdk, cairo, Pango, PangoCairo
# Create a GTK+ widget on which we will draw using Cairo
class Screen(Gtk.DrawingArea):
def __init__(self):
Gtk.DrawingArea.__init__(self)
self.timeout_id = GObject.timeout_add(100, self.on_timeout, None)
self.x = 0
self.dx = 0.01
def on_timeout(self, a):
self.x += self.dx
if self.x > 0.4:
self.dx *= -1
if self.x < 0:
self.dx *= -1
self.queue_draw()
return True
def do_draw(self, cr):
a = self.get_allocation()
width = a.width
height = a.height
cr.save()
cr.set_source_rgba(1, 1, 1, 1) # clear background
cr.paint()
cr.restore()
cr.translate(-self.x * width, 0)
cr.set_line_width(20)
cr.save()
cr.set_source_rgba(0, 0, 0, 1) # black line
cr.move_to(width / 5, -5)
cr.line_to(width / 3, height / 2)
cr.line_to(width / 5, height + 5)
cr.stroke()
cr.restore()
# GTK mumbo-jumbo to show the widget in a window and quit when it's closed
def run(Widget):
window = Gtk.Window()
window.connect("delete-event", Gtk.main_quit)
widget = Widget()
# widget.connect('draw', widget.do_draw)
widget.show()
window.add(widget)
window.present()
Gtk.main()
if __name__ == "__main__":
run(Screen)