def __init__(self, wid, window_alpha, pixel_depth=0): self.wid = wid self.texture_pixel_format = None #this is the pixel format we are currently updating the fbo with #can be: "YUV420P", "YUV422P", "YUV444P", "GBRP" or None when not initialized yet. self.pixel_format = None self.textures = None # OpenGL texture IDs self.shaders = None self.texture_size = 0, 0 self.gl_setup = False self.debug_setup = False self.border = None self.paint_screen = False self.paint_spinner = False self.offscreen_fbo = None self.tmp_fbo = None self.pending_fbo_paint = [] self.last_flush = monotonic_time() WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA) self.init_gl_config(window_alpha) self.init_backing() self.bit_depth = self.get_bit_depth(pixel_depth) self.init_formats() self.draw_needs_refresh = False self._backing.show()
def paint_webp(self, img_data, x, y, width, height, options, callbacks): if WEBP_YUV and self.webp_decoder and not WEBP_PILLOW: img = self.webp_decoder.decompress_yuv(img_data) flush = options.intget("flush", 0) self.idle_add(self.gl_paint_planar, flush, "jpeg", img, x, y, width, height, width, height, callbacks) return WindowBackingBase.paint_webp(self, img_data, x, y, width, height, options, callbacks)
def paint_webp(self, img_data, x, y, width, height, options, callbacks): subsampling = options.strget("subsampling") has_alpha = options.boolget("has_alpha") if subsampling=="YUV420P" and WEBP_YUV and self.webp_decoder and not WEBP_PILLOW and not has_alpha and width>=2 and height>=2: img = self.webp_decoder.decompress_yuv(img_data) flush = options.intget("flush", 0) self.idle_add(self.gl_paint_planar, YUV2RGB_SHADER, flush, "webp", img, x, y, width, height, width, height, callbacks) return WindowBackingBase.paint_webp(self, img_data, x, y, width, height, options, callbacks)
def paint_image(self, coding, img_data, x, y, width, height, options, callbacks): """ can be called from any thread """ if USE_PIL and has_codec("dec_pillow"): return WindowBackingBase.paint_image(self, coding, img_data, x, y, width, height, options, callbacks) #gdk needs UI thread: self.idle_add(self.paint_pixbuf_gdk, coding, img_data, x, y, width, height, options, callbacks) return False
def __init__(self, wid, _w, _h, _has_alpha, data=None): self.data = data WindowBackingBase.__init__(self, wid, True) self.idle_add = import_glib().idle_add self._backing = object() #pretend we have a backing structure
def __init__(self, wid, window_alpha): WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA, gobject.idle_add)
def __init__(self, wid, window_alpha): WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA, glib.idle_add)
def close(self): if self._backing: self._backing.finish() WindowBackingBase.close(self)
def __init__(self, wid, window_alpha, _pixel_depth=0): WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA) self.idle_add = glib.idle_add
def get_encoding_properties(self): props = WindowBackingBase.get_encoding_properties(self) if SCROLL_ENCODING: props["encoding.scrolling"] = True return props
def __init__(self, wid, w, h, has_alpha): WindowBackingBase.__init__(self, wid, getQtScheduler().idle_add)
def __init__(self, wid): WindowBackingBase.__init__(self, wid, gobject.idle_add)
def __init__(self, wid, w, h, has_alpha): WindowBackingBase.__init__(self, wid, getQtScheduler().idle_add)