예제 #1
0
    def cairo_draw(self, context):
        log(
            "cairo_draw: size=%s, render-size=%s, offsets=%s, pointer_overlay=%s",
            self.size, self.render_size, self.offsets, self.pointer_overlay)
        if self._backing is None:
            return False
        #try:
        #    log("clip rectangles=%s", context.copy_clip_rectangle_list())
        #except:
        #    log.error("clip:", exc_info=True)
        ww, wh = self.render_size
        w, h = self.size
        if ww == 0 or w == 0 or wh == 0 or h == 0:
            return
        x, y = self.offsets[:2]

        setup_cairo_context(context, ww, wh, w, h, x, y)
        context.set_source_surface(self._backing, 0, 0)
        context.paint()
        if self.pointer_overlay and self.cursor_data:
            px, py, _size, start_time = self.pointer_overlay[2:]
            spx = round(w * px / ww)
            spy = round(h * py / wh)
            cairo_paint_pointer_overlay(context, self.cursor_data, x + spx,
                                        y + spy, start_time)
예제 #2
0
    def cairo_draw_from_drawable(self, context, drawable):
        if drawable is None:
            return
        ww, wh = self.render_size
        w, h = self.size
        if ww == 0 or w == 0 or wh == 0 or h == 0:
            return
        x, y = self.offsets[:2]

        setup_cairo_context(context, ww, wh, w, h, x, y)
        context.set_source_pixmap(drawable, 0, 0)
        context.paint()
        if self.pointer_overlay:
            px, py, size, start_time = self.pointer_overlay[2:]
            spx = round(w * px / ww)
            spy = round(h * py / wh)
            cairo_paint_pointer_overlay(context, spx, spy, size, start_time)
예제 #3
0
 def cairo_draw_from_drawable(self, context, drawable):
     if drawable is None:
         return
     ww, wh = self.render_size
     w, h = self.size
     if ww == 0 or w == 0 or wh == 0 or h == 0:
         return
     x, y = self.offsets[:2]
     log(
         "cairo_draw_from_drawable%s render_size=%s, size=%s, offsets=%s, pointer_overlay=%s",
         (context, drawable), self.render_size, self.size, self.offsets,
         self.pointer_overlay)
     setup_cairo_context(context, ww, wh, w, h, x, y)
     context.set_source_pixmap(drawable, 0, 0)
     context.paint()
     if self.pointer_overlay and self.cursor_data:
         px, py, _size, start_time = self.pointer_overlay[2:]  #pylint: disable=unsubscriptable-object
         spx = round(w * px / ww)
         spy = round(h * py / wh)
         cairo_paint_pointer_overlay(context, self.cursor_data, spx, spy,
                                     start_time)