This commit is contained in:
Kovid Goyal 2012-12-22 10:04:43 +05:30
parent a0adbf150b
commit ff5dc4b039
2 changed files with 6 additions and 7 deletions

View File

@ -306,8 +306,8 @@ class PdfEngine(QPaintEngine):
image = pixmap.toImage()
ref = self.add_image(image, pixmap.cacheKey())
if ref is not None:
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
ref)
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
-rect.height(), ref)
@store_error
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
@ -316,8 +316,8 @@ class PdfEngine(QPaintEngine):
image.copy(source_rect))
ref = self.add_image(image, image.cacheKey())
if ref is not None:
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
ref)
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
-rect.height(), ref)
def add_image(self, img, cache_key):
if img.isNull(): return

View File

@ -423,10 +423,9 @@ class PDFStream(object):
self.objects.commit(r, self.stream)
return r
def draw_image(self, x, y, w, h, imgref):
def draw_image(self, x, y, xscale, yscale, imgref):
name = self.current_page.add_image(imgref)
sx, sy = w, h
self.current_page.write('q %g 0 0 %g %g %g cm '%(sx, -sy, x, y+h))
self.current_page.write('q %g 0 0 %g %g %g cm '%(xscale, yscale, x, y))
serialize(Name(name), self.current_page)
self.current_page.write_line(' Do Q')