mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-02 07:25:45 -04:00
attempt to merge it in : mostly works (now, pub time).
This commit is contained in:
parent
a4639c280e
commit
0b9f92db72
1 changed files with 20 additions and 25 deletions
|
@ -113,33 +113,28 @@ class HellowWorldGTK:
|
||||||
# copy each patch into the texture pixbuf
|
# copy each patch into the texture pixbuf
|
||||||
for patch in texture.patches:
|
for patch in texture.patches:
|
||||||
|
|
||||||
|
dest_x = max(0, patch.xoff)
|
||||||
# top-left coords of source
|
dest_y = max(0, patch.yoff)
|
||||||
src_x = max(-1 * patch.xoff, 0)
|
dest_height = min(
|
||||||
src_y = max(-1 * patch.yoff, 0)
|
self.patch_pixbufs[patch.name].get_height(),
|
||||||
|
texbuf.get_height() - dest_y
|
||||||
# amount to copy
|
)
|
||||||
width = self.patch_pixbufs[patch.name].get_width()
|
dest_width = min(
|
||||||
if width + patch.xoff > int(texture.width):
|
self.patch_pixbufs[patch.name].get_width(),
|
||||||
width = min(int(texture.width), int(texture.width) - patch.xoff)
|
texbuf.get_width() - dest_x
|
||||||
if width - patch.xoff > self.patch_pixbufs[patch.name].get_width():
|
)
|
||||||
width = self.patch_pixbufs[patch.name].get_width() + patch.xoff
|
if patch.xoff < 0:
|
||||||
height = self.patch_pixbufs[patch.name].get_height()
|
dest_width += patch.xoff
|
||||||
if height + patch.yoff > int(texture.height):
|
if patch.yoff < 0:
|
||||||
height = min(int(texture.height), int(texture.height) - patch.yoff)
|
dest_height += patch.yoff
|
||||||
if height - patch.yoff > self.patch_pixbufs[patch.name].get_height():
|
offset_x = patch.xoff
|
||||||
height = self.patch_pixbufs[patch.name].get_height() + patch.yoff
|
offset_y = patch.yoff
|
||||||
|
pb = self.patch_pixbufs[patch.name]
|
||||||
dest_xoff = max(0, patch.xoff)
|
pb.composite(
|
||||||
dest_yoff = max(0, patch.yoff)
|
|
||||||
print "compositing %d,%d,%d,%d,%d,%d" % (dest_xoff, dest_yoff, width, height, src_x, src_y)
|
|
||||||
self.patch_pixbufs[patch.name].composite(
|
|
||||||
texbuf,
|
texbuf,
|
||||||
dest_xoff, dest_yoff, width, height, # dest_x, dest_y dest_width, dest_height
|
dest_x, dest_y, dest_width, dest_height,
|
||||||
src_x, src_y, # offset_x, offset_y
|
offset_x, offset_y, 1, 1, # scale
|
||||||
1, 1, # scale_x, scale_y
|
|
||||||
gtk.gdk.INTERP_NEAREST, 255)
|
gtk.gdk.INTERP_NEAREST, 255)
|
||||||
#src_x, src_y, width, height, texbuf, dest_xoff, dest_yoff)
|
|
||||||
|
|
||||||
def set_texture(self, name):
|
def set_texture(self, name):
|
||||||
# parse the example texture, fetch the width,height;
|
# parse the example texture, fetch the width,height;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue