summaryrefslogtreecommitdiff
path: root/src/page-view.c
blob: e18691ecd0d8d736730212121229a7af86283704 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
/* page-view.c generated by valac 0.18.1, the Vala compiler
 * generated from page-view.vala, do not modify */

/*
 * Copyright (C) 2009-2011 Canonical Ltd.
 * Author: Robert Ancell <robert.ancell@canonical.com>
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#include <glib.h>
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <string.h>
#include <stdlib.h>
#include <cairo.h>
#include <gobject/gvaluecollector.h>


#define TYPE_CROP_LOCATION (crop_location_get_type ())

#define TYPE_PAGE_VIEW (page_view_get_type ())
#define PAGE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE_VIEW, PageView))
#define PAGE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE_VIEW, PageViewClass))
#define IS_PAGE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE_VIEW))
#define IS_PAGE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE_VIEW))
#define PAGE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE_VIEW, PageViewClass))

typedef struct _PageView PageView;
typedef struct _PageViewClass PageViewClass;
typedef struct _PageViewPrivate PageViewPrivate;

#define TYPE_PAGE (page_get_type ())
#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page))
#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass))
#define IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE))
#define IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE))
#define PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE, PageClass))

typedef struct _Page Page;
typedef struct _PageClass PageClass;

#define TYPE_SCAN_DIRECTION (scan_direction_get_type ())
#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ParamSpecPageView ParamSpecPageView;

typedef enum  {
	CROP_LOCATION_NONE = 0,
	CROP_LOCATION_MIDDLE,
	CROP_LOCATION_TOP,
	CROP_LOCATION_BOTTOM,
	CROP_LOCATION_LEFT,
	CROP_LOCATION_RIGHT,
	CROP_LOCATION_TOP_LEFT,
	CROP_LOCATION_TOP_RIGHT,
	CROP_LOCATION_BOTTOM_LEFT,
	CROP_LOCATION_BOTTOM_RIGHT
} CropLocation;

struct _PageView {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PageViewPrivate * priv;
};

struct _PageViewClass {
	GTypeClass parent_class;
	void (*finalize) (PageView *self);
};

typedef enum  {
	SCAN_DIRECTION_TOP_TO_BOTTOM,
	SCAN_DIRECTION_LEFT_TO_RIGHT,
	SCAN_DIRECTION_BOTTOM_TO_TOP,
	SCAN_DIRECTION_RIGHT_TO_LEFT
} ScanDirection;

struct _PageViewPrivate {
	Page* page;
	GdkPixbuf* image;
	gboolean selected;
	gint border_width;
	gboolean update_image;
	ScanDirection scan_direction;
	gint scan_line;
	gint width;
	gint height;
	gint x_offset;
	gint y_offset;
	CropLocation crop_location;
	gdouble selected_crop_px;
	gdouble selected_crop_py;
	gint selected_crop_x;
	gint selected_crop_y;
	gint selected_crop_w;
	gint selected_crop_h;
	GdkCursorType cursor;
	gint animate_n_segments;
	gint animate_segment;
	guint animate_timeout;
};

struct _ParamSpecPageView {
	GParamSpec parent_instance;
};


static gpointer page_view_parent_class = NULL;

GType crop_location_get_type (void) G_GNUC_CONST;
gpointer page_view_ref (gpointer instance);
void page_view_unref (gpointer instance);
GParamSpec* param_spec_page_view (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_page_view (GValue* value, gpointer v_object);
void value_take_page_view (GValue* value, gpointer v_object);
gpointer value_get_page_view (const GValue* value);
GType page_view_get_type (void) G_GNUC_CONST;
gpointer page_ref (gpointer instance);
void page_unref (gpointer instance);
GParamSpec* param_spec_page (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_page (GValue* value, gpointer v_object);
void value_take_page (GValue* value, gpointer v_object);
gpointer value_get_page (const GValue* value);
GType page_get_type (void) G_GNUC_CONST;
GType scan_direction_get_type (void) G_GNUC_CONST;
#define PAGE_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PAGE_VIEW, PageViewPrivate))
enum  {
	PAGE_VIEW_DUMMY_PROPERTY
};
static void page_view_page_pixels_changed_cb (PageView* self, Page* p);
static void _page_view_page_pixels_changed_cb_page_pixels_changed (Page* _sender, gpointer self);
static void page_view_page_size_changed_cb (PageView* self, Page* p);
static void _page_view_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self);
static void page_view_page_overlay_changed_cb (PageView* self, Page* p);
static void _page_view_page_overlay_changed_cb_page_crop_changed (Page* _sender, gpointer self);
static void _page_view_page_overlay_changed_cb_page_scan_line_changed (Page* _sender, gpointer self);
static void page_view_scan_direction_changed_cb (PageView* self, Page* p);
static void _page_view_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self);
PageView* page_view_new (Page* page);
PageView* page_view_construct (GType object_type, Page* page);
Page* page_view_get_page (PageView* self);
void page_view_set_selected (PageView* self, gboolean selected);
gboolean page_view_get_selected (PageView* self);
void page_view_set_x_offset (PageView* self, gint offset);
void page_view_set_y_offset (PageView* self, gint offset);
gint page_view_get_x_offset (PageView* self);
gint page_view_get_y_offset (PageView* self);
static guchar page_view_get_sample (PageView* self, guchar* pixels, int pixels_length1, gint offset, gint x, gint depth, gint sample);
static void page_view_get_pixel (PageView* self, Page* page, gint x, gint y, guchar* pixel, int pixel_length1);
ScanDirection page_get_scan_direction (Page* self);
gint page_get_scan_width (Page* self);
gint page_get_scan_height (Page* self);
gint page_get_depth (Page* self);
gint page_get_n_channels (Page* self);
guchar* page_get_pixels (Page* self, int* result_length1);
gint page_get_rowstride (Page* self);
static void page_view_set_pixel (PageView* self, Page* page, gdouble l, gdouble r, gdouble t, gdouble b, guchar* output, int output_length1, gint offset);
static void page_view_update_preview (PageView* self, Page* page, GdkPixbuf** output_image, gint output_width, gint output_height, ScanDirection scan_direction, gint old_scan_line, gint scan_line);
gint page_get_width (Page* self);
gint page_get_height (Page* self);
gboolean page_has_data (Page* self);
static gint page_view_get_preview_width (PageView* self);
static gint page_view_get_preview_height (PageView* self);
static void page_view_update_page_view (PageView* self);
gint page_get_scan_line (Page* self);
static gint page_view_page_to_screen_x (PageView* self, gint x);
static gint page_view_page_to_screen_y (PageView* self, gint y);
static gint page_view_screen_to_page_x (PageView* self, gint x);
static gint page_view_screen_to_page_y (PageView* self, gint y);
static CropLocation page_view_get_crop_location (PageView* self, gint x, gint y);
gboolean page_has_crop (Page* self);
void page_get_crop (Page* self, gint* x, gint* y, gint* width, gint* height);
gchar* page_get_named_crop (Page* self);
void page_view_button_press (PageView* self, gint x, gint y);
void page_view_motion (PageView* self, gint x, gint y);
void page_move_crop (Page* self, gint x, gint y);
void page_set_custom_crop (Page* self, gint width, gint height);
void page_view_button_release (PageView* self, gint x, gint y);
GdkCursorType page_view_get_cursor (PageView* self);
static gboolean page_view_animation_cb (PageView* self);
static void page_view_update_animation (PageView* self);
gboolean page_is_scanning (Page* self);
static gboolean _page_view_animation_cb_gsource_func (gpointer self);
void page_view_render (PageView* self, cairo_t* context);
void page_view_set_width (PageView* self, gint width);
void page_view_set_height (PageView* self, gint height);
gint page_view_get_width (PageView* self);
gint page_view_get_height (PageView* self);
static void page_view_finalize (PageView* obj);


GType crop_location_get_type (void) {
	static volatile gsize crop_location_type_id__volatile = 0;
	if (g_once_init_enter (&crop_location_type_id__volatile)) {
		static const GEnumValue values[] = {{CROP_LOCATION_NONE, "CROP_LOCATION_NONE", "none"}, {CROP_LOCATION_MIDDLE, "CROP_LOCATION_MIDDLE", "middle"}, {CROP_LOCATION_TOP, "CROP_LOCATION_TOP", "top"}, {CROP_LOCATION_BOTTOM, "CROP_LOCATION_BOTTOM", "bottom"}, {CROP_LOCATION_LEFT, "CROP_LOCATION_LEFT", "left"}, {CROP_LOCATION_RIGHT, "CROP_LOCATION_RIGHT", "right"}, {CROP_LOCATION_TOP_LEFT, "CROP_LOCATION_TOP_LEFT", "top-left"}, {CROP_LOCATION_TOP_RIGHT, "CROP_LOCATION_TOP_RIGHT", "top-right"}, {CROP_LOCATION_BOTTOM_LEFT, "CROP_LOCATION_BOTTOM_LEFT", "bottom-left"}, {CROP_LOCATION_BOTTOM_RIGHT, "CROP_LOCATION_BOTTOM_RIGHT", "bottom-right"}, {0, NULL, NULL}};
		GType crop_location_type_id;
		crop_location_type_id = g_enum_register_static ("CropLocation", values);
		g_once_init_leave (&crop_location_type_id__volatile, crop_location_type_id);
	}
	return crop_location_type_id__volatile;
}


static void _page_view_page_pixels_changed_cb_page_pixels_changed (Page* _sender, gpointer self) {
	page_view_page_pixels_changed_cb (self, _sender);
}


static void _page_view_page_size_changed_cb_page_size_changed (Page* _sender, gpointer self) {
	page_view_page_size_changed_cb (self, _sender);
}


static void _page_view_page_overlay_changed_cb_page_crop_changed (Page* _sender, gpointer self) {
	page_view_page_overlay_changed_cb (self, _sender);
}


static void _page_view_page_overlay_changed_cb_page_scan_line_changed (Page* _sender, gpointer self) {
	page_view_page_overlay_changed_cb (self, _sender);
}


static void _page_view_scan_direction_changed_cb_page_scan_direction_changed (Page* _sender, gpointer self) {
	page_view_scan_direction_changed_cb (self, _sender);
}


static gpointer _page_ref0 (gpointer self) {
	return self ? page_ref (self) : NULL;
}


PageView* page_view_construct (GType object_type, Page* page) {
	PageView* self = NULL;
	Page* _tmp0_;
	Page* _tmp1_;
	Page* _tmp2_;
	Page* _tmp3_;
	Page* _tmp4_;
	Page* _tmp5_;
	Page* _tmp6_;
	g_return_val_if_fail (page != NULL, NULL);
	self = (PageView*) g_type_create_instance (object_type);
	_tmp0_ = page;
	_tmp1_ = _page_ref0 (_tmp0_);
	_page_unref0 (self->priv->page);
	self->priv->page = _tmp1_;
	_tmp2_ = page;
	g_signal_connect (_tmp2_, "pixels-changed", (GCallback) _page_view_page_pixels_changed_cb_page_pixels_changed, self);
	_tmp3_ = page;
	g_signal_connect (_tmp3_, "size-changed", (GCallback) _page_view_page_size_changed_cb_page_size_changed, self);
	_tmp4_ = page;
	g_signal_connect (_tmp4_, "crop-changed", (GCallback) _page_view_page_overlay_changed_cb_page_crop_changed, self);
	_tmp5_ = page;
	g_signal_connect (_tmp5_, "scan-line-changed", (GCallback) _page_view_page_overlay_changed_cb_page_scan_line_changed, self);
	_tmp6_ = page;
	g_signal_connect (_tmp6_, "scan-direction-changed", (GCallback) _page_view_scan_direction_changed_cb_page_scan_direction_changed, self);
	return self;
}


PageView* page_view_new (Page* page) {
	return page_view_construct (TYPE_PAGE_VIEW, page);
}


Page* page_view_get_page (PageView* self) {
	Page* result = NULL;
	Page* _tmp0_;
	Page* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->page;
	_tmp1_ = _page_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


void page_view_set_selected (PageView* self, gboolean selected) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp4_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->priv->selected;
	if (_tmp2_) {
		gboolean _tmp3_;
		_tmp3_ = selected;
		_tmp1_ = _tmp3_;
	} else {
		_tmp1_ = FALSE;
	}
	_tmp4_ = _tmp1_;
	if (_tmp4_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_;
		gboolean _tmp8_;
		_tmp6_ = self->priv->selected;
		if (!_tmp6_) {
			gboolean _tmp7_;
			_tmp7_ = selected;
			_tmp5_ = !_tmp7_;
		} else {
			_tmp5_ = FALSE;
		}
		_tmp8_ = _tmp5_;
		_tmp0_ = _tmp8_;
	}
	_tmp9_ = _tmp0_;
	if (_tmp9_) {
		return;
	}
	_tmp10_ = selected;
	self->priv->selected = _tmp10_;
	g_signal_emit_by_name (self, "changed");
}


gboolean page_view_get_selected (PageView* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->selected;
	result = _tmp0_;
	return result;
}


void page_view_set_x_offset (PageView* self, gint offset) {
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = offset;
	self->priv->x_offset = _tmp0_;
}


void page_view_set_y_offset (PageView* self, gint offset) {
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = offset;
	self->priv->y_offset = _tmp0_;
}


gint page_view_get_x_offset (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->x_offset;
	result = _tmp0_;
	return result;
}


gint page_view_get_y_offset (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->y_offset;
	result = _tmp0_;
	return result;
}


static guchar page_view_get_sample (PageView* self, guchar* pixels, int pixels_length1, gint offset, gint x, gint depth, gint sample) {
	guchar result = '\0';
	g_return_val_if_fail (self != NULL, '\0');
	result = (guchar) 0xFF;
	return result;
}


static void page_view_get_pixel (PageView* self, Page* page, gint x, gint y, guchar* pixel, int pixel_length1) {
	Page* _tmp0_;
	ScanDirection _tmp1_ = 0;
	Page* _tmp18_;
	gint _tmp19_ = 0;
	gint depth;
	Page* _tmp20_;
	gint _tmp21_ = 0;
	gint n_channels;
	Page* _tmp22_;
	gint _tmp23_ = 0;
	guchar* _tmp24_ = NULL;
	guchar* pixels;
	gint pixels_length1;
	gint _pixels_size_;
	Page* _tmp25_;
	gint _tmp26_ = 0;
	gint _tmp27_;
	gint offset;
	gboolean _tmp28_ = FALSE;
	gint _tmp29_;
	gboolean _tmp31_;
	guchar* _tmp102_;
	gint _tmp102__length1;
	guchar* _tmp103_;
	gint _tmp103__length1;
	gint _tmp104_;
	gint _tmp105_;
	gint _tmp106_;
	gint _tmp107_;
	gint _tmp108_;
	guchar _tmp109_ = '\0';
	guchar _tmp110_;
	guchar* _tmp111_;
	gint _tmp111__length1;
	guchar* _tmp112_;
	gint _tmp112__length1;
	gint _tmp113_;
	gint _tmp114_;
	gint _tmp115_;
	gint _tmp116_;
	gint _tmp117_;
	guchar _tmp118_ = '\0';
	guchar _tmp119_;
	guchar* _tmp120_;
	gint _tmp120__length1;
	guchar* _tmp121_;
	gint _tmp121__length1;
	gint _tmp122_;
	gint _tmp123_;
	gint _tmp124_;
	gint _tmp125_;
	gint _tmp126_;
	guchar _tmp127_ = '\0';
	guchar _tmp128_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = page;
	_tmp1_ = page_get_scan_direction (_tmp0_);
	switch (_tmp1_) {
		case SCAN_DIRECTION_TOP_TO_BOTTOM:
		{
			break;
		}
		case SCAN_DIRECTION_BOTTOM_TO_TOP:
		{
			Page* _tmp2_;
			gint _tmp3_ = 0;
			gint _tmp4_;
			Page* _tmp5_;
			gint _tmp6_ = 0;
			gint _tmp7_;
			_tmp2_ = page;
			_tmp3_ = page_get_scan_width (_tmp2_);
			_tmp4_ = x;
			x = (_tmp3_ - _tmp4_) - 1;
			_tmp5_ = page;
			_tmp6_ = page_get_scan_height (_tmp5_);
			_tmp7_ = y;
			y = (_tmp6_ - _tmp7_) - 1;
			break;
		}
		case SCAN_DIRECTION_LEFT_TO_RIGHT:
		{
			gint _tmp8_;
			gint t;
			Page* _tmp9_;
			gint _tmp10_ = 0;
			gint _tmp11_;
			gint _tmp12_;
			_tmp8_ = x;
			t = _tmp8_;
			_tmp9_ = page;
			_tmp10_ = page_get_scan_width (_tmp9_);
			_tmp11_ = y;
			x = (_tmp10_ - _tmp11_) - 1;
			_tmp12_ = t;
			y = _tmp12_;
			break;
		}
		case SCAN_DIRECTION_RIGHT_TO_LEFT:
		{
			gint _tmp13_;
			gint t;
			gint _tmp14_;
			Page* _tmp15_;
			gint _tmp16_ = 0;
			gint _tmp17_;
			_tmp13_ = x;
			t = _tmp13_;
			_tmp14_ = y;
			x = _tmp14_;
			_tmp15_ = page;
			_tmp16_ = page_get_scan_height (_tmp15_);
			_tmp17_ = t;
			y = (_tmp16_ - _tmp17_) - 1;
			break;
		}
		default:
		break;
	}
	_tmp18_ = page;
	_tmp19_ = page_get_depth (_tmp18_);
	depth = _tmp19_;
	_tmp20_ = page;
	_tmp21_ = page_get_n_channels (_tmp20_);
	n_channels = _tmp21_;
	_tmp22_ = page;
	_tmp24_ = page_get_pixels (_tmp22_, &_tmp23_);
	pixels = _tmp24_;
	pixels_length1 = _tmp23_;
	_pixels_size_ = pixels_length1;
	_tmp25_ = page;
	_tmp26_ = page_get_rowstride (_tmp25_);
	_tmp27_ = y;
	offset = _tmp26_ * _tmp27_;
	_tmp29_ = depth;
	if (_tmp29_ == 8) {
		gint _tmp30_;
		_tmp30_ = n_channels;
		_tmp28_ = _tmp30_ == 3;
	} else {
		_tmp28_ = FALSE;
	}
	_tmp31_ = _tmp28_;
	if (_tmp31_) {
		gint _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		gint o;
		guchar* _tmp35_;
		gint _tmp35__length1;
		guchar* _tmp36_;
		gint _tmp36__length1;
		gint _tmp37_;
		guchar _tmp38_;
		guchar _tmp39_;
		guchar* _tmp40_;
		gint _tmp40__length1;
		guchar* _tmp41_;
		gint _tmp41__length1;
		gint _tmp42_;
		guchar _tmp43_;
		guchar _tmp44_;
		guchar* _tmp45_;
		gint _tmp45__length1;
		guchar* _tmp46_;
		gint _tmp46__length1;
		gint _tmp47_;
		guchar _tmp48_;
		guchar _tmp49_;
		_tmp32_ = offset;
		_tmp33_ = x;
		_tmp34_ = n_channels;
		o = _tmp32_ + (_tmp33_ * _tmp34_);
		_tmp35_ = pixel;
		_tmp35__length1 = pixel_length1;
		_tmp36_ = pixels;
		_tmp36__length1 = pixels_length1;
		_tmp37_ = o;
		_tmp38_ = _tmp36_[_tmp37_];
		_tmp35_[0] = _tmp38_;
		_tmp39_ = _tmp35_[0];
		_tmp40_ = pixel;
		_tmp40__length1 = pixel_length1;
		_tmp41_ = pixels;
		_tmp41__length1 = pixels_length1;
		_tmp42_ = o;
		_tmp43_ = _tmp41_[_tmp42_ + 1];
		_tmp40_[1] = _tmp43_;
		_tmp44_ = _tmp40_[1];
		_tmp45_ = pixel;
		_tmp45__length1 = pixel_length1;
		_tmp46_ = pixels;
		_tmp46__length1 = pixels_length1;
		_tmp47_ = o;
		_tmp48_ = _tmp46_[_tmp47_ + 2];
		_tmp45_[2] = _tmp48_;
		_tmp49_ = _tmp45_[2];
		return;
	} else {
		gboolean _tmp50_ = FALSE;
		gint _tmp51_;
		gboolean _tmp53_;
		_tmp51_ = depth;
		if (_tmp51_ == 8) {
			gint _tmp52_;
			_tmp52_ = n_channels;
			_tmp50_ = _tmp52_ == 1;
		} else {
			_tmp50_ = FALSE;
		}
		_tmp53_ = _tmp50_;
		if (_tmp53_) {
			guchar* _tmp54_;
			gint _tmp54__length1;
			guchar* _tmp55_;
			gint _tmp55__length1;
			guchar* _tmp56_;
			gint _tmp56__length1;
			guchar* _tmp57_;
			gint _tmp57__length1;
			gint _tmp58_;
			gint _tmp59_;
			guchar _tmp60_;
			guchar _tmp61_;
			guchar _tmp62_;
			guchar _tmp63_;
			_tmp54_ = pixel;
			_tmp54__length1 = pixel_length1;
			_tmp55_ = pixel;
			_tmp55__length1 = pixel_length1;
			_tmp56_ = pixel;
			_tmp56__length1 = pixel_length1;
			_tmp57_ = pixels;
			_tmp57__length1 = pixels_length1;
			_tmp58_ = offset;
			_tmp59_ = x;
			_tmp60_ = _tmp57_[_tmp58_ + _tmp59_];
			_tmp56_[2] = _tmp60_;
			_tmp61_ = _tmp56_[2];
			_tmp55_[1] = _tmp61_;
			_tmp62_ = _tmp55_[1];
			_tmp54_[0] = _tmp62_;
			_tmp63_ = _tmp54_[0];
			return;
		} else {
			gboolean _tmp64_ = FALSE;
			gint _tmp65_;
			gboolean _tmp67_;
			_tmp65_ = depth;
			if (_tmp65_ == 1) {
				gint _tmp66_;
				_tmp66_ = n_channels;
				_tmp64_ = _tmp66_ == 1;
			} else {
				_tmp64_ = FALSE;
			}
			_tmp67_ = _tmp64_;
			if (_tmp67_) {
				gint _tmp68_;
				gint _tmp69_;
				gint o;
				gint _tmp70_ = 0;
				guchar* _tmp71_;
				gint _tmp71__length1;
				gint _tmp72_;
				guchar _tmp73_;
				gint _tmp74_;
				guchar* _tmp75_;
				gint _tmp75__length1;
				guchar* _tmp76_;
				gint _tmp76__length1;
				guchar* _tmp77_;
				gint _tmp77__length1;
				gint _tmp78_;
				guchar _tmp79_;
				guchar _tmp80_;
				guchar _tmp81_;
				_tmp68_ = offset;
				_tmp69_ = x;
				o = _tmp68_ + (_tmp69_ / 8);
				_tmp71_ = pixels;
				_tmp71__length1 = pixels_length1;
				_tmp72_ = o;
				_tmp73_ = _tmp71_[_tmp72_];
				_tmp74_ = x;
				if (((gint) (_tmp73_ & (0x80 >> (_tmp74_ % 8)))) != 0) {
					_tmp70_ = 0x00;
				} else {
					_tmp70_ = 0xFF;
				}
				_tmp75_ = pixel;
				_tmp75__length1 = pixel_length1;
				_tmp76_ = pixel;
				_tmp76__length1 = pixel_length1;
				_tmp77_ = pixel;
				_tmp77__length1 = pixel_length1;
				_tmp78_ = _tmp70_;
				_tmp77_[2] = (guchar) _tmp78_;
				_tmp79_ = _tmp77_[2];
				_tmp76_[1] = _tmp79_;
				_tmp80_ = _tmp76_[1];
				_tmp75_[0] = _tmp80_;
				_tmp81_ = _tmp75_[0];
				return;
			} else {
				gboolean _tmp82_ = FALSE;
				gint _tmp83_;
				gboolean _tmp85_;
				_tmp83_ = depth;
				if (_tmp83_ == 2) {
					gint _tmp84_;
					_tmp84_ = n_channels;
					_tmp82_ = _tmp84_ == 1;
				} else {
					_tmp82_ = FALSE;
				}
				_tmp85_ = _tmp82_;
				if (_tmp85_) {
					gint _tmp86_[4] = {0};
					gint block_shift[4];
					gint _tmp87_;
					gint _tmp88_;
					gint o;
					guchar* _tmp89_;
					gint _tmp89__length1;
					gint _tmp90_;
					guchar _tmp91_;
					gint _tmp92_;
					gint _tmp93_;
					gint sample;
					gint _tmp94_;
					guchar* _tmp95_;
					gint _tmp95__length1;
					guchar* _tmp96_;
					gint _tmp96__length1;
					guchar* _tmp97_;
					gint _tmp97__length1;
					gint _tmp98_;
					guchar _tmp99_;
					guchar _tmp100_;
					guchar _tmp101_;
					_tmp86_[0] = 6;
					_tmp86_[1] = 4;
					_tmp86_[2] = 2;
					_tmp86_[3] = 0;
					memcpy (block_shift, _tmp86_, 4 * sizeof (gint));
					_tmp87_ = offset;
					_tmp88_ = x;
					o = _tmp87_ + (_tmp88_ / 4);
					_tmp89_ = pixels;
					_tmp89__length1 = pixels_length1;
					_tmp90_ = o;
					_tmp91_ = _tmp89_[_tmp90_];
					_tmp92_ = x;
					_tmp93_ = block_shift[_tmp92_ % 4];
					sample = (_tmp91_ >> _tmp93_) & 0x3;
					_tmp94_ = sample;
					sample = (_tmp94_ * 255) / 3;
					_tmp95_ = pixel;
					_tmp95__length1 = pixel_length1;
					_tmp96_ = pixel;
					_tmp96__length1 = pixel_length1;
					_tmp97_ = pixel;
					_tmp97__length1 = pixel_length1;
					_tmp98_ = sample;
					_tmp97_[2] = (guchar) _tmp98_;
					_tmp99_ = _tmp97_[2];
					_tmp96_[1] = _tmp99_;
					_tmp100_ = _tmp96_[1];
					_tmp95_[0] = _tmp100_;
					_tmp101_ = _tmp95_[0];
					return;
				}
			}
		}
	}
	_tmp102_ = pixel;
	_tmp102__length1 = pixel_length1;
	_tmp103_ = pixels;
	_tmp103__length1 = pixels_length1;
	_tmp104_ = offset;
	_tmp105_ = x;
	_tmp106_ = depth;
	_tmp107_ = x;
	_tmp108_ = n_channels;
	_tmp109_ = page_view_get_sample (self, _tmp103_, _tmp103__length1, _tmp104_, _tmp105_, _tmp106_, _tmp107_ * _tmp108_);
	_tmp102_[0] = _tmp109_;
	_tmp110_ = _tmp102_[0];
	_tmp111_ = pixel;
	_tmp111__length1 = pixel_length1;
	_tmp112_ = pixels;
	_tmp112__length1 = pixels_length1;
	_tmp113_ = offset;
	_tmp114_ = x;
	_tmp115_ = depth;
	_tmp116_ = x;
	_tmp117_ = n_channels;
	_tmp118_ = page_view_get_sample (self, _tmp112_, _tmp112__length1, _tmp113_, _tmp114_, _tmp115_, (_tmp116_ * _tmp117_) + 1);
	_tmp111_[1] = _tmp118_;
	_tmp119_ = _tmp111_[1];
	_tmp120_ = pixel;
	_tmp120__length1 = pixel_length1;
	_tmp121_ = pixels;
	_tmp121__length1 = pixels_length1;
	_tmp122_ = offset;
	_tmp123_ = x;
	_tmp124_ = depth;
	_tmp125_ = x;
	_tmp126_ = n_channels;
	_tmp127_ = page_view_get_sample (self, _tmp121_, _tmp121__length1, _tmp122_, _tmp123_, _tmp124_, (_tmp125_ * _tmp126_) + 2);
	_tmp120_[2] = _tmp127_;
	_tmp128_ = _tmp120_[2];
}


static void page_view_set_pixel (PageView* self, Page* page, gdouble l, gdouble r, gdouble t, gdouble b, guchar* output, int output_length1, gint offset) {
	gdouble _tmp0_;
	gint L;
	gint _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp4_;
	gint R;
	gdouble _tmp5_;
	gint T;
	gint _tmp6_;
	gdouble _tmp7_;
	gdouble _tmp9_;
	gint B;
	gdouble red;
	gdouble green;
	gdouble blue;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gdouble _tmp12_;
	gdouble _tmp13_;
	gboolean _tmp16_;
	gboolean _tmp23_;
	gboolean _tmp293_ = FALSE;
	gdouble _tmp294_;
	gint _tmp295_;
	gboolean _tmp298_;
	gboolean _tmp320_ = FALSE;
	gdouble _tmp321_;
	gint _tmp322_;
	gboolean _tmp325_;
	gboolean _tmp347_ = FALSE;
	gdouble _tmp348_;
	gint _tmp349_;
	gboolean _tmp352_;
	gboolean _tmp374_ = FALSE;
	gdouble _tmp375_;
	gint _tmp376_;
	gboolean _tmp379_;
	gdouble _tmp401_;
	gdouble _tmp402_;
	gdouble _tmp403_;
	gdouble _tmp404_;
	gdouble scale;
	guchar* _tmp405_;
	gint _tmp405__length1;
	gint _tmp406_;
	gdouble _tmp407_;
	gdouble _tmp408_;
	guchar _tmp409_;
	guchar* _tmp410_;
	gint _tmp410__length1;
	gint _tmp411_;
	gdouble _tmp412_;
	gdouble _tmp413_;
	guchar _tmp414_;
	guchar* _tmp415_;
	gint _tmp415__length1;
	gint _tmp416_;
	gdouble _tmp417_;
	gdouble _tmp418_;
	guchar _tmp419_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = l;
	L = (gint) _tmp0_;
	_tmp1_ = L;
	_tmp2_ = l;
	if (((gdouble) _tmp1_) != _tmp2_) {
		gint _tmp3_;
		_tmp3_ = L;
		L = _tmp3_ + 1;
	}
	_tmp4_ = r;
	R = (gint) _tmp4_;
	_tmp5_ = t;
	T = (gint) _tmp5_;
	_tmp6_ = T;
	_tmp7_ = t;
	if (((gdouble) _tmp6_) != _tmp7_) {
		gint _tmp8_;
		_tmp8_ = T;
		T = _tmp8_ + 1;
	}
	_tmp9_ = b;
	B = (gint) _tmp9_;
	red = 0.0;
	green = 0.0;
	blue = 0.0;
	_tmp12_ = r;
	_tmp13_ = l;
	if ((_tmp12_ - _tmp13_) <= 1.0) {
		gdouble _tmp14_;
		gdouble _tmp15_;
		_tmp14_ = r;
		_tmp15_ = l;
		_tmp11_ = ((gint) _tmp14_) == ((gint) _tmp15_);
	} else {
		_tmp11_ = FALSE;
	}
	_tmp16_ = _tmp11_;
	if (_tmp16_) {
		_tmp10_ = TRUE;
	} else {
		gboolean _tmp17_ = FALSE;
		gdouble _tmp18_;
		gdouble _tmp19_;
		gboolean _tmp22_;
		_tmp18_ = b;
		_tmp19_ = t;
		if ((_tmp18_ - _tmp19_) <= 1.0) {
			gdouble _tmp20_;
			gdouble _tmp21_;
			_tmp20_ = b;
			_tmp21_ = t;
			_tmp17_ = ((gint) _tmp20_) == ((gint) _tmp21_);
		} else {
			_tmp17_ = FALSE;
		}
		_tmp22_ = _tmp17_;
		_tmp10_ = _tmp22_;
	}
	_tmp23_ = _tmp10_;
	if (_tmp23_) {
		gboolean _tmp24_ = FALSE;
		gdouble _tmp25_;
		gdouble _tmp26_;
		gboolean _tmp29_;
		gint _tmp45_;
		gint _tmp46_;
		gdouble _tmp173_;
		gdouble _tmp174_;
		gdouble _tmp175_;
		gdouble _tmp176_;
		gdouble scale;
		guchar* _tmp177_;
		gint _tmp177__length1;
		gint _tmp178_;
		gdouble _tmp179_;
		gdouble _tmp180_;
		guchar _tmp181_;
		guchar* _tmp182_;
		gint _tmp182__length1;
		gint _tmp183_;
		gdouble _tmp184_;
		gdouble _tmp185_;
		guchar _tmp186_;
		guchar* _tmp187_;
		gint _tmp187__length1;
		gint _tmp188_;
		gdouble _tmp189_;
		gdouble _tmp190_;
		guchar _tmp191_;
		_tmp25_ = l;
		_tmp26_ = r;
		if (((gint) _tmp25_) == ((gint) _tmp26_)) {
			_tmp24_ = TRUE;
		} else {
			gdouble _tmp27_;
			gdouble _tmp28_;
			_tmp27_ = t;
			_tmp28_ = b;
			_tmp24_ = ((gint) _tmp27_) == ((gint) _tmp28_);
		}
		_tmp29_ = _tmp24_;
		if (_tmp29_) {
			guchar p[3] = {0};
			Page* _tmp30_;
			gdouble _tmp31_;
			gdouble _tmp32_;
			guchar* _tmp33_;
			gint _tmp33__length1;
			gint _tmp34_;
			guchar _tmp35_;
			guchar _tmp36_;
			guchar* _tmp37_;
			gint _tmp37__length1;
			gint _tmp38_;
			guchar _tmp39_;
			guchar _tmp40_;
			guchar* _tmp41_;
			gint _tmp41__length1;
			gint _tmp42_;
			guchar _tmp43_;
			guchar _tmp44_;
			_tmp30_ = page;
			_tmp31_ = l;
			_tmp32_ = t;
			page_view_get_pixel (self, _tmp30_, (gint) _tmp31_, (gint) _tmp32_, p, 3);
			_tmp33_ = output;
			_tmp33__length1 = output_length1;
			_tmp34_ = offset;
			_tmp35_ = p[0];
			_tmp33_[_tmp34_] = _tmp35_;
			_tmp36_ = _tmp33_[_tmp34_];
			_tmp37_ = output;
			_tmp37__length1 = output_length1;
			_tmp38_ = offset;
			_tmp39_ = p[1];
			_tmp37_[_tmp38_ + 1] = _tmp39_;
			_tmp40_ = _tmp37_[_tmp38_ + 1];
			_tmp41_ = output;
			_tmp41__length1 = output_length1;
			_tmp42_ = offset;
			_tmp43_ = p[2];
			_tmp41_[_tmp42_ + 2] = _tmp43_;
			_tmp44_ = _tmp41_[_tmp42_ + 2];
			return;
		}
		_tmp45_ = L;
		_tmp46_ = R;
		if (_tmp45_ > _tmp46_) {
			guchar p[3] = {0};
			Page* _tmp47_;
			gint _tmp48_;
			gint _tmp49_;
			gdouble _tmp50_;
			guchar _tmp51_;
			gdouble _tmp52_;
			gdouble _tmp53_;
			gint _tmp54_;
			gdouble _tmp55_;
			gdouble _tmp56_;
			guchar _tmp57_;
			gdouble _tmp58_;
			gdouble _tmp59_;
			gint _tmp60_;
			gdouble _tmp61_;
			gdouble _tmp62_;
			guchar _tmp63_;
			gdouble _tmp64_;
			gdouble _tmp65_;
			gint _tmp66_;
			gdouble _tmp67_;
			Page* _tmp89_;
			gint _tmp90_;
			gint _tmp91_;
			gdouble _tmp92_;
			guchar _tmp93_;
			gdouble _tmp94_;
			gdouble _tmp95_;
			gdouble _tmp96_;
			gint _tmp97_;
			gdouble _tmp98_;
			guchar _tmp99_;
			gdouble _tmp100_;
			gdouble _tmp101_;
			gdouble _tmp102_;
			gint _tmp103_;
			gdouble _tmp104_;
			guchar _tmp105_;
			gdouble _tmp106_;
			gdouble _tmp107_;
			gdouble _tmp108_;
			gint _tmp109_;
			_tmp47_ = page;
			_tmp48_ = R;
			_tmp49_ = T;
			page_view_get_pixel (self, _tmp47_, _tmp48_, _tmp49_ - 1, p, 3);
			_tmp50_ = red;
			_tmp51_ = p[0];
			_tmp52_ = r;
			_tmp53_ = l;
			_tmp54_ = T;
			_tmp55_ = t;
			red = _tmp50_ + ((_tmp51_ * (_tmp52_ - _tmp53_)) * (_tmp54_ - _tmp55_));
			_tmp56_ = green;
			_tmp57_ = p[1];
			_tmp58_ = r;
			_tmp59_ = l;
			_tmp60_ = T;
			_tmp61_ = t;
			green = _tmp56_ + ((_tmp57_ * (_tmp58_ - _tmp59_)) * (_tmp60_ - _tmp61_));
			_tmp62_ = blue;
			_tmp63_ = p[2];
			_tmp64_ = r;
			_tmp65_ = l;
			_tmp66_ = T;
			_tmp67_ = t;
			blue = _tmp62_ + ((_tmp63_ * (_tmp64_ - _tmp65_)) * (_tmp66_ - _tmp67_));
			{
				gint _tmp68_;
				gint y;
				_tmp68_ = T;
				y = _tmp68_;
				{
					gboolean _tmp69_;
					_tmp69_ = TRUE;
					while (TRUE) {
						gboolean _tmp70_;
						gint _tmp72_;
						gint _tmp73_;
						Page* _tmp74_;
						gint _tmp75_;
						gint _tmp76_;
						gdouble _tmp77_;
						guchar _tmp78_;
						gdouble _tmp79_;
						gdouble _tmp80_;
						gdouble _tmp81_;
						guchar _tmp82_;
						gdouble _tmp83_;
						gdouble _tmp84_;
						gdouble _tmp85_;
						guchar _tmp86_;
						gdouble _tmp87_;
						gdouble _tmp88_;
						_tmp70_ = _tmp69_;
						if (!_tmp70_) {
							gint _tmp71_;
							_tmp71_ = y;
							y = _tmp71_ + 1;
						}
						_tmp69_ = FALSE;
						_tmp72_ = y;
						_tmp73_ = B;
						if (!(_tmp72_ < _tmp73_)) {
							break;
						}
						_tmp74_ = page;
						_tmp75_ = R;
						_tmp76_ = y;
						page_view_get_pixel (self, _tmp74_, _tmp75_, _tmp76_, p, 3);
						_tmp77_ = red;
						_tmp78_ = p[0];
						_tmp79_ = r;
						_tmp80_ = l;
						red = _tmp77_ + (_tmp78_ * (_tmp79_ - _tmp80_));
						_tmp81_ = green;
						_tmp82_ = p[1];
						_tmp83_ = r;
						_tmp84_ = l;
						green = _tmp81_ + (_tmp82_ * (_tmp83_ - _tmp84_));
						_tmp85_ = blue;
						_tmp86_ = p[2];
						_tmp87_ = r;
						_tmp88_ = l;
						blue = _tmp85_ + (_tmp86_ * (_tmp87_ - _tmp88_));
					}
				}
			}
			_tmp89_ = page;
			_tmp90_ = R;
			_tmp91_ = B;
			page_view_get_pixel (self, _tmp89_, _tmp90_, _tmp91_, p, 3);
			_tmp92_ = red;
			_tmp93_ = p[0];
			_tmp94_ = r;
			_tmp95_ = l;
			_tmp96_ = b;
			_tmp97_ = B;
			red = _tmp92_ + ((_tmp93_ * (_tmp94_ - _tmp95_)) * (_tmp96_ - _tmp97_));
			_tmp98_ = green;
			_tmp99_ = p[1];
			_tmp100_ = r;
			_tmp101_ = l;
			_tmp102_ = b;
			_tmp103_ = B;
			green = _tmp98_ + ((_tmp99_ * (_tmp100_ - _tmp101_)) * (_tmp102_ - _tmp103_));
			_tmp104_ = blue;
			_tmp105_ = p[2];
			_tmp106_ = r;
			_tmp107_ = l;
			_tmp108_ = b;
			_tmp109_ = B;
			blue = _tmp104_ + ((_tmp105_ * (_tmp106_ - _tmp107_)) * (_tmp108_ - _tmp109_));
		} else {
			guchar p[3] = {0};
			Page* _tmp110_;
			gint _tmp111_;
			gint _tmp112_;
			gdouble _tmp113_;
			guchar _tmp114_;
			gdouble _tmp115_;
			gdouble _tmp116_;
			gint _tmp117_;
			gdouble _tmp118_;
			gdouble _tmp119_;
			guchar _tmp120_;
			gdouble _tmp121_;
			gdouble _tmp122_;
			gint _tmp123_;
			gdouble _tmp124_;
			gdouble _tmp125_;
			guchar _tmp126_;
			gdouble _tmp127_;
			gdouble _tmp128_;
			gint _tmp129_;
			gdouble _tmp130_;
			Page* _tmp152_;
			gint _tmp153_;
			gint _tmp154_;
			gdouble _tmp155_;
			guchar _tmp156_;
			gdouble _tmp157_;
			gdouble _tmp158_;
			gdouble _tmp159_;
			gint _tmp160_;
			gdouble _tmp161_;
			guchar _tmp162_;
			gdouble _tmp163_;
			gdouble _tmp164_;
			gdouble _tmp165_;
			gint _tmp166_;
			gdouble _tmp167_;
			guchar _tmp168_;
			gdouble _tmp169_;
			gdouble _tmp170_;
			gdouble _tmp171_;
			gint _tmp172_;
			_tmp110_ = page;
			_tmp111_ = L;
			_tmp112_ = B;
			page_view_get_pixel (self, _tmp110_, _tmp111_ - 1, _tmp112_, p, 3);
			_tmp113_ = red;
			_tmp114_ = p[0];
			_tmp115_ = b;
			_tmp116_ = t;
			_tmp117_ = L;
			_tmp118_ = l;
			red = _tmp113_ + ((_tmp114_ * (_tmp115_ - _tmp116_)) * (_tmp117_ - _tmp118_));
			_tmp119_ = green;
			_tmp120_ = p[1];
			_tmp121_ = b;
			_tmp122_ = t;
			_tmp123_ = L;
			_tmp124_ = l;
			green = _tmp119_ + ((_tmp120_ * (_tmp121_ - _tmp122_)) * (_tmp123_ - _tmp124_));
			_tmp125_ = blue;
			_tmp126_ = p[2];
			_tmp127_ = b;
			_tmp128_ = t;
			_tmp129_ = L;
			_tmp130_ = l;
			blue = _tmp125_ + ((_tmp126_ * (_tmp127_ - _tmp128_)) * (_tmp129_ - _tmp130_));
			{
				gint _tmp131_;
				gint x;
				_tmp131_ = L;
				x = _tmp131_;
				{
					gboolean _tmp132_;
					_tmp132_ = TRUE;
					while (TRUE) {
						gboolean _tmp133_;
						gint _tmp135_;
						gint _tmp136_;
						Page* _tmp137_;
						gint _tmp138_;
						gint _tmp139_;
						gdouble _tmp140_;
						guchar _tmp141_;
						gdouble _tmp142_;
						gdouble _tmp143_;
						gdouble _tmp144_;
						guchar _tmp145_;
						gdouble _tmp146_;
						gdouble _tmp147_;
						gdouble _tmp148_;
						guchar _tmp149_;
						gdouble _tmp150_;
						gdouble _tmp151_;
						_tmp133_ = _tmp132_;
						if (!_tmp133_) {
							gint _tmp134_;
							_tmp134_ = x;
							x = _tmp134_ + 1;
						}
						_tmp132_ = FALSE;
						_tmp135_ = x;
						_tmp136_ = R;
						if (!(_tmp135_ < _tmp136_)) {
							break;
						}
						_tmp137_ = page;
						_tmp138_ = x;
						_tmp139_ = B;
						page_view_get_pixel (self, _tmp137_, _tmp138_, _tmp139_, p, 3);
						_tmp140_ = red;
						_tmp141_ = p[0];
						_tmp142_ = b;
						_tmp143_ = t;
						red = _tmp140_ + (_tmp141_ * (_tmp142_ - _tmp143_));
						_tmp144_ = green;
						_tmp145_ = p[1];
						_tmp146_ = b;
						_tmp147_ = t;
						green = _tmp144_ + (_tmp145_ * (_tmp146_ - _tmp147_));
						_tmp148_ = blue;
						_tmp149_ = p[2];
						_tmp150_ = b;
						_tmp151_ = t;
						blue = _tmp148_ + (_tmp149_ * (_tmp150_ - _tmp151_));
					}
				}
			}
			_tmp152_ = page;
			_tmp153_ = R;
			_tmp154_ = B;
			page_view_get_pixel (self, _tmp152_, _tmp153_, _tmp154_, p, 3);
			_tmp155_ = red;
			_tmp156_ = p[0];
			_tmp157_ = b;
			_tmp158_ = t;
			_tmp159_ = r;
			_tmp160_ = R;
			red = _tmp155_ + ((_tmp156_ * (_tmp157_ - _tmp158_)) * (_tmp159_ - _tmp160_));
			_tmp161_ = green;
			_tmp162_ = p[1];
			_tmp163_ = b;
			_tmp164_ = t;
			_tmp165_ = r;
			_tmp166_ = R;
			green = _tmp161_ + ((_tmp162_ * (_tmp163_ - _tmp164_)) * (_tmp165_ - _tmp166_));
			_tmp167_ = blue;
			_tmp168_ = p[2];
			_tmp169_ = b;
			_tmp170_ = t;
			_tmp171_ = r;
			_tmp172_ = R;
			blue = _tmp167_ + ((_tmp168_ * (_tmp169_ - _tmp170_)) * (_tmp171_ - _tmp172_));
		}
		_tmp173_ = r;
		_tmp174_ = l;
		_tmp175_ = b;
		_tmp176_ = t;
		scale = 1.0 / ((_tmp173_ - _tmp174_) * (_tmp175_ - _tmp176_));
		_tmp177_ = output;
		_tmp177__length1 = output_length1;
		_tmp178_ = offset;
		_tmp179_ = red;
		_tmp180_ = scale;
		_tmp177_[_tmp178_] = (guchar) ((_tmp179_ * _tmp180_) + 0.5);
		_tmp181_ = _tmp177_[_tmp178_];
		_tmp182_ = output;
		_tmp182__length1 = output_length1;
		_tmp183_ = offset;
		_tmp184_ = green;
		_tmp185_ = scale;
		_tmp182_[_tmp183_ + 1] = (guchar) ((_tmp184_ * _tmp185_) + 0.5);
		_tmp186_ = _tmp182_[_tmp183_ + 1];
		_tmp187_ = output;
		_tmp187__length1 = output_length1;
		_tmp188_ = offset;
		_tmp189_ = blue;
		_tmp190_ = scale;
		_tmp187_[_tmp188_ + 2] = (guchar) ((_tmp189_ * _tmp190_) + 0.5);
		_tmp191_ = _tmp187_[_tmp188_ + 2];
		return;
	}
	{
		gint _tmp192_;
		gint x;
		_tmp192_ = L;
		x = _tmp192_;
		{
			gboolean _tmp193_;
			_tmp193_ = TRUE;
			while (TRUE) {
				gboolean _tmp194_;
				gint _tmp196_;
				gint _tmp197_;
				_tmp194_ = _tmp193_;
				if (!_tmp194_) {
					gint _tmp195_;
					_tmp195_ = x;
					x = _tmp195_ + 1;
				}
				_tmp193_ = FALSE;
				_tmp196_ = x;
				_tmp197_ = R;
				if (!(_tmp196_ < _tmp197_)) {
					break;
				}
				{
					gint _tmp198_;
					gint y;
					_tmp198_ = T;
					y = _tmp198_;
					{
						gboolean _tmp199_;
						_tmp199_ = TRUE;
						while (TRUE) {
							gboolean _tmp200_;
							gint _tmp202_;
							gint _tmp203_;
							guchar p[3] = {0};
							Page* _tmp204_;
							gint _tmp205_;
							gint _tmp206_;
							gdouble _tmp207_;
							guchar _tmp208_;
							gdouble _tmp209_;
							guchar _tmp210_;
							gdouble _tmp211_;
							guchar _tmp212_;
							_tmp200_ = _tmp199_;
							if (!_tmp200_) {
								gint _tmp201_;
								_tmp201_ = y;
								y = _tmp201_ + 1;
							}
							_tmp199_ = FALSE;
							_tmp202_ = y;
							_tmp203_ = B;
							if (!(_tmp202_ < _tmp203_)) {
								break;
							}
							_tmp204_ = page;
							_tmp205_ = x;
							_tmp206_ = y;
							page_view_get_pixel (self, _tmp204_, _tmp205_, _tmp206_, p, 3);
							_tmp207_ = red;
							_tmp208_ = p[0];
							red = _tmp207_ + _tmp208_;
							_tmp209_ = green;
							_tmp210_ = p[1];
							green = _tmp209_ + _tmp210_;
							_tmp211_ = blue;
							_tmp212_ = p[2];
							blue = _tmp211_ + _tmp212_;
						}
					}
				}
			}
		}
	}
	{
		gint _tmp213_;
		gint x;
		_tmp213_ = L;
		x = _tmp213_;
		{
			gboolean _tmp214_;
			_tmp214_ = TRUE;
			while (TRUE) {
				gboolean _tmp215_;
				gint _tmp217_;
				gint _tmp218_;
				gdouble _tmp219_;
				gint _tmp220_;
				gdouble _tmp236_;
				gint _tmp237_;
				_tmp215_ = _tmp214_;
				if (!_tmp215_) {
					gint _tmp216_;
					_tmp216_ = x;
					x = _tmp216_ + 1;
				}
				_tmp214_ = FALSE;
				_tmp217_ = x;
				_tmp218_ = R;
				if (!(_tmp217_ < _tmp218_)) {
					break;
				}
				_tmp219_ = t;
				_tmp220_ = T;
				if (_tmp219_ != ((gdouble) _tmp220_)) {
					guchar p[3] = {0};
					Page* _tmp221_;
					gint _tmp222_;
					gint _tmp223_;
					gdouble _tmp224_;
					guchar _tmp225_;
					gint _tmp226_;
					gdouble _tmp227_;
					gdouble _tmp228_;
					guchar _tmp229_;
					gint _tmp230_;
					gdouble _tmp231_;
					gdouble _tmp232_;
					guchar _tmp233_;
					gint _tmp234_;
					gdouble _tmp235_;
					_tmp221_ = page;
					_tmp222_ = x;
					_tmp223_ = T;
					page_view_get_pixel (self, _tmp221_, _tmp222_, _tmp223_ - 1, p, 3);
					_tmp224_ = red;
					_tmp225_ = p[0];
					_tmp226_ = T;
					_tmp227_ = t;
					red = _tmp224_ + (_tmp225_ * (_tmp226_ - _tmp227_));
					_tmp228_ = green;
					_tmp229_ = p[1];
					_tmp230_ = T;
					_tmp231_ = t;
					green = _tmp228_ + (_tmp229_ * (_tmp230_ - _tmp231_));
					_tmp232_ = blue;
					_tmp233_ = p[2];
					_tmp234_ = T;
					_tmp235_ = t;
					blue = _tmp232_ + (_tmp233_ * (_tmp234_ - _tmp235_));
				}
				_tmp236_ = b;
				_tmp237_ = B;
				if (_tmp236_ != ((gdouble) _tmp237_)) {
					guchar p[3] = {0};
					Page* _tmp238_;
					gint _tmp239_;
					gint _tmp240_;
					gdouble _tmp241_;
					guchar _tmp242_;
					gdouble _tmp243_;
					gint _tmp244_;
					gdouble _tmp245_;
					guchar _tmp246_;
					gdouble _tmp247_;
					gint _tmp248_;
					gdouble _tmp249_;
					guchar _tmp250_;
					gdouble _tmp251_;
					gint _tmp252_;
					_tmp238_ = page;
					_tmp239_ = x;
					_tmp240_ = B;
					page_view_get_pixel (self, _tmp238_, _tmp239_, _tmp240_, p, 3);
					_tmp241_ = red;
					_tmp242_ = p[0];
					_tmp243_ = b;
					_tmp244_ = B;
					red = _tmp241_ + (_tmp242_ * (_tmp243_ - _tmp244_));
					_tmp245_ = green;
					_tmp246_ = p[1];
					_tmp247_ = b;
					_tmp248_ = B;
					green = _tmp245_ + (_tmp246_ * (_tmp247_ - _tmp248_));
					_tmp249_ = blue;
					_tmp250_ = p[2];
					_tmp251_ = b;
					_tmp252_ = B;
					blue = _tmp249_ + (_tmp250_ * (_tmp251_ - _tmp252_));
				}
			}
		}
	}
	{
		gint _tmp253_;
		gint y;
		_tmp253_ = T;
		y = _tmp253_;
		{
			gboolean _tmp254_;
			_tmp254_ = TRUE;
			while (TRUE) {
				gboolean _tmp255_;
				gint _tmp257_;
				gint _tmp258_;
				gdouble _tmp259_;
				gint _tmp260_;
				gdouble _tmp276_;
				gint _tmp277_;
				_tmp255_ = _tmp254_;
				if (!_tmp255_) {
					gint _tmp256_;
					_tmp256_ = y;
					y = _tmp256_ + 1;
				}
				_tmp254_ = FALSE;
				_tmp257_ = y;
				_tmp258_ = B;
				if (!(_tmp257_ < _tmp258_)) {
					break;
				}
				_tmp259_ = l;
				_tmp260_ = L;
				if (_tmp259_ != ((gdouble) _tmp260_)) {
					guchar p[3] = {0};
					Page* _tmp261_;
					gint _tmp262_;
					gint _tmp263_;
					gdouble _tmp264_;
					guchar _tmp265_;
					gint _tmp266_;
					gdouble _tmp267_;
					gdouble _tmp268_;
					guchar _tmp269_;
					gint _tmp270_;
					gdouble _tmp271_;
					gdouble _tmp272_;
					guchar _tmp273_;
					gint _tmp274_;
					gdouble _tmp275_;
					_tmp261_ = page;
					_tmp262_ = L;
					_tmp263_ = y;
					page_view_get_pixel (self, _tmp261_, _tmp262_ - 1, _tmp263_, p, 3);
					_tmp264_ = red;
					_tmp265_ = p[0];
					_tmp266_ = L;
					_tmp267_ = l;
					red = _tmp264_ + (_tmp265_ * (_tmp266_ - _tmp267_));
					_tmp268_ = green;
					_tmp269_ = p[1];
					_tmp270_ = L;
					_tmp271_ = l;
					green = _tmp268_ + (_tmp269_ * (_tmp270_ - _tmp271_));
					_tmp272_ = blue;
					_tmp273_ = p[2];
					_tmp274_ = L;
					_tmp275_ = l;
					blue = _tmp272_ + (_tmp273_ * (_tmp274_ - _tmp275_));
				}
				_tmp276_ = r;
				_tmp277_ = R;
				if (_tmp276_ != ((gdouble) _tmp277_)) {
					guchar p[3] = {0};
					Page* _tmp278_;
					gint _tmp279_;
					gint _tmp280_;
					gdouble _tmp281_;
					guchar _tmp282_;
					gdouble _tmp283_;
					gint _tmp284_;
					gdouble _tmp285_;
					guchar _tmp286_;
					gdouble _tmp287_;
					gint _tmp288_;
					gdouble _tmp289_;
					guchar _tmp290_;
					gdouble _tmp291_;
					gint _tmp292_;
					_tmp278_ = page;
					_tmp279_ = R;
					_tmp280_ = y;
					page_view_get_pixel (self, _tmp278_, _tmp279_, _tmp280_, p, 3);
					_tmp281_ = red;
					_tmp282_ = p[0];
					_tmp283_ = r;
					_tmp284_ = R;
					red = _tmp281_ + (_tmp282_ * (_tmp283_ - _tmp284_));
					_tmp285_ = green;
					_tmp286_ = p[1];
					_tmp287_ = r;
					_tmp288_ = R;
					green = _tmp285_ + (_tmp286_ * (_tmp287_ - _tmp288_));
					_tmp289_ = blue;
					_tmp290_ = p[2];
					_tmp291_ = r;
					_tmp292_ = R;
					blue = _tmp289_ + (_tmp290_ * (_tmp291_ - _tmp292_));
				}
			}
		}
	}
	_tmp294_ = l;
	_tmp295_ = L;
	if (_tmp294_ != ((gdouble) _tmp295_)) {
		gdouble _tmp296_;
		gint _tmp297_;
		_tmp296_ = t;
		_tmp297_ = T;
		_tmp293_ = _tmp296_ != ((gdouble) _tmp297_);
	} else {
		_tmp293_ = FALSE;
	}
	_tmp298_ = _tmp293_;
	if (_tmp298_) {
		guchar p[3] = {0};
		Page* _tmp299_;
		gint _tmp300_;
		gint _tmp301_;
		gdouble _tmp302_;
		guchar _tmp303_;
		gint _tmp304_;
		gdouble _tmp305_;
		gint _tmp306_;
		gdouble _tmp307_;
		gdouble _tmp308_;
		guchar _tmp309_;
		gint _tmp310_;
		gdouble _tmp311_;
		gint _tmp312_;
		gdouble _tmp313_;
		gdouble _tmp314_;
		guchar _tmp315_;
		gint _tmp316_;
		gdouble _tmp317_;
		gint _tmp318_;
		gdouble _tmp319_;
		_tmp299_ = page;
		_tmp300_ = L;
		_tmp301_ = T;
		page_view_get_pixel (self, _tmp299_, _tmp300_ - 1, _tmp301_ - 1, p, 3);
		_tmp302_ = red;
		_tmp303_ = p[0];
		_tmp304_ = L;
		_tmp305_ = l;
		_tmp306_ = T;
		_tmp307_ = t;
		red = _tmp302_ + ((_tmp303_ * (_tmp304_ - _tmp305_)) * (_tmp306_ - _tmp307_));
		_tmp308_ = green;
		_tmp309_ = p[1];
		_tmp310_ = L;
		_tmp311_ = l;
		_tmp312_ = T;
		_tmp313_ = t;
		green = _tmp308_ + ((_tmp309_ * (_tmp310_ - _tmp311_)) * (_tmp312_ - _tmp313_));
		_tmp314_ = blue;
		_tmp315_ = p[2];
		_tmp316_ = L;
		_tmp317_ = l;
		_tmp318_ = T;
		_tmp319_ = t;
		blue = _tmp314_ + ((_tmp315_ * (_tmp316_ - _tmp317_)) * (_tmp318_ - _tmp319_));
	}
	_tmp321_ = r;
	_tmp322_ = R;
	if (_tmp321_ != ((gdouble) _tmp322_)) {
		gdouble _tmp323_;
		gint _tmp324_;
		_tmp323_ = t;
		_tmp324_ = T;
		_tmp320_ = _tmp323_ != ((gdouble) _tmp324_);
	} else {
		_tmp320_ = FALSE;
	}
	_tmp325_ = _tmp320_;
	if (_tmp325_) {
		guchar p[3] = {0};
		Page* _tmp326_;
		gint _tmp327_;
		gint _tmp328_;
		gdouble _tmp329_;
		guchar _tmp330_;
		gdouble _tmp331_;
		gint _tmp332_;
		gint _tmp333_;
		gdouble _tmp334_;
		gdouble _tmp335_;
		guchar _tmp336_;
		gdouble _tmp337_;
		gint _tmp338_;
		gint _tmp339_;
		gdouble _tmp340_;
		gdouble _tmp341_;
		guchar _tmp342_;
		gdouble _tmp343_;
		gint _tmp344_;
		gint _tmp345_;
		gdouble _tmp346_;
		_tmp326_ = page;
		_tmp327_ = R;
		_tmp328_ = T;
		page_view_get_pixel (self, _tmp326_, _tmp327_, _tmp328_ - 1, p, 3);
		_tmp329_ = red;
		_tmp330_ = p[0];
		_tmp331_ = r;
		_tmp332_ = R;
		_tmp333_ = T;
		_tmp334_ = t;
		red = _tmp329_ + ((_tmp330_ * (_tmp331_ - _tmp332_)) * (_tmp333_ - _tmp334_));
		_tmp335_ = green;
		_tmp336_ = p[1];
		_tmp337_ = r;
		_tmp338_ = R;
		_tmp339_ = T;
		_tmp340_ = t;
		green = _tmp335_ + ((_tmp336_ * (_tmp337_ - _tmp338_)) * (_tmp339_ - _tmp340_));
		_tmp341_ = blue;
		_tmp342_ = p[2];
		_tmp343_ = r;
		_tmp344_ = R;
		_tmp345_ = T;
		_tmp346_ = t;
		blue = _tmp341_ + ((_tmp342_ * (_tmp343_ - _tmp344_)) * (_tmp345_ - _tmp346_));
	}
	_tmp348_ = r;
	_tmp349_ = R;
	if (_tmp348_ != ((gdouble) _tmp349_)) {
		gdouble _tmp350_;
		gint _tmp351_;
		_tmp350_ = b;
		_tmp351_ = B;
		_tmp347_ = _tmp350_ != ((gdouble) _tmp351_);
	} else {
		_tmp347_ = FALSE;
	}
	_tmp352_ = _tmp347_;
	if (_tmp352_) {
		guchar p[3] = {0};
		Page* _tmp353_;
		gint _tmp354_;
		gint _tmp355_;
		gdouble _tmp356_;
		guchar _tmp357_;
		gdouble _tmp358_;
		gint _tmp359_;
		gdouble _tmp360_;
		gint _tmp361_;
		gdouble _tmp362_;
		guchar _tmp363_;
		gdouble _tmp364_;
		gint _tmp365_;
		gdouble _tmp366_;
		gint _tmp367_;
		gdouble _tmp368_;
		guchar _tmp369_;
		gdouble _tmp370_;
		gint _tmp371_;
		gdouble _tmp372_;
		gint _tmp373_;
		_tmp353_ = page;
		_tmp354_ = R;
		_tmp355_ = B;
		page_view_get_pixel (self, _tmp353_, _tmp354_, _tmp355_, p, 3);
		_tmp356_ = red;
		_tmp357_ = p[0];
		_tmp358_ = r;
		_tmp359_ = R;
		_tmp360_ = b;
		_tmp361_ = B;
		red = _tmp356_ + ((_tmp357_ * (_tmp358_ - _tmp359_)) * (_tmp360_ - _tmp361_));
		_tmp362_ = green;
		_tmp363_ = p[1];
		_tmp364_ = r;
		_tmp365_ = R;
		_tmp366_ = b;
		_tmp367_ = B;
		green = _tmp362_ + ((_tmp363_ * (_tmp364_ - _tmp365_)) * (_tmp366_ - _tmp367_));
		_tmp368_ = blue;
		_tmp369_ = p[2];
		_tmp370_ = r;
		_tmp371_ = R;
		_tmp372_ = b;
		_tmp373_ = B;
		blue = _tmp368_ + ((_tmp369_ * (_tmp370_ - _tmp371_)) * (_tmp372_ - _tmp373_));
	}
	_tmp375_ = l;
	_tmp376_ = L;
	if (_tmp375_ != ((gdouble) _tmp376_)) {
		gdouble _tmp377_;
		gint _tmp378_;
		_tmp377_ = b;
		_tmp378_ = B;
		_tmp374_ = _tmp377_ != ((gdouble) _tmp378_);
	} else {
		_tmp374_ = FALSE;
	}
	_tmp379_ = _tmp374_;
	if (_tmp379_) {
		guchar p[3] = {0};
		Page* _tmp380_;
		gint _tmp381_;
		gint _tmp382_;
		gdouble _tmp383_;
		guchar _tmp384_;
		gint _tmp385_;
		gdouble _tmp386_;
		gdouble _tmp387_;
		gint _tmp388_;
		gdouble _tmp389_;
		guchar _tmp390_;
		gint _tmp391_;
		gdouble _tmp392_;
		gdouble _tmp393_;
		gint _tmp394_;
		gdouble _tmp395_;
		guchar _tmp396_;
		gint _tmp397_;
		gdouble _tmp398_;
		gdouble _tmp399_;
		gint _tmp400_;
		_tmp380_ = page;
		_tmp381_ = L;
		_tmp382_ = B;
		page_view_get_pixel (self, _tmp380_, _tmp381_ - 1, _tmp382_, p, 3);
		_tmp383_ = red;
		_tmp384_ = p[0];
		_tmp385_ = L;
		_tmp386_ = l;
		_tmp387_ = b;
		_tmp388_ = B;
		red = _tmp383_ + ((_tmp384_ * (_tmp385_ - _tmp386_)) * (_tmp387_ - _tmp388_));
		_tmp389_ = green;
		_tmp390_ = p[1];
		_tmp391_ = L;
		_tmp392_ = l;
		_tmp393_ = b;
		_tmp394_ = B;
		green = _tmp389_ + ((_tmp390_ * (_tmp391_ - _tmp392_)) * (_tmp393_ - _tmp394_));
		_tmp395_ = blue;
		_tmp396_ = p[2];
		_tmp397_ = L;
		_tmp398_ = l;
		_tmp399_ = b;
		_tmp400_ = B;
		blue = _tmp395_ + ((_tmp396_ * (_tmp397_ - _tmp398_)) * (_tmp399_ - _tmp400_));
	}
	_tmp401_ = r;
	_tmp402_ = l;
	_tmp403_ = b;
	_tmp404_ = t;
	scale = 1.0 / ((_tmp401_ - _tmp402_) * (_tmp403_ - _tmp404_));
	_tmp405_ = output;
	_tmp405__length1 = output_length1;
	_tmp406_ = offset;
	_tmp407_ = red;
	_tmp408_ = scale;
	_tmp405_[_tmp406_] = (guchar) ((_tmp407_ * _tmp408_) + 0.5);
	_tmp409_ = _tmp405_[_tmp406_];
	_tmp410_ = output;
	_tmp410__length1 = output_length1;
	_tmp411_ = offset;
	_tmp412_ = green;
	_tmp413_ = scale;
	_tmp410_[_tmp411_ + 1] = (guchar) ((_tmp412_ * _tmp413_) + 0.5);
	_tmp414_ = _tmp410_[_tmp411_ + 1];
	_tmp415_ = output;
	_tmp415__length1 = output_length1;
	_tmp416_ = offset;
	_tmp417_ = blue;
	_tmp418_ = scale;
	_tmp415_[_tmp416_ + 2] = (guchar) ((_tmp417_ * _tmp418_) + 0.5);
	_tmp419_ = _tmp415_[_tmp416_ + 2];
}


static void page_view_update_preview (PageView* self, Page* page, GdkPixbuf** output_image, gint output_width, gint output_height, ScanDirection scan_direction, gint old_scan_line, gint scan_line) {
	Page* _tmp0_;
	gint _tmp1_ = 0;
	gint input_width;
	Page* _tmp2_;
	gint _tmp3_ = 0;
	gint input_height;
	gint L = 0;
	gint R = 0;
	gint T = 0;
	gint B = 0;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	GdkPixbuf* _tmp6_;
	gboolean _tmp10_;
	gboolean _tmp14_;
	gint _tmp56_;
	gint _tmp57_;
	gint _tmp59_;
	gint _tmp60_;
	gint _tmp62_;
	gint _tmp63_;
	gint _tmp64_;
	gint _tmp65_;
	gint _tmp66_;
	gint _tmp67_;
	GdkPixbuf* _tmp68_;
	GdkPixbuf* _tmp69_;
	guint8* _tmp70_ = NULL;
	guchar* output;
	gint output_length1;
	gint _output_size_;
	GdkPixbuf* _tmp71_;
	gint _tmp72_ = 0;
	gint output_rowstride;
	GdkPixbuf* _tmp73_;
	gint _tmp74_ = 0;
	gint output_n_channels;
	Page* _tmp75_;
	gboolean _tmp76_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = page;
	_tmp1_ = page_get_width (_tmp0_);
	input_width = _tmp1_;
	_tmp2_ = page;
	_tmp3_ = page_get_height (_tmp2_);
	input_height = _tmp3_;
	_tmp6_ = *output_image;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		GdkPixbuf* _tmp7_;
		gint _tmp8_ = 0;
		gint _tmp9_;
		_tmp7_ = *output_image;
		_tmp8_ = gdk_pixbuf_get_width (_tmp7_);
		_tmp9_ = output_width;
		_tmp5_ = _tmp8_ != _tmp9_;
	}
	_tmp10_ = _tmp5_;
	if (_tmp10_) {
		_tmp4_ = TRUE;
	} else {
		GdkPixbuf* _tmp11_;
		gint _tmp12_ = 0;
		gint _tmp13_;
		_tmp11_ = *output_image;
		_tmp12_ = gdk_pixbuf_get_height (_tmp11_);
		_tmp13_ = output_height;
		_tmp4_ = _tmp12_ != _tmp13_;
	}
	_tmp14_ = _tmp4_;
	if (_tmp14_) {
		gint _tmp15_;
		gint _tmp16_;
		GdkPixbuf* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		_tmp15_ = output_width;
		_tmp16_ = output_height;
		_tmp17_ = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, _tmp15_, _tmp16_);
		_g_object_unref0 (*output_image);
		*output_image = _tmp17_;
		L = 0;
		_tmp18_ = output_width;
		R = _tmp18_ - 1;
		T = 0;
		_tmp19_ = output_height;
		B = _tmp19_ - 1;
	} else {
		ScanDirection _tmp20_;
		_tmp20_ = scan_direction;
		switch (_tmp20_) {
			case SCAN_DIRECTION_TOP_TO_BOTTOM:
			{
				gint _tmp21_;
				gint _tmp22_;
				gint _tmp23_;
				gint _tmp24_;
				gint _tmp25_;
				gint _tmp26_;
				gint _tmp27_;
				L = 0;
				_tmp21_ = output_width;
				R = _tmp21_ - 1;
				_tmp22_ = old_scan_line;
				_tmp23_ = output_height;
				_tmp24_ = input_height;
				T = (gint) ((((gdouble) _tmp22_) * _tmp23_) / _tmp24_);
				_tmp25_ = scan_line;
				_tmp26_ = output_height;
				_tmp27_ = input_height;
				B = (gint) (((((gdouble) _tmp25_) * _tmp26_) / _tmp27_) + 0.5);
				break;
			}
			case SCAN_DIRECTION_LEFT_TO_RIGHT:
			{
				gint _tmp28_;
				gint _tmp29_;
				gint _tmp30_;
				gint _tmp31_;
				gint _tmp32_;
				gint _tmp33_;
				gint _tmp34_;
				_tmp28_ = old_scan_line;
				_tmp29_ = output_width;
				_tmp30_ = input_width;
				L = (gint) ((((gdouble) _tmp28_) * _tmp29_) / _tmp30_);
				_tmp31_ = scan_line;
				_tmp32_ = output_width;
				_tmp33_ = input_width;
				R = (gint) (((((gdouble) _tmp31_) * _tmp32_) / _tmp33_) + 0.5);
				T = 0;
				_tmp34_ = output_height;
				B = _tmp34_ - 1;
				break;
			}
			case SCAN_DIRECTION_BOTTOM_TO_TOP:
			{
				gint _tmp35_;
				gint _tmp36_;
				gint _tmp37_;
				gint _tmp38_;
				gint _tmp39_;
				gint _tmp40_;
				gint _tmp41_;
				gint _tmp42_;
				gint _tmp43_;
				L = 0;
				_tmp35_ = output_width;
				R = _tmp35_ - 1;
				_tmp36_ = input_height;
				_tmp37_ = scan_line;
				_tmp38_ = output_height;
				_tmp39_ = input_height;
				T = (gint) ((((gdouble) (_tmp36_ - _tmp37_)) * _tmp38_) / _tmp39_);
				_tmp40_ = input_height;
				_tmp41_ = old_scan_line;
				_tmp42_ = output_height;
				_tmp43_ = input_height;
				B = (gint) (((((gdouble) (_tmp40_ - _tmp41_)) * _tmp42_) / _tmp43_) + 0.5);
				break;
			}
			case SCAN_DIRECTION_RIGHT_TO_LEFT:
			{
				gint _tmp44_;
				gint _tmp45_;
				gint _tmp46_;
				gint _tmp47_;
				gint _tmp48_;
				gint _tmp49_;
				gint _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				_tmp44_ = input_width;
				_tmp45_ = scan_line;
				_tmp46_ = output_width;
				_tmp47_ = input_width;
				L = (gint) ((((gdouble) (_tmp44_ - _tmp45_)) * _tmp46_) / _tmp47_);
				_tmp48_ = input_width;
				_tmp49_ = old_scan_line;
				_tmp50_ = output_width;
				_tmp51_ = input_width;
				R = (gint) (((((gdouble) (_tmp48_ - _tmp49_)) * _tmp50_) / _tmp51_) + 0.5);
				T = 0;
				_tmp52_ = output_height;
				B = _tmp52_ - 1;
				break;
			}
			default:
			{
				gint _tmp53_;
				gint _tmp54_;
				gint _tmp55_;
				T = 0;
				_tmp53_ = T;
				B = _tmp53_;
				_tmp54_ = B;
				R = _tmp54_;
				_tmp55_ = R;
				L = _tmp55_;
				break;
			}
		}
	}
	_tmp56_ = R;
	_tmp57_ = output_width;
	if (_tmp56_ >= _tmp57_) {
		gint _tmp58_;
		_tmp58_ = output_width;
		R = _tmp58_ - 1;
	}
	_tmp59_ = B;
	_tmp60_ = output_height;
	if (_tmp59_ >= _tmp60_) {
		gint _tmp61_;
		_tmp61_ = output_height;
		B = _tmp61_ - 1;
	}
	_tmp62_ = L;
	g_return_if_fail (_tmp62_ >= 0);
	_tmp63_ = R;
	_tmp64_ = output_width;
	g_return_if_fail (_tmp63_ < _tmp64_);
	_tmp65_ = T;
	g_return_if_fail (_tmp65_ >= 0);
	_tmp66_ = B;
	_tmp67_ = output_height;
	g_return_if_fail (_tmp66_ < _tmp67_);
	_tmp68_ = *output_image;
	g_return_if_fail (_tmp68_ != NULL);
	_tmp69_ = *output_image;
	_tmp70_ = gdk_pixbuf_get_pixels (_tmp69_);
	output = _tmp70_;
	output_length1 = -1;
	_output_size_ = output_length1;
	_tmp71_ = *output_image;
	_tmp72_ = gdk_pixbuf_get_rowstride (_tmp71_);
	output_rowstride = _tmp72_;
	_tmp73_ = *output_image;
	_tmp74_ = gdk_pixbuf_get_n_channels (_tmp73_);
	output_n_channels = _tmp74_;
	_tmp75_ = page;
	_tmp76_ = page_has_data (_tmp75_);
	if (!_tmp76_) {
		{
			gint _tmp77_;
			gint x;
			_tmp77_ = L;
			x = _tmp77_;
			{
				gboolean _tmp78_;
				_tmp78_ = TRUE;
				while (TRUE) {
					gboolean _tmp79_;
					gint _tmp81_;
					gint _tmp82_;
					_tmp79_ = _tmp78_;
					if (!_tmp79_) {
						gint _tmp80_;
						_tmp80_ = x;
						x = _tmp80_ + 1;
					}
					_tmp78_ = FALSE;
					_tmp81_ = x;
					_tmp82_ = R;
					if (!(_tmp81_ <= _tmp82_)) {
						break;
					}
					{
						gint _tmp83_;
						gint y;
						_tmp83_ = T;
						y = _tmp83_;
						{
							gboolean _tmp84_;
							_tmp84_ = TRUE;
							while (TRUE) {
								gboolean _tmp85_;
								gint _tmp87_;
								gint _tmp88_;
								gint _tmp89_;
								gint _tmp90_;
								gint _tmp91_;
								gint _tmp92_;
								gint o;
								guchar* _tmp93_;
								gint _tmp93__length1;
								gint _tmp94_;
								guchar* _tmp95_;
								gint _tmp95__length1;
								gint _tmp96_;
								guchar* _tmp97_;
								gint _tmp97__length1;
								gint _tmp98_;
								guchar _tmp99_;
								guchar _tmp100_;
								guchar _tmp101_;
								_tmp85_ = _tmp84_;
								if (!_tmp85_) {
									gint _tmp86_;
									_tmp86_ = y;
									y = _tmp86_ + 1;
								}
								_tmp84_ = FALSE;
								_tmp87_ = y;
								_tmp88_ = B;
								if (!(_tmp87_ <= _tmp88_)) {
									break;
								}
								_tmp89_ = output_rowstride;
								_tmp90_ = y;
								_tmp91_ = x;
								_tmp92_ = output_n_channels;
								o = (_tmp89_ * _tmp90_) + (_tmp91_ * _tmp92_);
								_tmp93_ = output;
								_tmp93__length1 = output_length1;
								_tmp94_ = o;
								_tmp95_ = output;
								_tmp95__length1 = output_length1;
								_tmp96_ = o;
								_tmp97_ = output;
								_tmp97__length1 = output_length1;
								_tmp98_ = o;
								_tmp97_[_tmp98_ + 2] = (guchar) 0xFF;
								_tmp99_ = _tmp97_[_tmp98_ + 2];
								_tmp95_[_tmp96_ + 1] = _tmp99_;
								_tmp100_ = _tmp95_[_tmp96_ + 1];
								_tmp93_[_tmp94_] = _tmp100_;
								_tmp101_ = _tmp93_[_tmp94_];
							}
						}
					}
				}
			}
		}
		return;
	}
	{
		gint _tmp102_;
		gint x;
		_tmp102_ = L;
		x = _tmp102_;
		{
			gboolean _tmp103_;
			_tmp103_ = TRUE;
			while (TRUE) {
				gboolean _tmp104_;
				gint _tmp106_;
				gint _tmp107_;
				gint _tmp108_;
				gint _tmp109_;
				gint _tmp110_;
				gdouble l;
				gint _tmp111_;
				gint _tmp112_;
				gint _tmp113_;
				gdouble r;
				_tmp104_ = _tmp103_;
				if (!_tmp104_) {
					gint _tmp105_;
					_tmp105_ = x;
					x = _tmp105_ + 1;
				}
				_tmp103_ = FALSE;
				_tmp106_ = x;
				_tmp107_ = R;
				if (!(_tmp106_ <= _tmp107_)) {
					break;
				}
				_tmp108_ = x;
				_tmp109_ = input_width;
				_tmp110_ = output_width;
				l = (((gdouble) _tmp108_) * _tmp109_) / _tmp110_;
				_tmp111_ = x;
				_tmp112_ = input_width;
				_tmp113_ = output_width;
				r = (((gdouble) (_tmp111_ + 1)) * _tmp112_) / _tmp113_;
				{
					gint _tmp114_;
					gint y;
					_tmp114_ = T;
					y = _tmp114_;
					{
						gboolean _tmp115_;
						_tmp115_ = TRUE;
						while (TRUE) {
							gboolean _tmp116_;
							gint _tmp118_;
							gint _tmp119_;
							gint _tmp120_;
							gint _tmp121_;
							gint _tmp122_;
							gdouble t;
							gint _tmp123_;
							gint _tmp124_;
							gint _tmp125_;
							gdouble b;
							Page* _tmp126_;
							gdouble _tmp127_;
							gdouble _tmp128_;
							gdouble _tmp129_;
							gdouble _tmp130_;
							guchar* _tmp131_;
							gint _tmp131__length1;
							gint _tmp132_;
							gint _tmp133_;
							gint _tmp134_;
							gint _tmp135_;
							_tmp116_ = _tmp115_;
							if (!_tmp116_) {
								gint _tmp117_;
								_tmp117_ = y;
								y = _tmp117_ + 1;
							}
							_tmp115_ = FALSE;
							_tmp118_ = y;
							_tmp119_ = B;
							if (!(_tmp118_ <= _tmp119_)) {
								break;
							}
							_tmp120_ = y;
							_tmp121_ = input_height;
							_tmp122_ = output_height;
							t = (((gdouble) _tmp120_) * _tmp121_) / _tmp122_;
							_tmp123_ = y;
							_tmp124_ = input_height;
							_tmp125_ = output_height;
							b = (((gdouble) (_tmp123_ + 1)) * _tmp124_) / _tmp125_;
							_tmp126_ = page;
							_tmp127_ = l;
							_tmp128_ = r;
							_tmp129_ = t;
							_tmp130_ = b;
							_tmp131_ = output;
							_tmp131__length1 = output_length1;
							_tmp132_ = output_rowstride;
							_tmp133_ = y;
							_tmp134_ = x;
							_tmp135_ = output_n_channels;
							page_view_set_pixel (self, _tmp126_, _tmp127_, _tmp128_, _tmp129_, _tmp130_, _tmp131_, _tmp131__length1, (_tmp132_ * _tmp133_) + (_tmp134_ * _tmp135_));
						}
					}
				}
			}
		}
	}
}


static gint page_view_get_preview_width (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->width;
	_tmp1_ = self->priv->border_width;
	result = _tmp0_ - (_tmp1_ * 2);
	return result;
}


static gint page_view_get_preview_height (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->height;
	_tmp1_ = self->priv->border_width;
	result = _tmp0_ - (_tmp1_ * 2);
	return result;
}


static void page_view_update_page_view (PageView* self) {
	gboolean _tmp0_;
	gint _tmp1_;
	gint old_scan_line;
	Page* _tmp2_;
	gint _tmp3_ = 0;
	gint scan_line;
	ScanDirection _tmp4_;
	Page* _tmp5_;
	ScanDirection _tmp6_ = 0;
	ScanDirection left_steps;
	gboolean _tmp7_ = FALSE;
	ScanDirection _tmp8_;
	gboolean _tmp10_;
	Page* _tmp11_;
	ScanDirection _tmp12_ = 0;
	Page* _tmp13_;
	gint _tmp14_ = 0;
	gint _tmp15_ = 0;
	Page* _tmp16_;
	ScanDirection _tmp17_ = 0;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->update_image;
	if (!_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->scan_line;
	old_scan_line = _tmp1_;
	_tmp2_ = self->priv->page;
	_tmp3_ = page_get_scan_line (_tmp2_);
	scan_line = _tmp3_;
	_tmp4_ = self->priv->scan_direction;
	_tmp5_ = self->priv->page;
	_tmp6_ = page_get_scan_direction (_tmp5_);
	left_steps = _tmp4_ - _tmp6_;
	_tmp8_ = left_steps;
	if (_tmp8_ != 0) {
		GdkPixbuf* _tmp9_;
		_tmp9_ = self->priv->image;
		_tmp7_ = _tmp9_ != NULL;
	} else {
		_tmp7_ = FALSE;
	}
	_tmp10_ = _tmp7_;
	if (_tmp10_) {
		_g_object_unref0 (self->priv->image);
		self->priv->image = NULL;
	}
	_tmp11_ = self->priv->page;
	_tmp12_ = page_get_scan_direction (_tmp11_);
	self->priv->scan_direction = _tmp12_;
	_tmp13_ = self->priv->page;
	_tmp14_ = page_view_get_preview_width (self);
	_tmp15_ = page_view_get_preview_height (self);
	_tmp16_ = self->priv->page;
	_tmp17_ = page_get_scan_direction (_tmp16_);
	_tmp18_ = old_scan_line;
	_tmp19_ = scan_line;
	page_view_update_preview (self, _tmp13_, &self->priv->image, _tmp14_, _tmp15_, _tmp17_, _tmp18_, _tmp19_);
	self->priv->update_image = FALSE;
	_tmp20_ = scan_line;
	self->priv->scan_line = _tmp20_;
}


static gint page_view_page_to_screen_x (PageView* self, gint x) {
	gint result = 0;
	gint _tmp0_;
	gint _tmp1_ = 0;
	Page* _tmp2_;
	gint _tmp3_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = x;
	_tmp1_ = page_view_get_preview_width (self);
	_tmp2_ = self->priv->page;
	_tmp3_ = page_get_width (_tmp2_);
	result = (gint) (((((gdouble) _tmp0_) * _tmp1_) / _tmp3_) + 0.5);
	return result;
}


static gint page_view_page_to_screen_y (PageView* self, gint y) {
	gint result = 0;
	gint _tmp0_;
	gint _tmp1_ = 0;
	Page* _tmp2_;
	gint _tmp3_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = y;
	_tmp1_ = page_view_get_preview_height (self);
	_tmp2_ = self->priv->page;
	_tmp3_ = page_get_height (_tmp2_);
	result = (gint) (((((gdouble) _tmp0_) * _tmp1_) / _tmp3_) + 0.5);
	return result;
}


static gint page_view_screen_to_page_x (PageView* self, gint x) {
	gint result = 0;
	gint _tmp0_;
	Page* _tmp1_;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = x;
	_tmp1_ = self->priv->page;
	_tmp2_ = page_get_width (_tmp1_);
	_tmp3_ = page_view_get_preview_width (self);
	result = (gint) (((((gdouble) _tmp0_) * _tmp2_) / _tmp3_) + 0.5);
	return result;
}


static gint page_view_screen_to_page_y (PageView* self, gint y) {
	gint result = 0;
	gint _tmp0_;
	Page* _tmp1_;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = y;
	_tmp1_ = self->priv->page;
	_tmp2_ = page_get_height (_tmp1_);
	_tmp3_ = page_view_get_preview_height (self);
	result = (gint) (((((gdouble) _tmp0_) * _tmp2_) / _tmp3_) + 0.5);
	return result;
}


static CropLocation page_view_get_crop_location (PageView* self, gint x, gint y) {
	CropLocation result = 0;
	Page* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gint cx = 0;
	gint cy = 0;
	gint cw = 0;
	gint ch = 0;
	Page* _tmp2_;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	gint _tmp7_;
	gint _tmp8_ = 0;
	gint dx;
	gint _tmp9_;
	gint _tmp10_ = 0;
	gint dy;
	gint _tmp11_;
	gint _tmp12_ = 0;
	gint dw;
	gint _tmp13_;
	gint _tmp14_ = 0;
	gint dh;
	gint _tmp15_;
	gint _tmp16_;
	gint ix;
	gint _tmp17_;
	gint _tmp18_;
	gint iy;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	gint _tmp22_;
	gboolean _tmp25_;
	gboolean _tmp27_;
	gboolean _tmp30_;
	Page* _tmp31_;
	gchar* _tmp32_ = NULL;
	gchar* name;
	const gchar* _tmp33_;
	gint crop_border;
	gint _tmp34_;
	gint _tmp35_;
	gint _tmp37_;
	gint _tmp38_;
	gboolean _tmp40_ = FALSE;
	gint _tmp41_;
	gint _tmp42_;
	gboolean _tmp45_;
	gboolean _tmp46_ = FALSE;
	gint _tmp47_;
	gint _tmp48_;
	gint _tmp49_;
	gboolean _tmp52_;
	gboolean _tmp53_ = FALSE;
	gint _tmp54_;
	gint _tmp55_;
	gboolean _tmp59_;
	gboolean _tmp60_ = FALSE;
	gint _tmp61_;
	gint _tmp62_;
	gint _tmp63_;
	gboolean _tmp67_;
	gint _tmp68_;
	gint _tmp69_;
	gint _tmp70_;
	gint _tmp71_;
	gint _tmp72_;
	gint _tmp73_;
	gint _tmp74_;
	gint _tmp75_;
	gint _tmp76_;
	gint _tmp77_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->page;
	_tmp1_ = page_has_crop (_tmp0_);
	if (!_tmp1_) {
		result = 0;
		return result;
	}
	_tmp2_ = self->priv->page;
	page_get_crop (_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_);
	cx = _tmp3_;
	cy = _tmp4_;
	cw = _tmp5_;
	ch = _tmp6_;
	_tmp7_ = cx;
	_tmp8_ = page_view_page_to_screen_x (self, _tmp7_);
	dx = _tmp8_;
	_tmp9_ = cy;
	_tmp10_ = page_view_page_to_screen_y (self, _tmp9_);
	dy = _tmp10_;
	_tmp11_ = cw;
	_tmp12_ = page_view_page_to_screen_x (self, _tmp11_);
	dw = _tmp12_;
	_tmp13_ = ch;
	_tmp14_ = page_view_page_to_screen_y (self, _tmp13_);
	dh = _tmp14_;
	_tmp15_ = x;
	_tmp16_ = dx;
	ix = _tmp15_ - _tmp16_;
	_tmp17_ = y;
	_tmp18_ = dy;
	iy = _tmp17_ - _tmp18_;
	_tmp22_ = ix;
	if (_tmp22_ < 0) {
		_tmp21_ = TRUE;
	} else {
		gint _tmp23_;
		gint _tmp24_;
		_tmp23_ = ix;
		_tmp24_ = dw;
		_tmp21_ = _tmp23_ > _tmp24_;
	}
	_tmp25_ = _tmp21_;
	if (_tmp25_) {
		_tmp20_ = TRUE;
	} else {
		gint _tmp26_;
		_tmp26_ = iy;
		_tmp20_ = _tmp26_ < 0;
	}
	_tmp27_ = _tmp20_;
	if (_tmp27_) {
		_tmp19_ = TRUE;
	} else {
		gint _tmp28_;
		gint _tmp29_;
		_tmp28_ = iy;
		_tmp29_ = dh;
		_tmp19_ = _tmp28_ > _tmp29_;
	}
	_tmp30_ = _tmp19_;
	if (_tmp30_) {
		result = CROP_LOCATION_NONE;
		return result;
	}
	_tmp31_ = self->priv->page;
	_tmp32_ = page_get_named_crop (_tmp31_);
	name = _tmp32_;
	_tmp33_ = name;
	if (_tmp33_ != NULL) {
		result = CROP_LOCATION_MIDDLE;
		_g_free0 (name);
		return result;
	}
	crop_border = 20;
	_tmp34_ = dw;
	_tmp35_ = crop_border;
	if (_tmp34_ < (_tmp35_ * 3)) {
		gint _tmp36_;
		_tmp36_ = dw;
		crop_border = _tmp36_ / 3;
	}
	_tmp37_ = dh;
	_tmp38_ = crop_border;
	if (_tmp37_ < (_tmp38_ * 3)) {
		gint _tmp39_;
		_tmp39_ = dh;
		crop_border = _tmp39_ / 3;
	}
	_tmp41_ = ix;
	_tmp42_ = crop_border;
	if (_tmp41_ < _tmp42_) {
		gint _tmp43_;
		gint _tmp44_;
		_tmp43_ = iy;
		_tmp44_ = crop_border;
		_tmp40_ = _tmp43_ < _tmp44_;
	} else {
		_tmp40_ = FALSE;
	}
	_tmp45_ = _tmp40_;
	if (_tmp45_) {
		result = CROP_LOCATION_TOP_LEFT;
		_g_free0 (name);
		return result;
	}
	_tmp47_ = ix;
	_tmp48_ = dw;
	_tmp49_ = crop_border;
	if (_tmp47_ > (_tmp48_ - _tmp49_)) {
		gint _tmp50_;
		gint _tmp51_;
		_tmp50_ = iy;
		_tmp51_ = crop_border;
		_tmp46_ = _tmp50_ < _tmp51_;
	} else {
		_tmp46_ = FALSE;
	}
	_tmp52_ = _tmp46_;
	if (_tmp52_) {
		result = CROP_LOCATION_TOP_RIGHT;
		_g_free0 (name);
		return result;
	}
	_tmp54_ = ix;
	_tmp55_ = crop_border;
	if (_tmp54_ < _tmp55_) {
		gint _tmp56_;
		gint _tmp57_;
		gint _tmp58_;
		_tmp56_ = iy;
		_tmp57_ = dh;
		_tmp58_ = crop_border;
		_tmp53_ = _tmp56_ > (_tmp57_ - _tmp58_);
	} else {
		_tmp53_ = FALSE;
	}
	_tmp59_ = _tmp53_;
	if (_tmp59_) {
		result = CROP_LOCATION_BOTTOM_LEFT;
		_g_free0 (name);
		return result;
	}
	_tmp61_ = ix;
	_tmp62_ = dw;
	_tmp63_ = crop_border;
	if (_tmp61_ > (_tmp62_ - _tmp63_)) {
		gint _tmp64_;
		gint _tmp65_;
		gint _tmp66_;
		_tmp64_ = iy;
		_tmp65_ = dh;
		_tmp66_ = crop_border;
		_tmp60_ = _tmp64_ > (_tmp65_ - _tmp66_);
	} else {
		_tmp60_ = FALSE;
	}
	_tmp67_ = _tmp60_;
	if (_tmp67_) {
		result = CROP_LOCATION_BOTTOM_RIGHT;
		_g_free0 (name);
		return result;
	}
	_tmp68_ = ix;
	_tmp69_ = crop_border;
	if (_tmp68_ < _tmp69_) {
		result = CROP_LOCATION_LEFT;
		_g_free0 (name);
		return result;
	}
	_tmp70_ = ix;
	_tmp71_ = dw;
	_tmp72_ = crop_border;
	if (_tmp70_ > (_tmp71_ - _tmp72_)) {
		result = CROP_LOCATION_RIGHT;
		_g_free0 (name);
		return result;
	}
	_tmp73_ = iy;
	_tmp74_ = crop_border;
	if (_tmp73_ < _tmp74_) {
		result = CROP_LOCATION_TOP;
		_g_free0 (name);
		return result;
	}
	_tmp75_ = iy;
	_tmp76_ = dh;
	_tmp77_ = crop_border;
	if (_tmp75_ > (_tmp76_ - _tmp77_)) {
		result = CROP_LOCATION_BOTTOM;
		_g_free0 (name);
		return result;
	}
	result = CROP_LOCATION_MIDDLE;
	_g_free0 (name);
	return result;
}


void page_view_button_press (PageView* self, gint x, gint y) {
	CropLocation location = 0;
	gint _tmp0_;
	gint _tmp1_;
	CropLocation _tmp2_ = 0;
	CropLocation _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = x;
	_tmp1_ = y;
	_tmp2_ = page_view_get_crop_location (self, _tmp0_, _tmp1_);
	location = _tmp2_;
	_tmp3_ = location;
	if (_tmp3_ != CROP_LOCATION_NONE) {
		CropLocation _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		Page* _tmp7_;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _tmp10_ = 0;
		gint _tmp11_ = 0;
		_tmp4_ = location;
		self->priv->crop_location = _tmp4_;
		_tmp5_ = x;
		self->priv->selected_crop_px = (gdouble) _tmp5_;
		_tmp6_ = y;
		self->priv->selected_crop_py = (gdouble) _tmp6_;
		_tmp7_ = self->priv->page;
		page_get_crop (_tmp7_, &_tmp8_, &_tmp9_, &_tmp10_, &_tmp11_);
		self->priv->selected_crop_x = _tmp8_;
		self->priv->selected_crop_y = _tmp9_;
		self->priv->selected_crop_w = _tmp10_;
		self->priv->selected_crop_h = _tmp11_;
	}
}


void page_view_motion (PageView* self, gint x, gint y) {
	gint _tmp0_;
	gint _tmp1_;
	CropLocation _tmp2_ = 0;
	CropLocation location;
	GdkCursorType cursor = 0;
	CropLocation _tmp3_;
	CropLocation _tmp4_;
	Page* _tmp6_;
	gint _tmp7_ = 0;
	gint pw;
	Page* _tmp8_;
	gint _tmp9_ = 0;
	gint ph;
	gint cx = 0;
	gint cy = 0;
	gint cw = 0;
	gint ch = 0;
	Page* _tmp10_;
	gint _tmp11_ = 0;
	gint _tmp12_ = 0;
	gint _tmp13_ = 0;
	gint _tmp14_ = 0;
	gint _tmp15_;
	gdouble _tmp16_;
	gint _tmp17_ = 0;
	gint dx;
	gint _tmp18_;
	gdouble _tmp19_;
	gint _tmp20_ = 0;
	gint dy;
	gint _tmp21_;
	gint new_x;
	gint _tmp22_;
	gint new_y;
	gint _tmp23_;
	gint new_w;
	gint _tmp24_;
	gint new_h;
	gint _tmp25_ = 0;
	gint min_size;
	gboolean _tmp26_ = FALSE;
	gboolean _tmp27_ = FALSE;
	CropLocation _tmp28_;
	gboolean _tmp30_;
	gboolean _tmp32_;
	gboolean _tmp41_ = FALSE;
	gboolean _tmp42_ = FALSE;
	CropLocation _tmp43_;
	gboolean _tmp45_;
	gboolean _tmp47_;
	gboolean _tmp56_ = FALSE;
	gboolean _tmp57_ = FALSE;
	CropLocation _tmp58_;
	gboolean _tmp60_;
	gboolean _tmp62_;
	gboolean _tmp75_ = FALSE;
	gboolean _tmp76_ = FALSE;
	CropLocation _tmp77_;
	gboolean _tmp79_;
	gboolean _tmp81_;
	CropLocation _tmp94_;
	CropLocation _tmp115_;
	gboolean _tmp120_ = FALSE;
	gboolean _tmp121_ = FALSE;
	CropLocation _tmp122_;
	gboolean _tmp124_;
	gboolean _tmp126_;
	gboolean _tmp131_ = FALSE;
	gboolean _tmp132_ = FALSE;
	CropLocation _tmp133_;
	gboolean _tmp135_;
	gboolean _tmp137_;
	gboolean _tmp142_ = FALSE;
	gboolean _tmp143_ = FALSE;
	CropLocation _tmp144_;
	gboolean _tmp146_;
	gboolean _tmp148_;
	gboolean _tmp151_ = FALSE;
	gboolean _tmp152_ = FALSE;
	CropLocation _tmp153_;
	gboolean _tmp155_;
	gboolean _tmp157_;
	Page* _tmp160_;
	gint _tmp161_;
	gint _tmp162_;
	gboolean _tmp163_ = FALSE;
	gint _tmp164_;
	gint _tmp165_;
	gboolean _tmp168_;
	g_return_if_fail (self != NULL);
	_tmp0_ = x;
	_tmp1_ = y;
	_tmp2_ = page_view_get_crop_location (self, _tmp0_, _tmp1_);
	location = _tmp2_;
	_tmp3_ = location;
	switch (_tmp3_) {
		case CROP_LOCATION_MIDDLE:
		{
			cursor = GDK_HAND1;
			break;
		}
		case CROP_LOCATION_TOP:
		{
			cursor = GDK_TOP_SIDE;
			break;
		}
		case CROP_LOCATION_BOTTOM:
		{
			cursor = GDK_BOTTOM_SIDE;
			break;
		}
		case CROP_LOCATION_LEFT:
		{
			cursor = GDK_LEFT_SIDE;
			break;
		}
		case CROP_LOCATION_RIGHT:
		{
			cursor = GDK_RIGHT_SIDE;
			break;
		}
		case CROP_LOCATION_TOP_LEFT:
		{
			cursor = GDK_TOP_LEFT_CORNER;
			break;
		}
		case CROP_LOCATION_TOP_RIGHT:
		{
			cursor = GDK_TOP_RIGHT_CORNER;
			break;
		}
		case CROP_LOCATION_BOTTOM_LEFT:
		{
			cursor = GDK_BOTTOM_LEFT_CORNER;
			break;
		}
		case CROP_LOCATION_BOTTOM_RIGHT:
		{
			cursor = GDK_BOTTOM_RIGHT_CORNER;
			break;
		}
		default:
		{
			cursor = GDK_ARROW;
			break;
		}
	}
	_tmp4_ = self->priv->crop_location;
	if (_tmp4_ == CROP_LOCATION_NONE) {
		GdkCursorType _tmp5_;
		_tmp5_ = cursor;
		self->priv->cursor = _tmp5_;
		return;
	}
	_tmp6_ = self->priv->page;
	_tmp7_ = page_get_width (_tmp6_);
	pw = _tmp7_;
	_tmp8_ = self->priv->page;
	_tmp9_ = page_get_height (_tmp8_);
	ph = _tmp9_;
	_tmp10_ = self->priv->page;
	page_get_crop (_tmp10_, &_tmp11_, &_tmp12_, &_tmp13_, &_tmp14_);
	cx = _tmp11_;
	cy = _tmp12_;
	cw = _tmp13_;
	ch = _tmp14_;
	_tmp15_ = x;
	_tmp16_ = self->priv->selected_crop_px;
	_tmp17_ = page_view_screen_to_page_x (self, _tmp15_ - ((gint) _tmp16_));
	dx = _tmp17_;
	_tmp18_ = y;
	_tmp19_ = self->priv->selected_crop_py;
	_tmp20_ = page_view_screen_to_page_y (self, _tmp18_ - ((gint) _tmp19_));
	dy = _tmp20_;
	_tmp21_ = self->priv->selected_crop_x;
	new_x = _tmp21_;
	_tmp22_ = self->priv->selected_crop_y;
	new_y = _tmp22_;
	_tmp23_ = self->priv->selected_crop_w;
	new_w = _tmp23_;
	_tmp24_ = self->priv->selected_crop_h;
	new_h = _tmp24_;
	_tmp25_ = page_view_screen_to_page_x (self, 15);
	min_size = _tmp25_;
	_tmp28_ = self->priv->crop_location;
	if (_tmp28_ == CROP_LOCATION_TOP_LEFT) {
		_tmp27_ = TRUE;
	} else {
		CropLocation _tmp29_;
		_tmp29_ = self->priv->crop_location;
		_tmp27_ = _tmp29_ == CROP_LOCATION_LEFT;
	}
	_tmp30_ = _tmp27_;
	if (_tmp30_) {
		_tmp26_ = TRUE;
	} else {
		CropLocation _tmp31_;
		_tmp31_ = self->priv->crop_location;
		_tmp26_ = _tmp31_ == CROP_LOCATION_BOTTOM_LEFT;
	}
	_tmp32_ = _tmp26_;
	if (_tmp32_) {
		gint _tmp33_;
		gint _tmp34_;
		gint _tmp35_;
		gint _tmp38_;
		gint _tmp39_;
		_tmp33_ = dx;
		_tmp34_ = new_w;
		_tmp35_ = min_size;
		if (_tmp33_ > (_tmp34_ - _tmp35_)) {
			gint _tmp36_;
			gint _tmp37_;
			_tmp36_ = new_w;
			_tmp37_ = min_size;
			dx = _tmp36_ - _tmp37_;
		}
		_tmp38_ = new_x;
		_tmp39_ = dx;
		if ((_tmp38_ + _tmp39_) < 0) {
			gint _tmp40_;
			_tmp40_ = new_x;
			dx = -_tmp40_;
		}
	}
	_tmp43_ = self->priv->crop_location;
	if (_tmp43_ == CROP_LOCATION_TOP_LEFT) {
		_tmp42_ = TRUE;
	} else {
		CropLocation _tmp44_;
		_tmp44_ = self->priv->crop_location;
		_tmp42_ = _tmp44_ == CROP_LOCATION_TOP;
	}
	_tmp45_ = _tmp42_;
	if (_tmp45_) {
		_tmp41_ = TRUE;
	} else {
		CropLocation _tmp46_;
		_tmp46_ = self->priv->crop_location;
		_tmp41_ = _tmp46_ == CROP_LOCATION_TOP_RIGHT;
	}
	_tmp47_ = _tmp41_;
	if (_tmp47_) {
		gint _tmp48_;
		gint _tmp49_;
		gint _tmp50_;
		gint _tmp53_;
		gint _tmp54_;
		_tmp48_ = dy;
		_tmp49_ = new_h;
		_tmp50_ = min_size;
		if (_tmp48_ > (_tmp49_ - _tmp50_)) {
			gint _tmp51_;
			gint _tmp52_;
			_tmp51_ = new_h;
			_tmp52_ = min_size;
			dy = _tmp51_ - _tmp52_;
		}
		_tmp53_ = new_y;
		_tmp54_ = dy;
		if ((_tmp53_ + _tmp54_) < 0) {
			gint _tmp55_;
			_tmp55_ = new_y;
			dy = -_tmp55_;
		}
	}
	_tmp58_ = self->priv->crop_location;
	if (_tmp58_ == CROP_LOCATION_TOP_RIGHT) {
		_tmp57_ = TRUE;
	} else {
		CropLocation _tmp59_;
		_tmp59_ = self->priv->crop_location;
		_tmp57_ = _tmp59_ == CROP_LOCATION_RIGHT;
	}
	_tmp60_ = _tmp57_;
	if (_tmp60_) {
		_tmp56_ = TRUE;
	} else {
		CropLocation _tmp61_;
		_tmp61_ = self->priv->crop_location;
		_tmp56_ = _tmp61_ == CROP_LOCATION_BOTTOM_RIGHT;
	}
	_tmp62_ = _tmp56_;
	if (_tmp62_) {
		gint _tmp63_;
		gint _tmp64_;
		gint _tmp65_;
		gint _tmp68_;
		gint _tmp69_;
		gint _tmp70_;
		gint _tmp71_;
		_tmp63_ = dx;
		_tmp64_ = min_size;
		_tmp65_ = new_w;
		if (_tmp63_ < (_tmp64_ - _tmp65_)) {
			gint _tmp66_;
			gint _tmp67_;
			_tmp66_ = min_size;
			_tmp67_ = new_w;
			dx = _tmp66_ - _tmp67_;
		}
		_tmp68_ = new_x;
		_tmp69_ = new_w;
		_tmp70_ = dx;
		_tmp71_ = pw;
		if (((_tmp68_ + _tmp69_) + _tmp70_) > _tmp71_) {
			gint _tmp72_;
			gint _tmp73_;
			gint _tmp74_;
			_tmp72_ = pw;
			_tmp73_ = new_x;
			_tmp74_ = new_w;
			dx = (_tmp72_ - _tmp73_) - _tmp74_;
		}
	}
	_tmp77_ = self->priv->crop_location;
	if (_tmp77_ == CROP_LOCATION_BOTTOM_LEFT) {
		_tmp76_ = TRUE;
	} else {
		CropLocation _tmp78_;
		_tmp78_ = self->priv->crop_location;
		_tmp76_ = _tmp78_ == CROP_LOCATION_BOTTOM;
	}
	_tmp79_ = _tmp76_;
	if (_tmp79_) {
		_tmp75_ = TRUE;
	} else {
		CropLocation _tmp80_;
		_tmp80_ = self->priv->crop_location;
		_tmp75_ = _tmp80_ == CROP_LOCATION_BOTTOM_RIGHT;
	}
	_tmp81_ = _tmp75_;
	if (_tmp81_) {
		gint _tmp82_;
		gint _tmp83_;
		gint _tmp84_;
		gint _tmp87_;
		gint _tmp88_;
		gint _tmp89_;
		gint _tmp90_;
		_tmp82_ = dy;
		_tmp83_ = min_size;
		_tmp84_ = new_h;
		if (_tmp82_ < (_tmp83_ - _tmp84_)) {
			gint _tmp85_;
			gint _tmp86_;
			_tmp85_ = min_size;
			_tmp86_ = new_h;
			dy = _tmp85_ - _tmp86_;
		}
		_tmp87_ = new_y;
		_tmp88_ = new_h;
		_tmp89_ = dy;
		_tmp90_ = ph;
		if (((_tmp87_ + _tmp88_) + _tmp89_) > _tmp90_) {
			gint _tmp91_;
			gint _tmp92_;
			gint _tmp93_;
			_tmp91_ = ph;
			_tmp92_ = new_y;
			_tmp93_ = new_h;
			dy = (_tmp91_ - _tmp92_) - _tmp93_;
		}
	}
	_tmp94_ = self->priv->crop_location;
	if (_tmp94_ == CROP_LOCATION_MIDDLE) {
		gint _tmp95_;
		gint _tmp96_;
		gint _tmp97_;
		gint _tmp98_;
		gint _tmp102_;
		gint _tmp103_;
		gint _tmp105_;
		gint _tmp106_;
		gint _tmp107_;
		gint _tmp108_;
		gint _tmp112_;
		gint _tmp113_;
		_tmp95_ = new_x;
		_tmp96_ = dx;
		_tmp97_ = new_w;
		_tmp98_ = pw;
		if (((_tmp95_ + _tmp96_) + _tmp97_) > _tmp98_) {
			gint _tmp99_;
			gint _tmp100_;
			gint _tmp101_;
			_tmp99_ = pw;
			_tmp100_ = new_x;
			_tmp101_ = new_w;
			dx = (_tmp99_ - _tmp100_) - _tmp101_;
		}
		_tmp102_ = new_x;
		_tmp103_ = dx;
		if ((_tmp102_ + _tmp103_) < 0) {
			gint _tmp104_;
			_tmp104_ = new_x;
			dx = -_tmp104_;
		}
		_tmp105_ = new_y;
		_tmp106_ = dy;
		_tmp107_ = new_h;
		_tmp108_ = ph;
		if (((_tmp105_ + _tmp106_) + _tmp107_) > _tmp108_) {
			gint _tmp109_;
			gint _tmp110_;
			gint _tmp111_;
			_tmp109_ = ph;
			_tmp110_ = new_y;
			_tmp111_ = new_h;
			dy = (_tmp109_ - _tmp110_) - _tmp111_;
		}
		_tmp112_ = new_y;
		_tmp113_ = dy;
		if ((_tmp112_ + _tmp113_) < 0) {
			gint _tmp114_;
			_tmp114_ = new_y;
			dy = -_tmp114_;
		}
	}
	_tmp115_ = self->priv->crop_location;
	if (_tmp115_ == CROP_LOCATION_MIDDLE) {
		gint _tmp116_;
		gint _tmp117_;
		gint _tmp118_;
		gint _tmp119_;
		_tmp116_ = new_x;
		_tmp117_ = dx;
		new_x = _tmp116_ + _tmp117_;
		_tmp118_ = new_y;
		_tmp119_ = dy;
		new_y = _tmp118_ + _tmp119_;
	}
	_tmp122_ = self->priv->crop_location;
	if (_tmp122_ == CROP_LOCATION_TOP_LEFT) {
		_tmp121_ = TRUE;
	} else {
		CropLocation _tmp123_;
		_tmp123_ = self->priv->crop_location;
		_tmp121_ = _tmp123_ == CROP_LOCATION_LEFT;
	}
	_tmp124_ = _tmp121_;
	if (_tmp124_) {
		_tmp120_ = TRUE;
	} else {
		CropLocation _tmp125_;
		_tmp125_ = self->priv->crop_location;
		_tmp120_ = _tmp125_ == CROP_LOCATION_BOTTOM_LEFT;
	}
	_tmp126_ = _tmp120_;
	if (_tmp126_) {
		gint _tmp127_;
		gint _tmp128_;
		gint _tmp129_;
		gint _tmp130_;
		_tmp127_ = new_x;
		_tmp128_ = dx;
		new_x = _tmp127_ + _tmp128_;
		_tmp129_ = new_w;
		_tmp130_ = dx;
		new_w = _tmp129_ - _tmp130_;
	}
	_tmp133_ = self->priv->crop_location;
	if (_tmp133_ == CROP_LOCATION_TOP_LEFT) {
		_tmp132_ = TRUE;
	} else {
		CropLocation _tmp134_;
		_tmp134_ = self->priv->crop_location;
		_tmp132_ = _tmp134_ == CROP_LOCATION_TOP;
	}
	_tmp135_ = _tmp132_;
	if (_tmp135_) {
		_tmp131_ = TRUE;
	} else {
		CropLocation _tmp136_;
		_tmp136_ = self->priv->crop_location;
		_tmp131_ = _tmp136_ == CROP_LOCATION_TOP_RIGHT;
	}
	_tmp137_ = _tmp131_;
	if (_tmp137_) {
		gint _tmp138_;
		gint _tmp139_;
		gint _tmp140_;
		gint _tmp141_;
		_tmp138_ = new_y;
		_tmp139_ = dy;
		new_y = _tmp138_ + _tmp139_;
		_tmp140_ = new_h;
		_tmp141_ = dy;
		new_h = _tmp140_ - _tmp141_;
	}
	_tmp144_ = self->priv->crop_location;
	if (_tmp144_ == CROP_LOCATION_TOP_RIGHT) {
		_tmp143_ = TRUE;
	} else {
		CropLocation _tmp145_;
		_tmp145_ = self->priv->crop_location;
		_tmp143_ = _tmp145_ == CROP_LOCATION_RIGHT;
	}
	_tmp146_ = _tmp143_;
	if (_tmp146_) {
		_tmp142_ = TRUE;
	} else {
		CropLocation _tmp147_;
		_tmp147_ = self->priv->crop_location;
		_tmp142_ = _tmp147_ == CROP_LOCATION_BOTTOM_RIGHT;
	}
	_tmp148_ = _tmp142_;
	if (_tmp148_) {
		gint _tmp149_;
		gint _tmp150_;
		_tmp149_ = new_w;
		_tmp150_ = dx;
		new_w = _tmp149_ + _tmp150_;
	}
	_tmp153_ = self->priv->crop_location;
	if (_tmp153_ == CROP_LOCATION_BOTTOM_LEFT) {
		_tmp152_ = TRUE;
	} else {
		CropLocation _tmp154_;
		_tmp154_ = self->priv->crop_location;
		_tmp152_ = _tmp154_ == CROP_LOCATION_BOTTOM;
	}
	_tmp155_ = _tmp152_;
	if (_tmp155_) {
		_tmp151_ = TRUE;
	} else {
		CropLocation _tmp156_;
		_tmp156_ = self->priv->crop_location;
		_tmp151_ = _tmp156_ == CROP_LOCATION_BOTTOM_RIGHT;
	}
	_tmp157_ = _tmp151_;
	if (_tmp157_) {
		gint _tmp158_;
		gint _tmp159_;
		_tmp158_ = new_h;
		_tmp159_ = dy;
		new_h = _tmp158_ + _tmp159_;
	}
	_tmp160_ = self->priv->page;
	_tmp161_ = new_x;
	_tmp162_ = new_y;
	page_move_crop (_tmp160_, _tmp161_, _tmp162_);
	_tmp164_ = new_w;
	_tmp165_ = cw;
	if (_tmp164_ != _tmp165_) {
		_tmp163_ = TRUE;
	} else {
		gint _tmp166_;
		gint _tmp167_;
		_tmp166_ = new_h;
		_tmp167_ = ch;
		_tmp163_ = _tmp166_ != _tmp167_;
	}
	_tmp168_ = _tmp163_;
	if (_tmp168_) {
		Page* _tmp169_;
		gint _tmp170_;
		gint _tmp171_;
		_tmp169_ = self->priv->page;
		_tmp170_ = new_w;
		_tmp171_ = new_h;
		page_set_custom_crop (_tmp169_, _tmp170_, _tmp171_);
	}
}


void page_view_button_release (PageView* self, gint x, gint y) {
	g_return_if_fail (self != NULL);
	self->priv->crop_location = CROP_LOCATION_NONE;
	g_signal_emit_by_name (self, "changed");
}


GdkCursorType page_view_get_cursor (PageView* self) {
	GdkCursorType result = 0;
	GdkCursorType _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->cursor;
	result = _tmp0_;
	return result;
}


static gboolean page_view_animation_cb (PageView* self) {
	gboolean result = FALSE;
	gint _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->animate_segment;
	_tmp1_ = self->priv->animate_n_segments;
	self->priv->animate_segment = (_tmp0_ + 1) % _tmp1_;
	g_signal_emit_by_name (self, "changed");
	result = TRUE;
	return result;
}


static gboolean _page_view_animation_cb_gsource_func (gpointer self) {
	gboolean result;
	result = page_view_animation_cb (self);
	return result;
}


static void page_view_update_animation (PageView* self) {
	gboolean animate = FALSE;
	gboolean is_animating = FALSE;
	gboolean _tmp0_ = FALSE;
	Page* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp5_;
	guint _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->page;
	_tmp2_ = page_is_scanning (_tmp1_);
	if (_tmp2_) {
		Page* _tmp3_;
		gboolean _tmp4_ = FALSE;
		_tmp3_ = self->priv->page;
		_tmp4_ = page_has_data (_tmp3_);
		_tmp0_ = !_tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp5_ = _tmp0_;
	animate = _tmp5_;
	_tmp6_ = self->priv->animate_timeout;
	is_animating = _tmp6_ != ((guint) 0);
	_tmp7_ = animate;
	_tmp8_ = is_animating;
	if (_tmp7_ == _tmp8_) {
		return;
	}
	_tmp9_ = animate;
	if (_tmp9_) {
		guint _tmp10_;
		self->priv->animate_segment = 0;
		_tmp10_ = self->priv->animate_timeout;
		if (_tmp10_ == ((guint) 0)) {
			guint _tmp11_ = 0U;
			_tmp11_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 150, _page_view_animation_cb_gsource_func, page_view_ref (self), page_view_unref);
			self->priv->animate_timeout = _tmp11_;
		}
	} else {
		guint _tmp12_;
		_tmp12_ = self->priv->animate_timeout;
		if (_tmp12_ != ((guint) 0)) {
			guint _tmp13_;
			_tmp13_ = self->priv->animate_timeout;
			g_source_remove (_tmp13_);
		}
		self->priv->animate_timeout = (guint) 0;
	}
}


void page_view_render (PageView* self, cairo_t* context) {
	gint _tmp0_ = 0;
	gint w;
	gint _tmp1_ = 0;
	gint h;
	cairo_t* _tmp2_;
	cairo_t* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	cairo_t* _tmp6_;
	cairo_t* _tmp7_;
	gint _tmp8_;
	cairo_t* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	cairo_t* _tmp16_;
	cairo_t* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	cairo_t* _tmp20_;
	GdkPixbuf* _tmp21_;
	cairo_t* _tmp22_;
	gboolean _tmp23_ = FALSE;
	Page* _tmp24_;
	gboolean _tmp25_ = FALSE;
	gboolean _tmp28_;
	gboolean _tmp70_ = FALSE;
	Page* _tmp71_;
	gboolean _tmp72_ = FALSE;
	gboolean _tmp75_;
	Page* _tmp115_;
	gboolean _tmp116_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	page_view_update_animation (self);
	page_view_update_page_view (self);
	_tmp0_ = page_view_get_preview_width (self);
	w = _tmp0_;
	_tmp1_ = page_view_get_preview_height (self);
	h = _tmp1_;
	_tmp2_ = context;
	cairo_set_line_width (_tmp2_, (gdouble) 1);
	_tmp3_ = context;
	_tmp4_ = self->priv->x_offset;
	_tmp5_ = self->priv->y_offset;
	cairo_translate (_tmp3_, (gdouble) _tmp4_, (gdouble) _tmp5_);
	_tmp6_ = context;
	cairo_set_source_rgb (_tmp6_, (gdouble) 0, (gdouble) 0, (gdouble) 0);
	_tmp7_ = context;
	_tmp8_ = self->priv->border_width;
	cairo_set_line_width (_tmp7_, (gdouble) _tmp8_);
	_tmp9_ = context;
	_tmp10_ = self->priv->border_width;
	_tmp11_ = self->priv->border_width;
	_tmp12_ = self->priv->width;
	_tmp13_ = self->priv->border_width;
	_tmp14_ = self->priv->height;
	_tmp15_ = self->priv->border_width;
	cairo_rectangle (_tmp9_, ((gdouble) _tmp10_) / 2, ((gdouble) _tmp11_) / 2, (gdouble) (_tmp12_ - _tmp13_), (gdouble) (_tmp14_ - _tmp15_));
	_tmp16_ = context;
	cairo_stroke (_tmp16_);
	_tmp17_ = context;
	_tmp18_ = self->priv->border_width;
	_tmp19_ = self->priv->border_width;
	cairo_translate (_tmp17_, (gdouble) _tmp18_, (gdouble) _tmp19_);
	_tmp20_ = context;
	_tmp21_ = self->priv->image;
	gdk_cairo_set_source_pixbuf (_tmp20_, _tmp21_, (gdouble) 0, (gdouble) 0);
	_tmp22_ = context;
	cairo_paint (_tmp22_);
	_tmp24_ = self->priv->page;
	_tmp25_ = page_is_scanning (_tmp24_);
	if (_tmp25_) {
		Page* _tmp26_;
		gboolean _tmp27_ = FALSE;
		_tmp26_ = self->priv->page;
		_tmp27_ = page_has_data (_tmp26_);
		_tmp23_ = !_tmp27_;
	} else {
		_tmp23_ = FALSE;
	}
	_tmp28_ = _tmp23_;
	if (_tmp28_) {
		gdouble outer_radius = 0.0;
		gint _tmp29_;
		gint _tmp30_;
		gint _tmp33_;
		gdouble arc;
		gdouble _tmp34_;
		gdouble _tmp35_;
		gdouble _tmp36_ = 0.0;
		gdouble x;
		gdouble _tmp37_;
		gdouble _tmp38_;
		gdouble _tmp39_ = 0.0;
		gdouble y;
		gdouble _tmp40_;
		gdouble _tmp41_;
		gdouble _tmp42_;
		gdouble _tmp43_;
		gdouble _tmp44_ = 0.0;
		gdouble inner_radius;
		gdouble offset;
		_tmp29_ = w;
		_tmp30_ = h;
		if (_tmp29_ > _tmp30_) {
			gint _tmp31_;
			_tmp31_ = w;
			outer_radius = 0.15 * _tmp31_;
		} else {
			gint _tmp32_;
			_tmp32_ = h;
			outer_radius = 0.15 * _tmp32_;
		}
		_tmp33_ = self->priv->animate_n_segments;
		arc = G_PI / _tmp33_;
		_tmp34_ = outer_radius;
		_tmp35_ = arc;
		_tmp36_ = sin (_tmp35_);
		x = _tmp34_ * _tmp36_;
		_tmp37_ = outer_radius;
		_tmp38_ = arc;
		_tmp39_ = cos (_tmp38_);
		y = _tmp37_ * (_tmp39_ - 1.0);
		_tmp40_ = x;
		_tmp41_ = x;
		_tmp42_ = y;
		_tmp43_ = y;
		_tmp44_ = sqrt ((_tmp40_ * _tmp41_) + (_tmp42_ * _tmp43_));
		inner_radius = 0.6 * _tmp44_;
		offset = 0.0;
		{
			gint i;
			i = 0;
			{
				gboolean _tmp45_;
				_tmp45_ = TRUE;
				while (TRUE) {
					gboolean _tmp46_;
					gint _tmp50_;
					gint _tmp51_;
					gint _tmp52_;
					gdouble _tmp53_;
					gdouble _tmp54_;
					gdouble _tmp55_ = 0.0;
					gint _tmp56_;
					gdouble _tmp57_;
					gdouble _tmp58_;
					gdouble _tmp59_ = 0.0;
					cairo_t* _tmp60_;
					gdouble _tmp61_;
					gdouble _tmp62_;
					gdouble _tmp63_;
					gint _tmp64_;
					gint _tmp65_;
					cairo_t* _tmp68_;
					cairo_t* _tmp69_;
					_tmp46_ = _tmp45_;
					if (!_tmp46_) {
						gint _tmp47_;
						gdouble _tmp48_;
						gdouble _tmp49_;
						_tmp47_ = i;
						i = _tmp47_ + 1;
						_tmp48_ = offset;
						_tmp49_ = arc;
						offset = _tmp48_ + (_tmp49_ * 2);
					}
					_tmp45_ = FALSE;
					_tmp50_ = i;
					_tmp51_ = self->priv->animate_n_segments;
					if (!(_tmp50_ < _tmp51_)) {
						break;
					}
					_tmp52_ = w;
					_tmp53_ = outer_radius;
					_tmp54_ = offset;
					_tmp55_ = sin (_tmp54_);
					x = (_tmp52_ / 2) + (_tmp53_ * _tmp55_);
					_tmp56_ = h;
					_tmp57_ = outer_radius;
					_tmp58_ = offset;
					_tmp59_ = cos (_tmp58_);
					y = (_tmp56_ / 2) - (_tmp57_ * _tmp59_);
					_tmp60_ = context;
					_tmp61_ = x;
					_tmp62_ = y;
					_tmp63_ = inner_radius;
					cairo_arc (_tmp60_, _tmp61_, _tmp62_, _tmp63_, (gdouble) 0, 2 * G_PI);
					_tmp64_ = i;
					_tmp65_ = self->priv->animate_segment;
					if (_tmp64_ == _tmp65_) {
						cairo_t* _tmp66_;
						cairo_t* _tmp67_;
						_tmp66_ = context;
						cairo_set_source_rgb (_tmp66_, 0.75, 0.75, 0.75);
						_tmp67_ = context;
						cairo_fill_preserve (_tmp67_);
					}
					_tmp68_ = context;
					cairo_set_source_rgb (_tmp68_, 0.5, 0.5, 0.5);
					_tmp69_ = context;
					cairo_stroke (_tmp69_);
				}
			}
		}
	}
	_tmp71_ = self->priv->page;
	_tmp72_ = page_is_scanning (_tmp71_);
	if (_tmp72_) {
		Page* _tmp73_;
		gint _tmp74_ = 0;
		_tmp73_ = self->priv->page;
		_tmp74_ = page_get_scan_line (_tmp73_);
		_tmp70_ = _tmp74_ > 0;
	} else {
		_tmp70_ = FALSE;
	}
	_tmp75_ = _tmp70_;
	if (_tmp75_) {
		Page* _tmp76_;
		gint _tmp77_ = 0;
		gint scan_line;
		gdouble s = 0.0;
		gdouble x1 = 0.0;
		gdouble y1 = 0.0;
		gdouble x2 = 0.0;
		gdouble y2 = 0.0;
		Page* _tmp78_;
		ScanDirection _tmp79_ = 0;
		cairo_t* _tmp107_;
		gdouble _tmp108_;
		gdouble _tmp109_;
		cairo_t* _tmp110_;
		gdouble _tmp111_;
		gdouble _tmp112_;
		cairo_t* _tmp113_;
		cairo_t* _tmp114_;
		_tmp76_ = self->priv->page;
		_tmp77_ = page_get_scan_line (_tmp76_);
		scan_line = _tmp77_;
		_tmp78_ = self->priv->page;
		_tmp79_ = page_get_scan_direction (_tmp78_);
		switch (_tmp79_) {
			case SCAN_DIRECTION_TOP_TO_BOTTOM:
			{
				gint _tmp80_;
				gint _tmp81_ = 0;
				gdouble _tmp82_;
				gint _tmp83_;
				gdouble _tmp84_;
				_tmp80_ = scan_line;
				_tmp81_ = page_view_page_to_screen_y (self, _tmp80_);
				s = (gdouble) _tmp81_;
				x1 = (gdouble) 0;
				_tmp82_ = s;
				y1 = _tmp82_ + 0.5;
				_tmp83_ = w;
				x2 = (gdouble) _tmp83_;
				_tmp84_ = s;
				y2 = _tmp84_ + 0.5;
				break;
			}
			case SCAN_DIRECTION_BOTTOM_TO_TOP:
			{
				gint _tmp85_;
				gint _tmp86_ = 0;
				gint _tmp87_;
				gdouble _tmp88_;
				gint _tmp89_;
				gint _tmp90_;
				gdouble _tmp91_;
				_tmp85_ = scan_line;
				_tmp86_ = page_view_page_to_screen_y (self, _tmp85_);
				s = (gdouble) _tmp86_;
				x1 = (gdouble) 0;
				_tmp87_ = h;
				_tmp88_ = s;
				y1 = (_tmp87_ - _tmp88_) + 0.5;
				_tmp89_ = w;
				x2 = (gdouble) _tmp89_;
				_tmp90_ = h;
				_tmp91_ = s;
				y2 = (_tmp90_ - _tmp91_) + 0.5;
				break;
			}
			case SCAN_DIRECTION_LEFT_TO_RIGHT:
			{
				gint _tmp92_;
				gint _tmp93_ = 0;
				gdouble _tmp94_;
				gdouble _tmp95_;
				gint _tmp96_;
				_tmp92_ = scan_line;
				_tmp93_ = page_view_page_to_screen_x (self, _tmp92_);
				s = (gdouble) _tmp93_;
				_tmp94_ = s;
				x1 = _tmp94_ + 0.5;
				y1 = (gdouble) 0;
				_tmp95_ = s;
				x2 = _tmp95_ + 0.5;
				_tmp96_ = h;
				y2 = (gdouble) _tmp96_;
				break;
			}
			case SCAN_DIRECTION_RIGHT_TO_LEFT:
			{
				gint _tmp97_;
				gint _tmp98_ = 0;
				gint _tmp99_;
				gdouble _tmp100_;
				gint _tmp101_;
				gdouble _tmp102_;
				gint _tmp103_;
				_tmp97_ = scan_line;
				_tmp98_ = page_view_page_to_screen_x (self, _tmp97_);
				s = (gdouble) _tmp98_;
				_tmp99_ = w;
				_tmp100_ = s;
				x1 = (_tmp99_ - _tmp100_) + 0.5;
				y1 = (gdouble) 0;
				_tmp101_ = w;
				_tmp102_ = s;
				x2 = (_tmp101_ - _tmp102_) + 0.5;
				_tmp103_ = h;
				y2 = (gdouble) _tmp103_;
				break;
			}
			default:
			{
				gdouble _tmp104_;
				gdouble _tmp105_;
				gdouble _tmp106_;
				y2 = (gdouble) 0;
				_tmp104_ = y2;
				x2 = _tmp104_;
				_tmp105_ = x2;
				y1 = _tmp105_;
				_tmp106_ = y1;
				x1 = _tmp106_;
				break;
			}
		}
		_tmp107_ = context;
		_tmp108_ = x1;
		_tmp109_ = y1;
		cairo_move_to (_tmp107_, _tmp108_, _tmp109_);
		_tmp110_ = context;
		_tmp111_ = x2;
		_tmp112_ = y2;
		cairo_line_to (_tmp110_, _tmp111_, _tmp112_);
		_tmp113_ = context;
		cairo_set_source_rgb (_tmp113_, 1.0, 0.0, 0.0);
		_tmp114_ = context;
		cairo_stroke (_tmp114_);
	}
	_tmp115_ = self->priv->page;
	_tmp116_ = page_has_crop (_tmp115_);
	if (_tmp116_) {
		gint x = 0;
		gint y = 0;
		gint crop_width = 0;
		gint crop_height = 0;
		Page* _tmp117_;
		gint _tmp118_ = 0;
		gint _tmp119_ = 0;
		gint _tmp120_ = 0;
		gint _tmp121_ = 0;
		gint _tmp122_;
		gint _tmp123_ = 0;
		gint dx;
		gint _tmp124_;
		gint _tmp125_ = 0;
		gint dy;
		gint _tmp126_;
		gint _tmp127_ = 0;
		gint dw;
		gint _tmp128_;
		gint _tmp129_ = 0;
		gint dh;
		cairo_t* _tmp130_;
		gint _tmp131_;
		gint _tmp132_;
		cairo_t* _tmp133_;
		cairo_t* _tmp134_;
		gint _tmp135_;
		gint _tmp136_;
		gint _tmp137_;
		gint _tmp138_;
		cairo_t* _tmp139_;
		cairo_t* _tmp140_;
		cairo_t* _tmp141_;
		cairo_t* _tmp142_;
		gint _tmp143_;
		gint _tmp144_;
		gint _tmp145_;
		gint _tmp146_;
		cairo_t* _tmp147_;
		cairo_t* _tmp148_;
		cairo_t* _tmp149_;
		gint _tmp150_;
		gint _tmp151_;
		gint _tmp152_;
		gint _tmp153_;
		cairo_t* _tmp154_;
		cairo_t* _tmp155_;
		_tmp117_ = self->priv->page;
		page_get_crop (_tmp117_, &_tmp118_, &_tmp119_, &_tmp120_, &_tmp121_);
		x = _tmp118_;
		y = _tmp119_;
		crop_width = _tmp120_;
		crop_height = _tmp121_;
		_tmp122_ = x;
		_tmp123_ = page_view_page_to_screen_x (self, _tmp122_);
		dx = _tmp123_;
		_tmp124_ = y;
		_tmp125_ = page_view_page_to_screen_y (self, _tmp124_);
		dy = _tmp125_;
		_tmp126_ = crop_width;
		_tmp127_ = page_view_page_to_screen_x (self, _tmp126_);
		dw = _tmp127_;
		_tmp128_ = crop_height;
		_tmp129_ = page_view_page_to_screen_y (self, _tmp128_);
		dh = _tmp129_;
		_tmp130_ = context;
		_tmp131_ = w;
		_tmp132_ = h;
		cairo_rectangle (_tmp130_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp131_, (gdouble) _tmp132_);
		_tmp133_ = context;
		cairo_new_sub_path (_tmp133_);
		_tmp134_ = context;
		_tmp135_ = dx;
		_tmp136_ = dy;
		_tmp137_ = dw;
		_tmp138_ = dh;
		cairo_rectangle (_tmp134_, (gdouble) _tmp135_, (gdouble) _tmp136_, (gdouble) _tmp137_, (gdouble) _tmp138_);
		_tmp139_ = context;
		cairo_set_fill_rule (_tmp139_, CAIRO_FILL_RULE_EVEN_ODD);
		_tmp140_ = context;
		cairo_set_source_rgba (_tmp140_, 0.25, 0.25, 0.25, 0.2);
		_tmp141_ = context;
		cairo_fill (_tmp141_);
		_tmp142_ = context;
		_tmp143_ = dx;
		_tmp144_ = dy;
		_tmp145_ = dw;
		_tmp146_ = dh;
		cairo_rectangle (_tmp142_, _tmp143_ - 1.5, _tmp144_ - 1.5, (gdouble) (_tmp145_ + 3), (gdouble) (_tmp146_ + 3));
		_tmp147_ = context;
		cairo_set_source_rgb (_tmp147_, 1.0, 1.0, 1.0);
		_tmp148_ = context;
		cairo_stroke (_tmp148_);
		_tmp149_ = context;
		_tmp150_ = dx;
		_tmp151_ = dy;
		_tmp152_ = dw;
		_tmp153_ = dh;
		cairo_rectangle (_tmp149_, _tmp150_ - 0.5, _tmp151_ - 0.5, (gdouble) (_tmp152_ + 1), (gdouble) (_tmp153_ + 1));
		_tmp154_ = context;
		cairo_set_source_rgb (_tmp154_, 0.0, 0.0, 0.0);
		_tmp155_ = context;
		cairo_stroke (_tmp155_);
	}
}


void page_view_set_width (PageView* self, gint width) {
	gint _tmp0_;
	Page* _tmp1_;
	gint _tmp2_ = 0;
	Page* _tmp3_;
	gint _tmp4_ = 0;
	gint height;
	gboolean _tmp5_ = FALSE;
	gint _tmp6_;
	gint _tmp7_;
	gboolean _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = width;
	_tmp1_ = self->priv->page;
	_tmp2_ = page_get_height (_tmp1_);
	_tmp3_ = self->priv->page;
	_tmp4_ = page_get_width (_tmp3_);
	height = (gint) ((((gdouble) _tmp0_) * _tmp2_) / _tmp4_);
	_tmp6_ = self->priv->width;
	_tmp7_ = width;
	if (_tmp6_ == _tmp7_) {
		gint _tmp8_;
		gint _tmp9_;
		_tmp8_ = self->priv->height;
		_tmp9_ = height;
		_tmp5_ = _tmp8_ == _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	_tmp10_ = _tmp5_;
	if (_tmp10_) {
		return;
	}
	_tmp11_ = width;
	self->priv->width = _tmp11_;
	_tmp12_ = height;
	self->priv->height = _tmp12_;
	self->priv->update_image = TRUE;
	g_signal_emit_by_name (self, "size-changed");
	g_signal_emit_by_name (self, "changed");
}


void page_view_set_height (PageView* self, gint height) {
	gint _tmp0_;
	Page* _tmp1_;
	gint _tmp2_ = 0;
	Page* _tmp3_;
	gint _tmp4_ = 0;
	gint width;
	gboolean _tmp5_ = FALSE;
	gint _tmp6_;
	gint _tmp7_;
	gboolean _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = height;
	_tmp1_ = self->priv->page;
	_tmp2_ = page_get_width (_tmp1_);
	_tmp3_ = self->priv->page;
	_tmp4_ = page_get_height (_tmp3_);
	width = (gint) ((((gdouble) _tmp0_) * _tmp2_) / _tmp4_);
	_tmp6_ = self->priv->width;
	_tmp7_ = width;
	if (_tmp6_ == _tmp7_) {
		gint _tmp8_;
		gint _tmp9_;
		_tmp8_ = self->priv->height;
		_tmp9_ = height;
		_tmp5_ = _tmp8_ == _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	_tmp10_ = _tmp5_;
	if (_tmp10_) {
		return;
	}
	_tmp11_ = width;
	self->priv->width = _tmp11_;
	_tmp12_ = height;
	self->priv->height = _tmp12_;
	self->priv->update_image = TRUE;
	g_signal_emit_by_name (self, "size-changed");
	g_signal_emit_by_name (self, "changed");
}


gint page_view_get_width (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->width;
	result = _tmp0_;
	return result;
}


gint page_view_get_height (PageView* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->height;
	result = _tmp0_;
	return result;
}


static void page_view_page_pixels_changed_cb (PageView* self, Page* p) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (p != NULL);
	self->priv->update_image = TRUE;
	g_signal_emit_by_name (self, "changed");
}


static void page_view_page_size_changed_cb (PageView* self, Page* p) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (p != NULL);
	self->priv->update_image = TRUE;
	g_signal_emit_by_name (self, "size-changed");
	g_signal_emit_by_name (self, "changed");
}


static void page_view_page_overlay_changed_cb (PageView* self, Page* p) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (p != NULL);
	g_signal_emit_by_name (self, "changed");
}


static void page_view_scan_direction_changed_cb (PageView* self, Page* p) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (p != NULL);
	self->priv->update_image = TRUE;
	g_signal_emit_by_name (self, "size-changed");
	g_signal_emit_by_name (self, "changed");
}


static void value_page_view_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_page_view_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		page_view_unref (value->data[0].v_pointer);
	}
}


static void value_page_view_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = page_view_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_page_view_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_page_view_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		PageView* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = page_view_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_page_view_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	PageView** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = page_view_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_page_view (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecPageView* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_PAGE_VIEW), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_page_view (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PAGE_VIEW), NULL);
	return value->data[0].v_pointer;
}


void value_set_page_view (GValue* value, gpointer v_object) {
	PageView* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PAGE_VIEW));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PAGE_VIEW));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		page_view_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		page_view_unref (old);
	}
}


void value_take_page_view (GValue* value, gpointer v_object) {
	PageView* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PAGE_VIEW));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PAGE_VIEW));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		page_view_unref (old);
	}
}


static void page_view_class_init (PageViewClass * klass) {
	page_view_parent_class = g_type_class_peek_parent (klass);
	PAGE_VIEW_CLASS (klass)->finalize = page_view_finalize;
	g_type_class_add_private (klass, sizeof (PageViewPrivate));
	g_signal_new ("size_changed", TYPE_PAGE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	g_signal_new ("changed", TYPE_PAGE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void page_view_instance_init (PageView * self) {
	self->priv = PAGE_VIEW_GET_PRIVATE (self);
	self->priv->image = NULL;
	self->priv->border_width = 1;
	self->priv->update_image = TRUE;
	self->priv->cursor = GDK_ARROW;
	self->priv->animate_n_segments = 7;
	self->ref_count = 1;
}


static void page_view_finalize (PageView* obj) {
	PageView * self;
	Page* _tmp0_;
	guint _tmp1_ = 0U;
	Page* _tmp2_;
	guint _tmp3_ = 0U;
	Page* _tmp4_;
	guint _tmp5_ = 0U;
	Page* _tmp6_;
	guint _tmp7_ = 0U;
	Page* _tmp8_;
	guint _tmp9_ = 0U;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PAGE_VIEW, PageView);
	_tmp0_ = self->priv->page;
	g_signal_parse_name ("pixels-changed", TYPE_PAGE, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _page_view_page_pixels_changed_cb_page_pixels_changed, self);
	_tmp2_ = self->priv->page;
	g_signal_parse_name ("size-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _page_view_page_size_changed_cb_page_size_changed, self);
	_tmp4_ = self->priv->page;
	g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _page_view_page_overlay_changed_cb_page_crop_changed, self);
	_tmp6_ = self->priv->page;
	g_signal_parse_name ("scan-line-changed", TYPE_PAGE, &_tmp7_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _page_view_page_overlay_changed_cb_page_scan_line_changed, self);
	_tmp8_ = self->priv->page;
	g_signal_parse_name ("scan-direction-changed", TYPE_PAGE, &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _page_view_scan_direction_changed_cb_page_scan_direction_changed, self);
	_page_unref0 (self->priv->page);
	_g_object_unref0 (self->priv->image);
}


GType page_view_get_type (void) {
	static volatile gsize page_view_type_id__volatile = 0;
	if (g_once_init_enter (&page_view_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_page_view_init, value_page_view_free_value, value_page_view_copy_value, value_page_view_peek_pointer, "p", value_page_view_collect_value, "p", value_page_view_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (PageViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) page_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PageView), 0, (GInstanceInitFunc) page_view_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType page_view_type_id;
		page_view_type_id = g_type_register_fundamental (g_type_fundamental_next (), "PageView", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&page_view_type_id__volatile, page_view_type_id);
	}
	return page_view_type_id__volatile;
}


gpointer page_view_ref (gpointer instance) {
	PageView* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void page_view_unref (gpointer instance) {
	PageView* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PAGE_VIEW_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}