mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-03 10:25:46 -04:00
don't copy outside pixmap regions
This commit is contained in:
parent
b1fc4512e4
commit
6463348d3f
1 changed files with 6 additions and 2 deletions
|
@ -54,6 +54,8 @@ class HellowWorldGTK:
|
||||||
# parse the example texture, fetch the width,height;
|
# parse the example texture, fetch the width,height;
|
||||||
# create Patch objects and stuff them into a list
|
# create Patch objects and stuff them into a list
|
||||||
texture = self.textures[name]
|
texture = self.textures[name]
|
||||||
|
print "composing texture %s (%dx%d)\n" % \
|
||||||
|
(name,int(texture.width),int(texture.height))
|
||||||
|
|
||||||
# read the patches into pixbufs
|
# read the patches into pixbufs
|
||||||
# a horrid hack to get them client->server side
|
# a horrid hack to get them client->server side
|
||||||
|
@ -70,9 +72,11 @@ 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:
|
||||||
|
print "about to copy patch %s\n"%patch.name
|
||||||
|
width = min(patch.pixbuf.get_width(), int(texture.width))
|
||||||
|
height = min(patch.pixbuf.get_height(), int(texture.height))
|
||||||
patch.pixbuf.copy_area(0,0,
|
patch.pixbuf.copy_area(0,0,
|
||||||
patch.pixbuf.get_width(),
|
width, height,
|
||||||
patch.pixbuf.get_height(),
|
|
||||||
texbuf, patch.xoff, patch.yoff)
|
texbuf, patch.xoff, patch.yoff)
|
||||||
|
|
||||||
self.image1.set_from_pixbuf(texbuf)
|
self.image1.set_from_pixbuf(texbuf)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue