summaryrefslogtreecommitdiff
path: root/editors/pdfedit/files/patch-src__kernel__cpagecontents.cc
blob: c035213c2f316df95cd3e396c7693b20d6ad9a34 (plain) (blame)
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
--- src/kernel/cpagecontents.cc.orig	2010-04-30 21:44:30.000000000 +0900
+++ src/kernel/cpagecontents.cc	2011-03-21 20:39:56.000000000 +0900
@@ -379,6 +379,12 @@
 
 	// Get the text
 	libs::Rectangle rec = (rc)? *rc : _page->display()->getPageRect();
+	// if we use rotation 90,270 then we must change the rectangle from which we want the text
+	// accordingly (TODO - verify for all rotations)
+	int rot = _page->getRotation ();
+	if (90 == rot || 270 == rot)
+		std::swap (rec.xright, rec.yright);
+
 	scoped_ptr<GString> gtxt (textDev->getText(rec.xleft, rec.yleft, rec.xright, rec.yright));
 	text = gtxt->getCString();
 }
@@ -540,10 +546,14 @@
 
 
 	CDict image_dict;
-	image_dict.addProperty ("W", CInt (image_size.x));
-	image_dict.addProperty ("H", CInt (image_size.y));
-	image_dict.addProperty ("CS", CName ("RGB"));
-	image_dict.addProperty ("BPC", CInt (8));
+	CInt x (image_size.x);
+	image_dict.addProperty ("W", x);
+	CInt y (image_size.y);
+	image_dict.addProperty ("H", y);
+	CName n ("RGB");
+	image_dict.addProperty ("CS", n);
+	CInt i (8);
+	image_dict.addProperty ("BPC", i);
 	CInlineImage img (image_dict, what);
 	shared_ptr<CInlineImage> inline_image (new CInlineImage (image_dict, what));
 	shared_ptr<InlineImageCompositePdfOperator> BI(new InlineImageCompositePdfOperator (inline_image));