This file is indexed.

/usr/share/pyshared/glitch/read.py is in python-glitch 0.6-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"Reading pixels from GPU memory."

from __future__ import absolute_import
import OpenGL.GL as gl

import glitch

class Read(glitch.Node):
    """Read pixels from GPU memory.

    After each render, the C{pixels} attribute is updated with the contents of
    the back buffer.
    """

    def __init__(self, **kw):
        glitch.Node.__init__(self, **kw)
        self.width = None
        self.height = None
        self.pixels = None

    def render(self, ctx):
        glitch.Node.render(self, ctx)
        self.width = ctx['w']
        self.height = ctx['h']
        self.pixels = gl.glReadPixels(
            0, 0, ctx['w'], ctx['h'], gl.GL_RGB, gl.GL_UNSIGNED_BYTE)
        assert len(self.pixels) == self.width * self.height * 3

    def get_pixbuf(self):
        # mainly useful for flipping pixel coordinate system
        import gtk
        pixbuf = gtk.gdk.pixbuf_new_from_data(self.pixels,
            gtk.gdk.COLORSPACE_RGB, False, 8, self.width, self.height,
            self.width * 3)
        return pixbuf.flip(False)