Info_paper.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. package epson.common;
  2. import android.content.Context;
  3. import android.graphics.Rect;
  4. import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
  5. import com.google.common.primitives.UnsignedBytes;
  6. import epson.print.MyPrinter;
  7. import java.util.Hashtable;
  8. public class Info_paper {
  9. public static int boder_pixel_300 = 35;
  10. public static int boder_pixel_360 = 42;
  11. private int leftMargin;
  12. private int leftMargin_border;
  13. private int paper_height;
  14. private int paper_height_boder;
  15. private int paper_height_boderless;
  16. private int paper_width;
  17. private int paper_width_boder;
  18. private int paper_width_boderless;
  19. private int resolution;
  20. private int topMargin;
  21. private int topMargin_border;
  22. public int getPaper_width() {
  23. return paper_width;
  24. }
  25. public void setPaper_width(int i) {
  26. paper_width = i;
  27. }
  28. public int getPaper_height() {
  29. return paper_height;
  30. }
  31. public void setPaper_height(int i) {
  32. paper_height = i;
  33. }
  34. public int getPaper_width_boder() {
  35. return paper_width_boder;
  36. }
  37. public void setPaper_width_boder(int i) {
  38. paper_width_boder = i;
  39. }
  40. public int getPaper_height_boder() {
  41. return paper_height_boder;
  42. }
  43. public void setPaper_height_boder(int i) {
  44. paper_height_boder = i;
  45. }
  46. public int getLeftMargin_border() {
  47. return leftMargin_border;
  48. }
  49. public void setLeftMargin_border(int i) {
  50. leftMargin_border = i;
  51. }
  52. public int getTopMargin_border() {
  53. return topMargin_border;
  54. }
  55. public void setTopMargin_border(int i) {
  56. topMargin_border = i;
  57. }
  58. public int getBottomMargin_border() {
  59. return (getPaper_height() - getPaper_height_boder()) - topMargin_border;
  60. }
  61. public int getRightMargin_border() {
  62. return (getPaper_width() - getPaper_width_boder()) - leftMargin_border;
  63. }
  64. public int getPaper_width_boderless() {
  65. return paper_width_boderless;
  66. }
  67. public void setPaper_width_boderless(int i) {
  68. paper_width_boderless = i;
  69. }
  70. public int getPaper_height_boderless() {
  71. return paper_height_boderless;
  72. }
  73. public void setPaper_height_boderless(int i) {
  74. paper_height_boderless = i;
  75. }
  76. public int getLeftMargin() {
  77. return leftMargin;
  78. }
  79. public void setLeftMargin(int i) {
  80. leftMargin = i;
  81. }
  82. public int getTopMargin() {
  83. return topMargin;
  84. }
  85. public void setTopMargin(int i) {
  86. topMargin = i;
  87. }
  88. public void setResolution(int i) {
  89. resolution = i;
  90. }
  91. public int getBottomMargin() {
  92. return (getPaper_height() - getPaper_height_boderless()) - topMargin;
  93. }
  94. public int getRightMargin() {
  95. return (getPaper_width() - getPaper_width_boderless()) - leftMargin;
  96. }
  97. private Info_paper(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) {
  98. paper_height = i2;
  99. paper_width = i;
  100. paper_height_boder = i4;
  101. paper_height_boderless = i8;
  102. leftMargin_border = (i - i3) / 2;
  103. topMargin_border = getBorder_pixel(i9);
  104. paper_width_boder = i3;
  105. paper_width_boderless = i7;
  106. topMargin = i6;
  107. leftMargin = i5;
  108. }
  109. public Info_paper() {
  110. }
  111. public static Info_paper getInfoPaper(Context context, int i) {
  112. int curPrinterResolution = getCurPrinterResolution(context);
  113. Hashtable<Integer, Info_paper> areaInfo = AreaInfoCache.getAreaInfo(context, curPrinterResolution);
  114. if (areaInfo != null && areaInfo.containsKey(Integer.valueOf(i))) {
  115. return areaInfo.get(Integer.valueOf(i));
  116. }
  117. int[] mediaInfo = MaintainPrinter2.getInstance().getMediaInfo(i, curPrinterResolution);
  118. if (mediaInfo != null) {
  119. return new Info_paper(mediaInfo[0], mediaInfo[1], mediaInfo[2], mediaInfo[3], mediaInfo[4], mediaInfo[5], mediaInfo[6], mediaInfo[7], curPrinterResolution);
  120. }
  121. return null;
  122. }
  123. public static Info_paper get360DpiPaperSizeInfo(int i) {
  124. int[] mediaInfo = MaintainPrinter2.getInstance().getMediaInfo(i, 1);
  125. if (mediaInfo != null) {
  126. return new Info_paper(mediaInfo[0], mediaInfo[1], mediaInfo[2], mediaInfo[3], mediaInfo[4], mediaInfo[5], mediaInfo[6], mediaInfo[7], 1);
  127. }
  128. return null;
  129. }
  130. public static int getCurPrinterResolution(Context context) {
  131. switch (MyPrinter.getCurPrinter(context).getLang()) {
  132. case 0:
  133. case 1:
  134. return 1;
  135. default:
  136. return 8;
  137. }
  138. }
  139. public static int getBorder_pixel(int i) {
  140. if (i == 4) {
  141. return boder_pixel_300 / 2;
  142. }
  143. if (i == 8) {
  144. return boder_pixel_300;
  145. }
  146. if (i == 16) {
  147. return boder_pixel_300 * 2;
  148. }
  149. switch (i) {
  150. case 1:
  151. return boder_pixel_360;
  152. case 2:
  153. return boder_pixel_360 * 2;
  154. default:
  155. return boder_pixel_360;
  156. }
  157. }
  158. static class AreaInfoCache {
  159. static final int SIZE_OF_EPS_INT32 = 4;
  160. private static Hashtable<Integer, Info_paper> areaInfoCache = null;
  161. private static long areaInfoTimeStamp = -1;
  162. AreaInfoCache() {
  163. }
  164. /* JADX WARNING: Removed duplicated region for block: B:79:0x015c A[SYNTHETIC, Splitter:B:79:0x015c] */
  165. /* JADX WARNING: Removed duplicated region for block: B:84:0x0164 A[SYNTHETIC, Splitter:B:84:0x0164] */
  166. /* JADX WARNING: Removed duplicated region for block: B:91:0x016b A[SYNTHETIC, Splitter:B:91:0x016b] */
  167. /* Code decompiled incorrectly, please refer to instructions dump. */
  168. public static java.util.Hashtable<java.lang.Integer, epson.common.Info_paper> getAreaInfo(android.content.Context r17, int r18) {
  169. /*
  170. java.util.Hashtable r0 = new java.util.Hashtable
  171. r0.<init>()
  172. epson.common.ExternalFileUtils r1 = epson.common.ExternalFileUtils.getInstance(r17)
  173. java.io.File r1 = r1.getAreaInfo()
  174. java.util.Hashtable<java.lang.Integer, epson.common.Info_paper> r2 = areaInfoCache
  175. if (r2 == 0) goto L_0x0025
  176. long r2 = r1.lastModified()
  177. long r4 = areaInfoTimeStamp
  178. int r6 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
  179. if (r6 != 0) goto L_0x0025
  180. java.lang.String r0 = "Info_paper"
  181. java.lang.String r1 = "Use cache areaInfo"
  182. epson.print.Util.EPLog.v(r0, r1)
  183. java.util.Hashtable<java.lang.Integer, epson.common.Info_paper> r0 = areaInfoCache
  184. return r0
  185. L_0x0025:
  186. java.lang.String r2 = "Info_paper"
  187. java.lang.String r3 = "Read areaInfo file"
  188. epson.print.Util.EPLog.v(r2, r3)
  189. r3 = 4
  190. byte[] r4 = new byte[r3] // Catch:{ FileNotFoundException -> 0x0168, IOException -> 0x0155, all -> 0x0152 }
  191. java.io.BufferedInputStream r5 = new java.io.BufferedInputStream // Catch:{ FileNotFoundException -> 0x0168, IOException -> 0x0155, all -> 0x0152 }
  192. java.io.FileInputStream r6 = new java.io.FileInputStream // Catch:{ FileNotFoundException -> 0x0168, IOException -> 0x0155, all -> 0x0152 }
  193. r6.<init>(r1) // Catch:{ FileNotFoundException -> 0x0168, IOException -> 0x0155, all -> 0x0152 }
  194. r5.<init>(r6) // Catch:{ FileNotFoundException -> 0x0168, IOException -> 0x0155, all -> 0x0152 }
  195. r6 = 0
  196. int r7 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  197. if (r3 != r7) goto L_0x0145
  198. int r7 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  199. r8 = 0
  200. L_0x0045:
  201. if (r8 >= r7) goto L_0x0139
  202. epson.common.Info_paper r9 = new epson.common.Info_paper // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  203. r9.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  204. int r10 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  205. if (r3 != r10) goto L_0x0133
  206. int r10 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  207. int r11 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  208. if (r3 != r11) goto L_0x012d
  209. int r11 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  210. r9.setPaper_width(r11) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  211. int r11 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  212. if (r3 != r11) goto L_0x0127
  213. int r11 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  214. r9.setPaper_height(r11) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  215. int r11 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  216. if (r3 != r11) goto L_0x0121
  217. int r11 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  218. r12 = 0
  219. L_0x007b:
  220. if (r12 >= r11) goto L_0x010d
  221. int r13 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  222. if (r3 != r13) goto L_0x0107
  223. int r13 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  224. int r14 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  225. if (r3 != r14) goto L_0x0101
  226. int r14 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  227. int r15 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  228. if (r3 != r15) goto L_0x00fb
  229. int r15 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  230. int r2 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  231. if (r3 != r2) goto L_0x00f5
  232. int r2 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  233. r16 = r7
  234. int r7 = r5.read(r4, r6, r3) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  235. if (r3 != r7) goto L_0x00ef
  236. int r7 = toInt(r4) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  237. switch(r13) {
  238. case 1: goto L_0x00d0;
  239. case 2: goto L_0x00b5;
  240. default: goto L_0x00b4;
  241. } // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  242. L_0x00b4:
  243. goto L_0x00ea
  244. L_0x00b5:
  245. r9.setTopMargin_border(r14) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  246. r9.setLeftMargin_border(r15) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  247. int r13 = -r14
  248. int r14 = r9.getPaper_height() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  249. int r13 = r13 + r14
  250. int r13 = r13 - r2
  251. r9.setPaper_height_boder(r13) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  252. int r2 = -r15
  253. int r13 = r9.getPaper_width() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  254. int r2 = r2 + r13
  255. int r2 = r2 - r7
  256. r9.setPaper_width_boder(r2) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  257. goto L_0x00ea
  258. L_0x00d0:
  259. r9.setTopMargin(r14) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  260. r9.setLeftMargin(r15) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  261. int r13 = -r14
  262. int r14 = r9.getPaper_height() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  263. int r13 = r13 + r14
  264. int r13 = r13 - r2
  265. r9.setPaper_height_boderless(r13) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  266. int r2 = -r15
  267. int r13 = r9.getPaper_width() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  268. int r2 = r2 + r13
  269. int r2 = r2 - r7
  270. r9.setPaper_width_boderless(r2) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  271. L_0x00ea:
  272. int r12 = r12 + 1
  273. r7 = r16
  274. goto L_0x007b
  275. L_0x00ef:
  276. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  277. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  278. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  279. L_0x00f5:
  280. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  281. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  282. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  283. L_0x00fb:
  284. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  285. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  286. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  287. L_0x0101:
  288. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  289. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  290. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  291. L_0x0107:
  292. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  293. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  294. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  295. L_0x010d:
  296. r2 = r18
  297. r16 = r7
  298. r9.setResolution(r2) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  299. java.lang.Integer r7 = java.lang.Integer.valueOf(r10) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  300. r0.put(r7, r9) // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  301. int r8 = r8 + 1
  302. r7 = r16
  303. goto L_0x0045
  304. L_0x0121:
  305. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  306. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  307. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  308. L_0x0127:
  309. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  310. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  311. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  312. L_0x012d:
  313. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  314. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  315. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  316. L_0x0133:
  317. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  318. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  319. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  320. L_0x0139:
  321. long r1 = r1.lastModified() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  322. areaInfoTimeStamp = r1 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  323. areaInfoCache = r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  324. r5.close() // Catch:{ IOException -> 0x0144 }
  325. L_0x0144:
  326. return r0
  327. L_0x0145:
  328. java.io.IOException r0 = new java.io.IOException // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  329. r0.<init>() // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  330. throw r0 // Catch:{ FileNotFoundException -> 0x0150, IOException -> 0x014d, all -> 0x014b }
  331. L_0x014b:
  332. r0 = move-exception
  333. goto L_0x0162
  334. L_0x014d:
  335. r0 = move-exception
  336. r2 = r5
  337. goto L_0x0157
  338. L_0x0150:
  339. goto L_0x0169
  340. L_0x0152:
  341. r0 = move-exception
  342. r5 = 0
  343. goto L_0x0162
  344. L_0x0155:
  345. r0 = move-exception
  346. r2 = 0
  347. L_0x0157:
  348. r0.printStackTrace() // Catch:{ all -> 0x0160 }
  349. if (r2 == 0) goto L_0x0170
  350. r2.close() // Catch:{ IOException -> 0x016e }
  351. goto L_0x016e
  352. L_0x0160:
  353. r0 = move-exception
  354. r5 = r2
  355. L_0x0162:
  356. if (r5 == 0) goto L_0x0167
  357. r5.close() // Catch:{ IOException -> 0x0167 }
  358. L_0x0167:
  359. throw r0
  360. L_0x0168:
  361. r5 = 0
  362. L_0x0169:
  363. if (r5 == 0) goto L_0x0170
  364. r5.close() // Catch:{ IOException -> 0x016e }
  365. L_0x016e:
  366. r1 = 0
  367. goto L_0x0171
  368. L_0x0170:
  369. r1 = 0
  370. L_0x0171:
  371. return r1
  372. */
  373. throw new UnsupportedOperationException("Method not decompiled: epson.common.Info_paper.AreaInfoCache.getAreaInfo(android.content.Context, int):java.util.Hashtable");
  374. }
  375. static int toInt(byte[] bArr) {
  376. int i = 0;
  377. for (int i2 = 0; i2 < 4; i2++) {
  378. i |= (bArr[i2] & UnsignedBytes.MAX_VALUE) << (i2 * 8);
  379. }
  380. return i;
  381. }
  382. }
  383. public Rect getPaperSize_2in1() {
  384. return getRect_2in1(getPaper_width(), getPaper_height(), resolution, false);
  385. }
  386. public Rect getPaperSize_4in1() {
  387. return getRect_4in1(getPaper_width(), getPaper_height(), resolution, false);
  388. }
  389. public Rect getPrintingArea_2in1() {
  390. return getRect_2in1(getPaper_width_boder(), getPaper_height_boder(), resolution, true);
  391. }
  392. public Rect getPrintingArea_4in1() {
  393. return getRect_4in1(getPaper_width_boder(), getPaper_height_boder(), resolution, true);
  394. }
  395. public static Rect getRect_2in1(int i, int i2, int i3, boolean z) {
  396. Rect rect = new Rect();
  397. int i4 = 0;
  398. if (i <= i2) {
  399. int i5 = i2 / 2;
  400. if (z) {
  401. i4 = getBorder_pixel(i3) / 2;
  402. }
  403. i2 = i5 - i4;
  404. } else {
  405. int i6 = i / 2;
  406. if (z) {
  407. i4 = getBorder_pixel(i3) / 2;
  408. }
  409. i = i6 - i4;
  410. }
  411. rect.right = i;
  412. rect.bottom = i2;
  413. return rect;
  414. }
  415. public static Rect getRect_4in1(int i, int i2, int i3, boolean z) {
  416. Rect rect = new Rect();
  417. int i4 = 0;
  418. rect.right = (i / 2) - (z ? getBorder_pixel(i3) / 2 : 0);
  419. int i5 = i2 / 2;
  420. if (z) {
  421. i4 = getBorder_pixel(i3) / 2;
  422. }
  423. rect.bottom = i5 - i4;
  424. return rect;
  425. }
  426. public static int[] getMultiLayoutArea(int i, int i2, int i3, int i4) {
  427. Rect rect;
  428. if (i == 65536) {
  429. rect = getRect_2in1(i2, i3, i4, true);
  430. } else if (i == 131072 || i == 262144) {
  431. rect = getRect_4in1(i2, i3, i4, true);
  432. } else {
  433. return new int[]{i2, i3};
  434. }
  435. return new int[]{rect.width(), rect.height()};
  436. }
  437. }