Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <limits.h>
31 : :
32 : : #include <tools/bigint.hxx>
33 : : #include <tools/debug.hxx>
34 : : #include <tools/poly.hxx>
35 : :
36 : : #include <vcl/virdev.hxx>
37 : : #include <vcl/region.hxx>
38 : : #include <vcl/wrkwin.hxx>
39 : : #include <vcl/cursor.hxx>
40 : : #include <vcl/metaact.hxx>
41 : : #include <vcl/gdimtf.hxx>
42 : : #include <vcl/lineinfo.hxx>
43 : : #include <vcl/outdev.hxx>
44 : :
45 : : #include <svdata.hxx>
46 : : #include <region.h>
47 : : #include <window.h>
48 : : #include <outdev.h>
49 : : #include <salgdi.hxx>
50 : :
51 : : #include <basegfx/matrix/b2dhommatrix.hxx>
52 : : #include <basegfx/polygon/b2dpolygon.hxx>
53 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
54 : :
55 : : // =======================================================================
56 : :
57 : : DBG_NAMEEX( OutputDevice )
58 : : DBG_NAMEEX( Polygon )
59 : : DBG_NAMEEX( PolyPolygon )
60 : : DBG_NAMEEX( Region )
61 : :
62 : : // =======================================================================
63 : :
64 : : static int const s_ImplArySize = MAP_PIXEL+1;
65 : : static long aImplNumeratorAry[s_ImplArySize] =
66 : : { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1 };
67 : : static long aImplDenominatorAry[s_ImplArySize] =
68 : : { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1 };
69 : :
70 : : // -----------------------------------------------------------------------
71 : :
72 : : /*
73 : : Reduziert die Genauigkeit bis eine Fraction draus wird (sollte mal
74 : : ein Fraction ctor werden) koennte man dann auch mit BigInts machen
75 : : */
76 : :
77 : 1260428 : static Fraction ImplMakeFraction( long nN1, long nN2, long nD1, long nD2 )
78 : : {
79 : 1260428 : long i = 1;
80 : :
81 [ - + ]: 1260428 : if ( nN1 < 0 ) { i = -i; nN1 = -nN1; }
82 [ - + ]: 1260428 : if ( nN2 < 0 ) { i = -i; nN2 = -nN2; }
83 [ - + ]: 1260428 : if ( nD1 < 0 ) { i = -i; nD1 = -nD1; }
84 [ - + ]: 1260428 : if ( nD2 < 0 ) { i = -i; nD2 = -nD2; }
85 : : // alle positiv; i Vorzeichen
86 : :
87 [ + - ]: 1260428 : Fraction aF( i*nN1, nD1 );
88 [ + - ][ + - ]: 1260428 : aF *= Fraction( nN2, nD2 );
89 : :
90 [ + - ][ - + ]: 1260428 : if( nD1 == 0 || nD2 == 0 ) //under these bad circumstances the following while loop will be endless
91 : : {
92 : : DBG_ASSERT(false,"Invalid parameter for ImplMakeFraction");
93 [ # # ]: 0 : return Fraction( 1, 1 );
94 : : }
95 : :
96 [ + + ]: 1379531 : while ( aF.GetDenominator() == -1 )
97 : : {
98 [ - + ]: 119103 : if ( nN1 > nN2 )
99 : 0 : nN1 = (nN1 + 1) / 2;
100 : : else
101 : 119103 : nN2 = (nN2 + 1) / 2;
102 [ - + ]: 119103 : if ( nD1 > nD2 )
103 : 0 : nD1 = (nD1 + 1) / 2;
104 : : else
105 : 119103 : nD2 = (nD2 + 1) / 2;
106 : :
107 [ + - ][ + - ]: 119103 : aF = Fraction( i*nN1, nD1 );
108 [ + - ][ + - ]: 119103 : aF *= Fraction( nN2, nD2 );
109 : : }
110 : :
111 [ + - ]: 1260428 : return aF;
112 : : }
113 : :
114 : : // -----------------------------------------------------------------------
115 : :
116 : : // Fraction.GetNumerator()
117 : : // Fraction.GetDenominator() > 0
118 : : // rOutRes.nPixPerInch? > 0
119 : : // rMapRes.nMapScNum?
120 : : // rMapRes.nMapScDenom? > 0
121 : :
122 : 628323 : static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY,
123 : : const ImplMapRes& rMapRes,
124 : : ImplThresholdRes& rThresRes )
125 : : {
126 [ + - ][ - + ]: 628323 : if ( nDPIX && (LONG_MAX / nDPIX < Abs( rMapRes.mnMapScNumX ) ) ) // #111139# avoid div by zero
[ - + ]
127 : : {
128 : 0 : rThresRes.mnThresLogToPixX = 0;
129 : 0 : rThresRes.mnThresPixToLogX = 0;
130 : : }
131 : : else
132 : : {
133 : : // Schwellenwerte fuer BigInt Arithmetik berechnen
134 : 628323 : long nDenomHalfX = rMapRes.mnMapScDenomX / 2;
135 : 628323 : sal_uLong nDenomX = rMapRes.mnMapScDenomX;
136 : 628323 : long nProductX = nDPIX * rMapRes.mnMapScNumX;
137 : :
138 [ - + ]: 628323 : if ( !nProductX )
139 : 0 : rThresRes.mnThresLogToPixX = LONG_MAX;
140 : : else
141 : 628323 : rThresRes.mnThresLogToPixX = Abs( (LONG_MAX - nDenomHalfX) / nProductX );
142 : :
143 [ - + ]: 628323 : if ( !nDenomX )
144 : 0 : rThresRes.mnThresPixToLogX = LONG_MAX;
145 [ + - ]: 628323 : else if ( nProductX >= 0 )
146 : 628323 : rThresRes.mnThresPixToLogX = (long)(((sal_uLong)LONG_MAX - (sal_uLong)( nProductX/2)) / nDenomX);
147 : : else
148 : 0 : rThresRes.mnThresPixToLogX = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductX/2)) / nDenomX);
149 : : }
150 : :
151 [ + - ][ - + ]: 628323 : if ( nDPIY && (LONG_MAX / nDPIY < Abs( rMapRes.mnMapScNumY ) ) ) // #111139# avoid div by zero
[ - + ]
152 : : {
153 : 0 : rThresRes.mnThresLogToPixY = 0;
154 : 0 : rThresRes.mnThresPixToLogY = 0;
155 : : }
156 : : else
157 : : {
158 : : // Schwellenwerte fuer BigInt Arithmetik berechnen
159 : 628323 : long nDenomHalfY = rMapRes.mnMapScDenomY / 2;
160 : 628323 : sal_uLong nDenomY = rMapRes.mnMapScDenomY;
161 : 628323 : long nProductY = nDPIY * rMapRes.mnMapScNumY;
162 : :
163 [ - + ]: 628323 : if ( !nProductY )
164 : 0 : rThresRes.mnThresLogToPixY = LONG_MAX;
165 : : else
166 : 628323 : rThresRes.mnThresLogToPixY = Abs( (LONG_MAX - nDenomHalfY) / nProductY );
167 : :
168 [ - + ]: 628323 : if ( !nDenomY )
169 : 0 : rThresRes.mnThresPixToLogY = LONG_MAX;
170 [ + - ]: 628323 : else if ( nProductY >= 0 )
171 : 628323 : rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX - (sal_uLong)( nProductY/2)) / nDenomY);
172 : : else
173 : 0 : rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductY/2)) / nDenomY);
174 : : }
175 : :
176 : 628323 : rThresRes.mnThresLogToPixX /= 2;
177 : 628323 : rThresRes.mnThresLogToPixY /= 2;
178 : 628323 : rThresRes.mnThresPixToLogX /= 2;
179 : 628323 : rThresRes.mnThresPixToLogY /= 2;
180 : 628323 : }
181 : :
182 : : // -----------------------------------------------------------------------
183 : :
184 : 630136 : static void ImplCalcMapResolution( const MapMode& rMapMode,
185 : : long nDPIX, long nDPIY, ImplMapRes& rMapRes )
186 : : {
187 [ + + + - : 630136 : switch ( rMapMode.GetMapUnit() )
+ - + - +
+ + + +
- ]
188 : : {
189 : : case MAP_RELATIVE:
190 : 59 : break;
191 : : case MAP_100TH_MM:
192 : 55285 : rMapRes.mnMapScNumX = 1;
193 : 55285 : rMapRes.mnMapScDenomX = 2540;
194 : 55285 : rMapRes.mnMapScNumY = 1;
195 : 55285 : rMapRes.mnMapScDenomY = 2540;
196 : 55285 : break;
197 : : case MAP_10TH_MM:
198 : 36 : rMapRes.mnMapScNumX = 1;
199 : 36 : rMapRes.mnMapScDenomX = 254;
200 : 36 : rMapRes.mnMapScNumY = 1;
201 : 36 : rMapRes.mnMapScDenomY = 254;
202 : 36 : break;
203 : : case MAP_MM:
204 : 0 : rMapRes.mnMapScNumX = 5; // 10
205 : 0 : rMapRes.mnMapScDenomX = 127; // 254
206 : 0 : rMapRes.mnMapScNumY = 5; // 10
207 : 0 : rMapRes.mnMapScDenomY = 127; // 254
208 : 0 : break;
209 : : case MAP_CM:
210 : 19486 : rMapRes.mnMapScNumX = 50; // 100
211 : 19486 : rMapRes.mnMapScDenomX = 127; // 254
212 : 19486 : rMapRes.mnMapScNumY = 50; // 100
213 : 19486 : rMapRes.mnMapScDenomY = 127; // 254
214 : 19486 : break;
215 : : case MAP_1000TH_INCH:
216 : 0 : rMapRes.mnMapScNumX = 1;
217 : 0 : rMapRes.mnMapScDenomX = 1000;
218 : 0 : rMapRes.mnMapScNumY = 1;
219 : 0 : rMapRes.mnMapScDenomY = 1000;
220 : 0 : break;
221 : : case MAP_100TH_INCH:
222 : 417703 : rMapRes.mnMapScNumX = 1;
223 : 417703 : rMapRes.mnMapScDenomX = 100;
224 : 417703 : rMapRes.mnMapScNumY = 1;
225 : 417703 : rMapRes.mnMapScDenomY = 100;
226 : 417703 : break;
227 : : case MAP_10TH_INCH:
228 : 0 : rMapRes.mnMapScNumX = 1;
229 : 0 : rMapRes.mnMapScDenomX = 10;
230 : 0 : rMapRes.mnMapScNumY = 1;
231 : 0 : rMapRes.mnMapScDenomY = 10;
232 : 0 : break;
233 : : case MAP_INCH:
234 : 47 : rMapRes.mnMapScNumX = 1;
235 : 47 : rMapRes.mnMapScDenomX = 1;
236 : 47 : rMapRes.mnMapScNumY = 1;
237 : 47 : rMapRes.mnMapScDenomY = 1;
238 : 47 : break;
239 : : case MAP_POINT:
240 : 861 : rMapRes.mnMapScNumX = 1;
241 : 861 : rMapRes.mnMapScDenomX = 72;
242 : 861 : rMapRes.mnMapScNumY = 1;
243 : 861 : rMapRes.mnMapScDenomY = 72;
244 : 861 : break;
245 : : case MAP_TWIP:
246 : 125046 : rMapRes.mnMapScNumX = 1;
247 : 125046 : rMapRes.mnMapScDenomX = 1440;
248 : 125046 : rMapRes.mnMapScNumY = 1;
249 : 125046 : rMapRes.mnMapScDenomY = 1440;
250 : 125046 : break;
251 : : case MAP_PIXEL:
252 : 6085 : rMapRes.mnMapScNumX = 1;
253 : 6085 : rMapRes.mnMapScDenomX = nDPIX;
254 : 6085 : rMapRes.mnMapScNumY = 1;
255 : 6085 : rMapRes.mnMapScDenomY = nDPIY;
256 : 6085 : break;
257 : : case MAP_SYSFONT:
258 : : case MAP_APPFONT:
259 : : case MAP_REALAPPFONT:
260 : : {
261 [ + - ]: 5528 : ImplSVData* pSVData = ImplGetSVData();
262 [ - + ]: 5528 : if ( !pSVData->maGDIData.mnAppFontX )
263 : : {
264 [ # # ]: 0 : if( pSVData->maWinData.mpFirstFrame )
265 [ # # ]: 0 : Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame );
266 : : else
267 : : {
268 [ # # ][ # # ]: 0 : WorkWindow* pWin = new WorkWindow( NULL, 0 );
269 [ # # ]: 0 : Window::ImplInitAppFontData( pWin );
270 [ # # ][ # # ]: 0 : delete pWin;
271 : : }
272 : : }
273 [ - + ]: 5528 : if ( rMapMode.GetMapUnit() == MAP_REALAPPFONT )
274 : 0 : rMapRes.mnMapScNumX = pSVData->maGDIData.mnRealAppFontX;
275 : : else
276 : 5528 : rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
277 : 5528 : rMapRes.mnMapScDenomX = nDPIX * 40;
278 : 5528 : rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;
279 : 5528 : rMapRes.mnMapScDenomY = nDPIY * 80;
280 : : }
281 : 5528 : break;
282 : : default:
283 : : OSL_FAIL( "unhandled MapUnit" );
284 : 0 : break;
285 : : }
286 : :
287 [ + - ]: 630136 : Fraction aScaleX = rMapMode.GetScaleX();
288 [ + - ]: 630136 : Fraction aScaleY = rMapMode.GetScaleY();
289 : :
290 : : // Offset laut MapMode setzen
291 : 630136 : Point aOrigin = rMapMode.GetOrigin();
292 [ + + ]: 630136 : if ( rMapMode.GetMapUnit() != MAP_RELATIVE )
293 : : {
294 : 630077 : rMapRes.mnMapOfsX = aOrigin.X();
295 : 630077 : rMapRes.mnMapOfsY = aOrigin.Y();
296 : : }
297 : : else
298 : : {
299 [ + - ]: 59 : BigInt aX( rMapRes.mnMapOfsX );
300 [ + - ][ + - ]: 59 : aX *= BigInt( aScaleX.GetDenominator() );
301 [ + - ]: 59 : if ( rMapRes.mnMapOfsX >= 0 )
302 : : {
303 [ + - ]: 59 : if ( aScaleX.GetNumerator() >= 0 )
304 [ + - ][ + - ]: 59 : aX += BigInt( aScaleX.GetNumerator()/2 );
305 : : else
306 [ # # ][ # # ]: 0 : aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
307 : : }
308 : : else
309 : : {
310 [ # # ]: 0 : if ( aScaleX.GetNumerator() >= 0 )
311 [ # # ][ # # ]: 0 : aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
312 : : else
313 [ # # ][ # # ]: 0 : aX += BigInt( aScaleX.GetNumerator()/2 );
314 : : }
315 [ + - ][ + - ]: 59 : aX /= BigInt( aScaleX.GetNumerator() );
316 [ + - ]: 59 : rMapRes.mnMapOfsX = (long)aX + aOrigin.X();
317 [ + - ]: 59 : BigInt aY( rMapRes.mnMapOfsY );
318 [ + - ][ + - ]: 59 : aY *= BigInt( aScaleY.GetDenominator() );
319 [ + - ]: 59 : if( rMapRes.mnMapOfsY >= 0 )
320 : : {
321 [ + - ]: 59 : if ( aScaleY.GetNumerator() >= 0 )
322 [ + - ][ + - ]: 59 : aY += BigInt( aScaleY.GetNumerator()/2 );
323 : : else
324 [ # # ][ # # ]: 0 : aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
325 : : }
326 : : else
327 : : {
328 [ # # ]: 0 : if ( aScaleY.GetNumerator() >= 0 )
329 [ # # ][ # # ]: 0 : aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
330 : : else
331 [ # # ][ # # ]: 0 : aY += BigInt( aScaleY.GetNumerator()/2 );
332 : : }
333 [ + - ][ + - ]: 59 : aY /= BigInt( aScaleY.GetNumerator() );
334 [ + - ]: 59 : rMapRes.mnMapOfsY = (long)aY + aOrigin.Y();
335 : : }
336 : :
337 : : // Scaling Faktor laut MapMode einberechnen
338 : : // aTemp? = rMapRes.mnMapSc? * aScale?
339 : : Fraction aTempX = ImplMakeFraction( rMapRes.mnMapScNumX,
340 : : aScaleX.GetNumerator(),
341 : : rMapRes.mnMapScDenomX,
342 [ + - ]: 630136 : aScaleX.GetDenominator() );
343 : : Fraction aTempY = ImplMakeFraction( rMapRes.mnMapScNumY,
344 : : aScaleY.GetNumerator(),
345 : : rMapRes.mnMapScDenomY,
346 [ + - ]: 630136 : aScaleY.GetDenominator() );
347 : 630136 : rMapRes.mnMapScNumX = aTempX.GetNumerator();
348 : 630136 : rMapRes.mnMapScDenomX = aTempX.GetDenominator();
349 : 630136 : rMapRes.mnMapScNumY = aTempY.GetNumerator();
350 : 630136 : rMapRes.mnMapScDenomY = aTempY.GetDenominator();
351 : :
352 : : // hack: 0/n ungef"ahr 1/max
353 [ - + ]: 630136 : if ( !rMapRes.mnMapScNumX )
354 : : {
355 : 0 : rMapRes.mnMapScNumX = 1;
356 : 0 : rMapRes.mnMapScDenomX = LONG_MAX;
357 : : }
358 [ - + ]: 630136 : if ( !rMapRes.mnMapScNumY )
359 : : {
360 : 0 : rMapRes.mnMapScNumY = 1;
361 : 0 : rMapRes.mnMapScDenomY = LONG_MAX;
362 : : }
363 : 630136 : }
364 : :
365 : : // -----------------------------------------------------------------------
366 : :
367 : 628323 : inline void ImplCalcMapResolution( const MapMode& rMapMode,
368 : : long nDPIX, long nDPIY,
369 : : ImplMapRes& rMapRes,
370 : : ImplThresholdRes& rThresRes )
371 : : {
372 : 628323 : ImplCalcMapResolution( rMapMode, nDPIX, nDPIY, rMapRes );
373 : 628323 : ImplCalcBigIntThreshold( nDPIX, nDPIY, rMapRes, rThresRes );
374 : 628323 : }
375 : :
376 : : // -----------------------------------------------------------------------
377 : :
378 : 10630433 : static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
379 : : long nThres )
380 : : {
381 : : // To "use" it...
382 : : (void) nThres;
383 : : #if (SAL_TYPES_SIZEOFLONG < 8)
384 [ + + ][ + + ]: 10630433 : if( (+n < nThres) && (-n < nThres) )
385 : : {
386 : 10538517 : n *= nMapNum * nDPI;
387 [ + - ]: 21077034 : if( nMapDenom != 1 )
388 : : {
389 : 10538517 : n = (2 * n) / nMapDenom;
390 [ + + ]: 10538517 : if( n < 0 ) --n; else ++n;
391 : 10538517 : n /= 2;
392 : : }
393 : : }
394 : : else
395 : : #endif
396 : : {
397 : 91916 : sal_Int64 n64 = n;
398 : 91916 : n64 *= nMapNum;
399 : 91916 : n64 *= nDPI;
400 [ - + ]: 91916 : if( nMapDenom == 1 )
401 : 0 : n = (long)n64;
402 : : else
403 : : {
404 : 91916 : n = (long)(2 * n64 / nMapDenom);
405 [ + + ]: 91916 : if( n < 0 ) --n; else ++n;
406 : 91916 : n /= 2;
407 : : }
408 : : }
409 : 10630433 : return n;
410 : : }
411 : :
412 : : // -----------------------------------------------------------------------
413 : :
414 : 12081817 : static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
415 : : long nThres )
416 : : {
417 : : // To "use" it...
418 : : (void) nThres;
419 : : #if (SAL_TYPES_SIZEOFLONG < 8)
420 [ + + ][ + + ]: 12081817 : if( (+n < nThres) && (-n < nThres) )
421 : 12036879 : n = (2 * n * nMapDenom) / (nDPI * nMapNum);
422 : : else
423 : : #endif
424 : : {
425 : 44938 : sal_Int64 n64 = n;
426 : 44938 : n64 *= nMapDenom;
427 : 44938 : long nDenom = nDPI * nMapNum;
428 : 44938 : n = (long)(2 * n64 / nDenom);
429 : : }
430 [ + + ]: 12081817 : if( n < 0 ) --n; else ++n;
431 : 12081817 : return (n / 2);
432 : : }
433 : :
434 : : // -----------------------------------------------------------------------
435 : :
436 : 571783 : long OutputDevice::ImplLogicXToDevicePixel( long nX ) const
437 : : {
438 [ + + ]: 571783 : if ( !mbMap )
439 : 535527 : return nX+mnOutOffX;
440 : :
441 : : return ImplLogicToPixel( nX + maMapRes.mnMapOfsX, mnDPIX,
442 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
443 : 571783 : maThresRes.mnThresLogToPixX )+mnOutOffX+mnOutOffOrigX;
444 : : }
445 : :
446 : : // -----------------------------------------------------------------------
447 : :
448 : 579064 : long OutputDevice::ImplLogicYToDevicePixel( long nY ) const
449 : : {
450 [ + + ]: 579064 : if ( !mbMap )
451 : 545811 : return nY+mnOutOffY;
452 : :
453 : : return ImplLogicToPixel( nY + maMapRes.mnMapOfsY, mnDPIY,
454 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
455 : 579064 : maThresRes.mnThresLogToPixY )+mnOutOffY+mnOutOffOrigY;
456 : : }
457 : :
458 : : // -----------------------------------------------------------------------
459 : :
460 : 2321886 : long OutputDevice::ImplLogicWidthToDevicePixel( long nWidth ) const
461 : : {
462 [ + + ]: 2321886 : if ( !mbMap )
463 : 713710 : return nWidth;
464 : :
465 : : return ImplLogicToPixel( nWidth, mnDPIX,
466 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
467 : 2321886 : maThresRes.mnThresLogToPixX );
468 : : }
469 : :
470 : : // -----------------------------------------------------------------------
471 : :
472 : 546402 : long OutputDevice::ImplLogicHeightToDevicePixel( long nHeight ) const
473 : : {
474 [ + + ]: 546402 : if ( !mbMap )
475 : 518032 : return nHeight;
476 : :
477 : : return ImplLogicToPixel( nHeight, mnDPIY,
478 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
479 : 546402 : maThresRes.mnThresLogToPixY );
480 : : }
481 : :
482 : 744383 : float OutputDevice::ImplFloatLogicHeightToDevicePixel( float fLogicHeight) const
483 : : {
484 [ + + ]: 744383 : if( !mbMap)
485 : 103387 : return fLogicHeight;
486 : 640996 : float fPixelHeight = (fLogicHeight * mnDPIY * maMapRes.mnMapScNumY) / maMapRes.mnMapScDenomY;
487 : 744383 : return fPixelHeight;
488 : : }
489 : :
490 : : // -----------------------------------------------------------------------
491 : :
492 : 4373162 : long OutputDevice::ImplDevicePixelToLogicWidth( long nWidth ) const
493 : : {
494 [ + + ]: 4373162 : if ( !mbMap )
495 : 1232 : return nWidth;
496 : :
497 : : return ImplPixelToLogic( nWidth, mnDPIX,
498 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
499 : 4373162 : maThresRes.mnThresPixToLogX );
500 : : }
501 : :
502 : : // -----------------------------------------------------------------------
503 : :
504 : 3574365 : long OutputDevice::ImplDevicePixelToLogicHeight( long nHeight ) const
505 : : {
506 [ + + ]: 3574365 : if ( !mbMap )
507 : 171444 : return nHeight;
508 : :
509 : : return ImplPixelToLogic( nHeight, mnDPIY,
510 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
511 : 3574365 : maThresRes.mnThresPixToLogY );
512 : : }
513 : :
514 : : // -----------------------------------------------------------------------
515 : :
516 : 3165752 : Point OutputDevice::ImplLogicToDevicePixel( const Point& rLogicPt ) const
517 : : {
518 [ + + ]: 3165752 : if ( !mbMap )
519 : 2701421 : return Point( rLogicPt.X()+mnOutOffX, rLogicPt.Y()+mnOutOffY );
520 : :
521 : 464331 : return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
522 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
523 : 464331 : maThresRes.mnThresLogToPixX )+mnOutOffX+mnOutOffOrigX,
524 : 464331 : ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
525 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
526 : 3630083 : maThresRes.mnThresLogToPixY )+mnOutOffY+mnOutOffOrigY );
527 : : }
528 : :
529 : : // -----------------------------------------------------------------------
530 : :
531 : 841765 : Size OutputDevice::ImplLogicToDevicePixel( const Size& rLogicSize ) const
532 : : {
533 [ + + ]: 841765 : if ( !mbMap )
534 : 200004 : return rLogicSize;
535 : :
536 : : return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
537 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
538 : : maThresRes.mnThresLogToPixX ),
539 : : ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
540 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
541 : 841765 : maThresRes.mnThresLogToPixY ) );
542 : : }
543 : :
544 : : // -----------------------------------------------------------------------
545 : :
546 : 991287 : Rectangle OutputDevice::ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const
547 : : {
548 [ + + ]: 991287 : if ( rLogicRect.IsEmpty() )
549 : 20496 : return rLogicRect;
550 : :
551 [ + + ]: 970791 : if ( !mbMap )
552 : : {
553 : 871523 : return Rectangle( rLogicRect.Left()+mnOutOffX, rLogicRect.Top()+mnOutOffY,
554 : 1743046 : rLogicRect.Right()+mnOutOffX, rLogicRect.Bottom()+mnOutOffY );
555 : : }
556 : :
557 : 99268 : return Rectangle( ImplLogicToPixel( rLogicRect.Left()+maMapRes.mnMapOfsX, mnDPIX,
558 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
559 : 99268 : maThresRes.mnThresLogToPixX )+mnOutOffX+mnOutOffOrigX,
560 : 99268 : ImplLogicToPixel( rLogicRect.Top()+maMapRes.mnMapOfsY, mnDPIY,
561 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
562 : 99268 : maThresRes.mnThresLogToPixY )+mnOutOffY+mnOutOffOrigY,
563 : 99268 : ImplLogicToPixel( rLogicRect.Right()+maMapRes.mnMapOfsX, mnDPIX,
564 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
565 : 99268 : maThresRes.mnThresLogToPixX )+mnOutOffX+mnOutOffOrigX,
566 : 99268 : ImplLogicToPixel( rLogicRect.Bottom()+maMapRes.mnMapOfsY, mnDPIY,
567 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
568 : 1090555 : maThresRes.mnThresLogToPixY )+mnOutOffY+mnOutOffOrigY );
569 : : }
570 : :
571 : : // -----------------------------------------------------------------------
572 : :
573 : 532867 : Polygon OutputDevice::ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const
574 : : {
575 [ + + ][ + + ]: 532867 : if ( !mbMap && !mnOutOffX && !mnOutOffY )
[ + + ]
576 [ + - ]: 259159 : return rLogicPoly;
577 : :
578 : : sal_uInt16 i;
579 [ + - ]: 273708 : sal_uInt16 nPoints = rLogicPoly.GetSize();
580 [ + - ]: 273708 : Polygon aPoly( rLogicPoly );
581 : :
582 : : // Pointer auf das Point-Array holen (Daten werden kopiert)
583 [ + - ]: 273708 : const Point* pPointAry = aPoly.GetConstPointAry();
584 : :
585 [ + + ]: 273708 : if ( mbMap )
586 : : {
587 [ + + ]: 1581891 : for ( i = 0; i < nPoints; i++ )
588 : : {
589 : 1316903 : const Point* pPt = &(pPointAry[i]);
590 : 1316903 : Point aPt;
591 : 1316903 : aPt.X() = ImplLogicToPixel( pPt->X()+maMapRes.mnMapOfsX, mnDPIX,
592 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
593 : 1316903 : maThresRes.mnThresLogToPixX )+mnOutOffX+mnOutOffOrigX;
594 : 1316903 : aPt.Y() = ImplLogicToPixel( pPt->Y()+maMapRes.mnMapOfsY, mnDPIY,
595 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
596 : 1316903 : maThresRes.mnThresLogToPixY )+mnOutOffY+mnOutOffOrigY;
597 [ + - ]: 1316903 : aPoly[i] = aPt;
598 : : }
599 : : }
600 : : else
601 : : {
602 [ + + ]: 160472 : for ( i = 0; i < nPoints; i++ )
603 : : {
604 : 151752 : Point aPt = pPointAry[i];
605 : 151752 : aPt.X() += mnOutOffX;
606 : 151752 : aPt.Y() += mnOutOffY;
607 [ + - ]: 151752 : aPoly[i] = aPt;
608 : : }
609 : : }
610 : :
611 [ + - ][ + - ]: 532867 : return aPoly;
612 : : }
613 : :
614 : : // -----------------------------------------------------------------------
615 : :
616 : 288889 : PolyPolygon OutputDevice::ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const
617 : : {
618 [ + + ][ + - ]: 288889 : if ( !mbMap && !mnOutOffX && !mnOutOffY )
[ + - ]
619 [ + - ]: 52142 : return rLogicPolyPoly;
620 : :
621 [ + - ]: 236747 : PolyPolygon aPolyPoly( rLogicPolyPoly );
622 [ + - ]: 236747 : sal_uInt16 nPoly = aPolyPoly.Count();
623 [ + + ]: 493800 : for( sal_uInt16 i = 0; i < nPoly; i++ )
624 : : {
625 [ + - ]: 257053 : Polygon& rPoly = aPolyPoly[i];
626 [ + - ][ + - ]: 257053 : rPoly = ImplLogicToDevicePixel( rPoly );
[ + - ]
627 : : }
628 [ + - ][ + - ]: 288889 : return aPolyPoly;
629 : : }
630 : :
631 : : // -----------------------------------------------------------------------
632 : :
633 : 184807 : LineInfo OutputDevice::ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const
634 : : {
635 : 184807 : LineInfo aInfo( rLineInfo );
636 : :
637 [ - + ]: 184807 : if( aInfo.GetStyle() == LINE_DASH )
638 : : {
639 [ # # ][ # # ]: 0 : if( aInfo.GetDotCount() && aInfo.GetDotLen() )
[ # # ]
640 [ # # ]: 0 : aInfo.SetDotLen( Max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), 1L ) );
641 : : else
642 [ # # ]: 0 : aInfo.SetDotCount( 0 );
643 : :
644 [ # # ][ # # ]: 0 : if( aInfo.GetDashCount() && aInfo.GetDashLen() )
[ # # ]
645 [ # # ]: 0 : aInfo.SetDashLen( Max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), 1L ) );
646 : : else
647 [ # # ]: 0 : aInfo.SetDashCount( 0 );
648 : :
649 [ # # ]: 0 : aInfo.SetDistance( ImplLogicWidthToDevicePixel( aInfo.GetDistance() ) );
650 : :
651 [ # # ][ # # ]: 0 : if( ( !aInfo.GetDashCount() && !aInfo.GetDotCount() ) || !aInfo.GetDistance() )
[ # # ][ # # ]
652 [ # # ]: 0 : aInfo.SetStyle( LINE_SOLID );
653 : : }
654 : :
655 [ + - ]: 184807 : aInfo.SetWidth( ImplLogicWidthToDevicePixel( aInfo.GetWidth() ) );
656 : :
657 : 184807 : return aInfo;
658 : : }
659 : :
660 : : // -----------------------------------------------------------------------
661 : :
662 : 80227 : Rectangle OutputDevice::ImplDevicePixelToLogic( const Rectangle& rPixelRect ) const
663 : : {
664 [ - + ]: 80227 : if ( rPixelRect.IsEmpty() )
665 : 0 : return rPixelRect;
666 : :
667 [ + + ]: 80227 : if ( !mbMap )
668 : : {
669 : 69892 : return Rectangle( rPixelRect.Left()-mnOutOffX, rPixelRect.Top()-mnOutOffY,
670 : 139784 : rPixelRect.Right()-mnOutOffX, rPixelRect.Bottom()-mnOutOffY );
671 : : }
672 : :
673 : 10335 : return Rectangle( ImplPixelToLogic( rPixelRect.Left()-mnOutOffX-mnOutOffOrigX, mnDPIX,
674 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
675 : 10335 : maThresRes.mnThresPixToLogX )-maMapRes.mnMapOfsX,
676 : 10335 : ImplPixelToLogic( rPixelRect.Top()-mnOutOffY-mnOutOffOrigY, mnDPIY,
677 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
678 : 10335 : maThresRes.mnThresPixToLogY )-maMapRes.mnMapOfsY,
679 : 10335 : ImplPixelToLogic( rPixelRect.Right()-mnOutOffX-mnOutOffOrigX, mnDPIX,
680 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
681 : 10335 : maThresRes.mnThresPixToLogX )-maMapRes.mnMapOfsX,
682 : 10335 : ImplPixelToLogic( rPixelRect.Bottom()-mnOutOffY-mnOutOffOrigY, mnDPIY,
683 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
684 : 90562 : maThresRes.mnThresPixToLogY )-maMapRes.mnMapOfsY );
685 : : }
686 : :
687 : : // -----------------------------------------------------------------------
688 : :
689 : 342211 : Region OutputDevice::ImplPixelToDevicePixel( const Region& rRegion ) const
690 : : {
691 : : DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
692 : :
693 [ + + ][ + + ]: 342211 : if ( !mnOutOffX && !mnOutOffY )
694 [ + - ]: 43155 : return rRegion;
695 : :
696 [ + - ]: 299056 : Region aRegion( rRegion );
697 [ + - ]: 299056 : aRegion.Move( mnOutOffX+mnOutOffOrigX, mnOutOffY+mnOutOffOrigY );
698 [ + - ][ + - ]: 342211 : return aRegion;
699 : : }
700 : :
701 : : // -----------------------------------------------------------------------
702 : :
703 : 860225 : void OutputDevice::EnableMapMode( sal_Bool bEnable )
704 : : {
705 : 860225 : mbMap = (bEnable != 0);
706 : :
707 [ + + ]: 860225 : if( mpAlphaVDev )
708 : 10460 : mpAlphaVDev->EnableMapMode( bEnable );
709 : 860225 : }
710 : :
711 : : // -----------------------------------------------------------------------
712 : :
713 : 155578 : void OutputDevice::SetMapMode()
714 : : {
715 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
716 : :
717 [ - + ]: 155578 : if ( mpMetaFile )
718 [ # # ][ # # ]: 0 : mpMetaFile->AddAction( new MetaMapModeAction( MapMode() ) );
[ # # ]
719 : :
720 [ + + ][ - + ]: 155578 : if ( mbMap || !maMapMode.IsDefault() )
[ + + ]
721 : : {
722 : 82463 : mbMap = sal_False;
723 [ + - ]: 82463 : maMapMode = MapMode();
724 : :
725 : : // create new objects (clip region werden nicht neu skaliert)
726 : 82463 : mbNewFont = sal_True;
727 : 82463 : mbInitFont = sal_True;
728 [ + + ]: 82463 : if ( GetOutDevType() == OUTDEV_WINDOW )
729 : : {
730 [ + + ]: 36113 : if ( ((Window*)this)->mpWindowImpl->mpCursor )
731 : 35543 : ((Window*)this)->mpWindowImpl->mpCursor->ImplNew();
732 : : }
733 : :
734 : : // #106426# Adapt logical offset when changing mapmode
735 : 82463 : mnOutOffLogicX = mnOutOffOrigX; // no mapping -> equal offsets
736 : 82463 : mnOutOffLogicY = mnOutOffOrigY;
737 : :
738 : : // #i75163#
739 : 82463 : ImplInvalidateViewTransform();
740 : : }
741 : :
742 [ + + ]: 155578 : if( mpAlphaVDev )
743 : 11188 : mpAlphaVDev->SetMapMode();
744 : 155578 : }
745 : :
746 : : // -----------------------------------------------------------------------
747 : :
748 : 283347 : void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
749 : : {
750 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
751 : :
752 : 283347 : sal_Bool bRelMap = (rNewMapMode.GetMapUnit() == MAP_RELATIVE);
753 : :
754 [ + + ]: 283347 : if ( mpMetaFile )
755 : : {
756 [ + - ]: 422 : mpMetaFile->AddAction( new MetaMapModeAction( rNewMapMode ) );
757 : : #ifdef DBG_UTIL
758 : : if ( GetOutDevType() != OUTDEV_PRINTER )
759 : : DBG_ASSERTWARNING( bRelMap, "Please record only relative MapModes!" );
760 : : #endif
761 : : }
762 : :
763 : : // Ist der MapMode der gleiche wie vorher, dann mache nichts
764 [ + + ]: 283347 : if ( maMapMode == rNewMapMode )
765 : 140054 : return;
766 : :
767 [ + + ]: 143293 : if( mpAlphaVDev )
768 : 382 : mpAlphaVDev->SetMapMode( rNewMapMode );
769 : :
770 : : // Ist Default-MapMode, dann bereche nichts
771 : 143293 : sal_Bool bOldMap = mbMap;
772 : 143293 : mbMap = !rNewMapMode.IsDefault();
773 [ + + ]: 143293 : if ( mbMap )
774 : : {
775 : : // Falls nur der Orign umgesetzt wird, dann scaliere nichts neu
776 [ + + + + : 153909 : if ( (rNewMapMode.GetMapUnit() == maMapMode.GetMapUnit()) &&
+ + ][ + + ]
[ + + ]
777 : 9511 : (rNewMapMode.GetScaleX() == maMapMode.GetScaleX()) &&
778 : 8425 : (rNewMapMode.GetScaleY() == maMapMode.GetScaleY()) &&
779 : : (bOldMap == mbMap) )
780 : : {
781 : : // Offset setzen
782 : 2806 : Point aOrigin = rNewMapMode.GetOrigin();
783 : 2806 : maMapRes.mnMapOfsX = aOrigin.X();
784 : 2806 : maMapRes.mnMapOfsY = aOrigin.Y();
785 [ + - ]: 2806 : maMapMode = rNewMapMode;
786 : :
787 : : // #i75163#
788 [ + - ]: 2806 : ImplInvalidateViewTransform();
789 : :
790 : : return;
791 : : }
792 [ + + ][ - + ]: 133167 : if ( !bOldMap && bRelMap )
793 : : {
794 : 0 : maMapRes.mnMapScNumX = 1;
795 : 0 : maMapRes.mnMapScNumY = 1;
796 : 0 : maMapRes.mnMapScDenomX = mnDPIX;
797 : 0 : maMapRes.mnMapScDenomY = mnDPIY;
798 : 0 : maMapRes.mnMapOfsX = 0;
799 : 0 : maMapRes.mnMapOfsY = 0;
800 : : }
801 : :
802 : : // Neue MapMode-Aufloesung berechnen
803 : 133167 : ImplCalcMapResolution( rNewMapMode, mnDPIX, mnDPIY, maMapRes, maThresRes );
804 : : }
805 : :
806 : : // Neuen MapMode setzen
807 [ + + ]: 140487 : if ( bRelMap )
808 : : {
809 : 59 : Point aOrigin( maMapRes.mnMapOfsX, maMapRes.mnMapOfsY );
810 : : // aScale? = maMapMode.GetScale?() * rNewMapMode.GetScale?()
811 : 59 : Fraction aScaleX = ImplMakeFraction( maMapMode.GetScaleX().GetNumerator(),
812 : 59 : rNewMapMode.GetScaleX().GetNumerator(),
813 : 59 : maMapMode.GetScaleX().GetDenominator(),
814 [ + - ]: 236 : rNewMapMode.GetScaleX().GetDenominator() );
815 : 59 : Fraction aScaleY = ImplMakeFraction( maMapMode.GetScaleY().GetNumerator(),
816 : 59 : rNewMapMode.GetScaleY().GetNumerator(),
817 : 59 : maMapMode.GetScaleY().GetDenominator(),
818 [ + - ]: 236 : rNewMapMode.GetScaleY().GetDenominator() );
819 [ + - ]: 59 : maMapMode.SetOrigin( aOrigin );
820 [ + - ]: 59 : maMapMode.SetScaleX( aScaleX );
821 [ + - ]: 59 : maMapMode.SetScaleY( aScaleY );
822 : : }
823 : : else
824 : 140428 : maMapMode = rNewMapMode;
825 : :
826 : : // create new objects (clip region werden nicht neu skaliert)
827 : 140487 : mbNewFont = sal_True;
828 : 140487 : mbInitFont = sal_True;
829 [ + + ]: 140487 : if ( GetOutDevType() == OUTDEV_WINDOW )
830 : : {
831 [ + + ]: 39991 : if ( ((Window*)this)->mpWindowImpl->mpCursor )
832 : 35647 : ((Window*)this)->mpWindowImpl->mpCursor->ImplNew();
833 : : }
834 : :
835 : : // #106426# Adapt logical offset when changing mapmode
836 : : mnOutOffLogicX = ImplPixelToLogic( mnOutOffOrigX, mnDPIX,
837 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
838 : 140487 : maThresRes.mnThresPixToLogX );
839 : : mnOutOffLogicY = ImplPixelToLogic( mnOutOffOrigY, mnDPIY,
840 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
841 : 140487 : maThresRes.mnThresPixToLogY );
842 : :
843 : : // #i75163#
844 : 283347 : ImplInvalidateViewTransform();
845 : : }
846 : :
847 : : // -----------------------------------------------------------------------
848 : :
849 : 6937 : void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode )
850 : : {
851 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
852 : :
853 : : // Ist der MapMode der gleiche wie vorher, dann mache nichts
854 [ + - ][ + + ]: 6937 : if ( maMapMode == rNewMapMode )
855 : 6937 : return;
856 : :
857 : 19 : MapUnit eOld = maMapMode.GetMapUnit();
858 : 19 : MapUnit eNew = rNewMapMode.GetMapUnit();
859 : :
860 : : // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
861 : 19 : Fraction aXF = ImplMakeFraction( rNewMapMode.GetScaleX().GetNumerator(),
862 : 19 : maMapMode.GetScaleX().GetDenominator(),
863 : 19 : rNewMapMode.GetScaleX().GetDenominator(),
864 [ + - ]: 76 : maMapMode.GetScaleX().GetNumerator() );
865 : 19 : Fraction aYF = ImplMakeFraction( rNewMapMode.GetScaleY().GetNumerator(),
866 : 19 : maMapMode.GetScaleY().GetDenominator(),
867 : 19 : rNewMapMode.GetScaleY().GetDenominator(),
868 [ + - ]: 76 : maMapMode.GetScaleY().GetNumerator() );
869 : :
870 [ + - ]: 19 : Point aPt( LogicToLogic( Point(), NULL, &rNewMapMode ) );
871 [ - + ]: 19 : if ( eNew != eOld )
872 : : {
873 [ # # ]: 0 : if ( eOld > MAP_PIXEL )
874 : : {
875 : : SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
876 : : }
877 [ # # ]: 0 : else if ( eNew > MAP_PIXEL )
878 : : {
879 : : SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
880 : : }
881 : : else
882 : : {
883 : 0 : Fraction aF( aImplNumeratorAry[eNew] * aImplDenominatorAry[eOld],
884 [ # # ]: 0 : aImplNumeratorAry[eOld] * aImplDenominatorAry[eNew] );
885 : :
886 : : // a?F = a?F * aF
887 : : aXF = ImplMakeFraction( aXF.GetNumerator(), aF.GetNumerator(),
888 [ # # ][ # # ]: 0 : aXF.GetDenominator(), aF.GetDenominator() );
889 : : aYF = ImplMakeFraction( aYF.GetNumerator(), aF.GetNumerator(),
890 [ # # ][ # # ]: 0 : aYF.GetDenominator(), aF.GetDenominator() );
891 [ # # ]: 0 : if ( eOld == MAP_PIXEL )
892 : : {
893 [ # # ][ # # ]: 0 : aXF *= Fraction( mnDPIX, 1 );
894 [ # # ][ # # ]: 0 : aYF *= Fraction( mnDPIY, 1 );
895 : : }
896 [ # # ]: 0 : else if ( eNew == MAP_PIXEL )
897 : : {
898 [ # # ][ # # ]: 0 : aXF *= Fraction( 1, mnDPIX );
899 [ # # ][ # # ]: 0 : aYF *= Fraction( 1, mnDPIY );
900 : : }
901 : : }
902 : : }
903 : :
904 [ + - ]: 19 : MapMode aNewMapMode( MAP_RELATIVE, Point( -aPt.X(), -aPt.Y() ), aXF, aYF );
905 [ + - ]: 19 : SetMapMode( aNewMapMode );
906 : :
907 [ - + ]: 19 : if ( eNew != eOld )
908 [ # # ]: 0 : maMapMode = rNewMapMode;
909 : :
910 : : // #106426# Adapt logical offset when changing mapmode
911 : : mnOutOffLogicX = ImplPixelToLogic( mnOutOffOrigX, mnDPIX,
912 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
913 : 19 : maThresRes.mnThresPixToLogX );
914 : : mnOutOffLogicY = ImplPixelToLogic( mnOutOffOrigY, mnDPIY,
915 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
916 : 19 : maThresRes.mnThresPixToLogY );
917 : :
918 [ - + ]: 19 : if( mpAlphaVDev )
919 [ # # ][ + - ]: 6937 : mpAlphaVDev->SetRelativeMapMode( rNewMapMode );
920 : : }
921 : :
922 : : // -----------------------------------------------------------------------
923 : :
924 : : // #i75163#
925 : 208409 : basegfx::B2DHomMatrix OutputDevice::GetViewTransformation() const
926 : : {
927 [ + + ]: 208409 : if(mbMap)
928 : : {
929 : : // #i82615#
930 [ + + ]: 204119 : if(!mpOutDevData)
931 : : {
932 : 1781 : const_cast< OutputDevice* >(this)->ImplInitOutDevData();
933 : : }
934 : :
935 [ + + ]: 204119 : if(!mpOutDevData->mpViewTransform)
936 : : {
937 [ + - ]: 49064 : mpOutDevData->mpViewTransform = new basegfx::B2DHomMatrix;
938 : :
939 : 49064 : const double fScaleFactorX((double)mnDPIX * (double)maMapRes.mnMapScNumX / (double)maMapRes.mnMapScDenomX);
940 : 49064 : const double fScaleFactorY((double)mnDPIY * (double)maMapRes.mnMapScNumY / (double)maMapRes.mnMapScDenomY);
941 : 49064 : const double fZeroPointX(((double)maMapRes.mnMapOfsX * fScaleFactorX) + (double)mnOutOffOrigX);
942 : 49064 : const double fZeroPointY(((double)maMapRes.mnMapOfsY * fScaleFactorY) + (double)mnOutOffOrigY);
943 : :
944 : 49064 : mpOutDevData->mpViewTransform->set(0, 0, fScaleFactorX);
945 : 49064 : mpOutDevData->mpViewTransform->set(1, 1, fScaleFactorY);
946 : 49064 : mpOutDevData->mpViewTransform->set(0, 2, fZeroPointX);
947 : 49064 : mpOutDevData->mpViewTransform->set(1, 2, fZeroPointY);
948 : : }
949 : :
950 : 204119 : return *mpOutDevData->mpViewTransform;
951 : : }
952 : : else
953 : : {
954 : 208409 : return basegfx::B2DHomMatrix();
955 : : }
956 : : }
957 : :
958 : : // -----------------------------------------------------------------------
959 : :
960 : : // #i75163#
961 : 51564 : basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation() const
962 : : {
963 [ + - ]: 51564 : if(mbMap)
964 : : {
965 : : // #i82615#
966 [ + + ]: 51564 : if(!mpOutDevData)
967 : : {
968 : 1862 : const_cast< OutputDevice* >(this)->ImplInitOutDevData();
969 : : }
970 : :
971 [ + + ]: 51564 : if(!mpOutDevData->mpInverseViewTransform)
972 : : {
973 : 25744 : GetViewTransformation();
974 [ + - ]: 25744 : mpOutDevData->mpInverseViewTransform = new basegfx::B2DHomMatrix(*mpOutDevData->mpViewTransform);
975 : 25744 : mpOutDevData->mpInverseViewTransform->invert();
976 : : }
977 : :
978 : 51564 : return *mpOutDevData->mpInverseViewTransform;
979 : : }
980 : : else
981 : : {
982 : 51564 : return basegfx::B2DHomMatrix();
983 : : }
984 : : }
985 : :
986 : : // -----------------------------------------------------------------------
987 : :
988 : : // #i75163#
989 : 0 : basegfx::B2DHomMatrix OutputDevice::GetViewTransformation( const MapMode& rMapMode ) const
990 : : {
991 : : // #i82615#
992 : : ImplMapRes aMapRes;
993 : : ImplThresholdRes aThresRes;
994 [ # # ]: 0 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
995 : :
996 [ # # ]: 0 : basegfx::B2DHomMatrix aTransform;
997 : :
998 : 0 : const double fScaleFactorX((double)mnDPIX * (double)aMapRes.mnMapScNumX / (double)aMapRes.mnMapScDenomX);
999 : 0 : const double fScaleFactorY((double)mnDPIY * (double)aMapRes.mnMapScNumY / (double)aMapRes.mnMapScDenomY);
1000 : 0 : const double fZeroPointX(((double)aMapRes.mnMapOfsX * fScaleFactorX) + (double)mnOutOffOrigX);
1001 : 0 : const double fZeroPointY(((double)aMapRes.mnMapOfsY * fScaleFactorY) + (double)mnOutOffOrigY);
1002 : :
1003 [ # # ]: 0 : aTransform.set(0, 0, fScaleFactorX);
1004 [ # # ]: 0 : aTransform.set(1, 1, fScaleFactorY);
1005 [ # # ]: 0 : aTransform.set(0, 2, fZeroPointX);
1006 [ # # ]: 0 : aTransform.set(1, 2, fZeroPointY);
1007 : :
1008 : 0 : return aTransform;
1009 : : }
1010 : :
1011 : : // -----------------------------------------------------------------------
1012 : :
1013 : : // #i75163#
1014 : 0 : basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation( const MapMode& rMapMode ) const
1015 : : {
1016 : 0 : basegfx::B2DHomMatrix aMatrix( GetViewTransformation( rMapMode ) );
1017 [ # # ]: 0 : aMatrix.invert();
1018 : 0 : return aMatrix;
1019 : : }
1020 : :
1021 : : // -----------------------------------------------------------------------
1022 : :
1023 : 0 : basegfx::B2DHomMatrix OutputDevice::ImplGetDeviceTransformation() const
1024 : : {
1025 : 0 : basegfx::B2DHomMatrix aTransformation = GetViewTransformation();
1026 : : // TODO: is it worth to cache the transformed result?
1027 [ # # ][ # # ]: 0 : if( mnOutOffX || mnOutOffY )
1028 [ # # ]: 0 : aTransformation.translate( mnOutOffX, mnOutOffY );
1029 : 0 : return aTransformation;
1030 : : }
1031 : :
1032 : : // -----------------------------------------------------------------------
1033 : :
1034 : 431940 : Point OutputDevice::LogicToPixel( const Point& rLogicPt ) const
1035 : : {
1036 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1037 : :
1038 [ + + ]: 431940 : if ( !mbMap )
1039 : 201897 : return rLogicPt;
1040 : :
1041 : 230043 : return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
1042 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1043 : 230043 : maThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1044 : 230043 : ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
1045 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1046 : 661983 : maThresRes.mnThresLogToPixY )+mnOutOffOrigY );
1047 : : }
1048 : :
1049 : : // -----------------------------------------------------------------------
1050 : :
1051 : 491630 : Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const
1052 : : {
1053 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1054 : :
1055 [ + + ]: 491630 : if ( !mbMap )
1056 : 259512 : return rLogicSize;
1057 : :
1058 : : return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
1059 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1060 : : maThresRes.mnThresLogToPixX ),
1061 : : ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
1062 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1063 : 491630 : maThresRes.mnThresLogToPixY ) );
1064 : : }
1065 : :
1066 : : // -----------------------------------------------------------------------
1067 : :
1068 : 890225 : Rectangle OutputDevice::LogicToPixel( const Rectangle& rLogicRect ) const
1069 : : {
1070 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1071 : :
1072 [ + + ][ + + ]: 890225 : if ( !mbMap || rLogicRect.IsEmpty() )
[ + + ]
1073 : 436837 : return rLogicRect;
1074 : :
1075 : 453388 : return Rectangle( ImplLogicToPixel( rLogicRect.Left() + maMapRes.mnMapOfsX, mnDPIX,
1076 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1077 : 453388 : maThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1078 : 453388 : ImplLogicToPixel( rLogicRect.Top() + maMapRes.mnMapOfsY, mnDPIY,
1079 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1080 : 453388 : maThresRes.mnThresLogToPixY )+mnOutOffOrigY,
1081 : 453388 : ImplLogicToPixel( rLogicRect.Right() + maMapRes.mnMapOfsX, mnDPIX,
1082 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1083 : 453388 : maThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1084 : 453388 : ImplLogicToPixel( rLogicRect.Bottom() + maMapRes.mnMapOfsY, mnDPIY,
1085 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1086 : 1343613 : maThresRes.mnThresLogToPixY )+mnOutOffOrigY );
1087 : : }
1088 : :
1089 : : // -----------------------------------------------------------------------
1090 : :
1091 : 638 : Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly ) const
1092 : : {
1093 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1094 : : DBG_CHKOBJ( &rLogicPoly, Polygon, NULL );
1095 : :
1096 [ - + ]: 638 : if ( !mbMap )
1097 [ # # ]: 0 : return rLogicPoly;
1098 : :
1099 : : sal_uInt16 i;
1100 [ + - ]: 638 : sal_uInt16 nPoints = rLogicPoly.GetSize();
1101 [ + - ]: 638 : Polygon aPoly( rLogicPoly );
1102 : :
1103 : : // Pointer auf das Point-Array holen (Daten werden kopiert)
1104 [ + - ]: 638 : const Point* pPointAry = aPoly.GetConstPointAry();
1105 : :
1106 [ + + ]: 3828 : for ( i = 0; i < nPoints; i++ )
1107 : : {
1108 : 3190 : const Point* pPt = &(pPointAry[i]);
1109 : 3190 : Point aPt;
1110 : 3190 : aPt.X() = ImplLogicToPixel( pPt->X() + maMapRes.mnMapOfsX, mnDPIX,
1111 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1112 : 3190 : maThresRes.mnThresLogToPixX )+mnOutOffOrigX;
1113 : 3190 : aPt.Y() = ImplLogicToPixel( pPt->Y() + maMapRes.mnMapOfsY, mnDPIY,
1114 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1115 : 3190 : maThresRes.mnThresLogToPixY )+mnOutOffOrigY;
1116 [ + - ]: 3190 : aPoly[i] = aPt;
1117 : : }
1118 : :
1119 [ + - ][ + - ]: 638 : return aPoly;
1120 : : }
1121 : :
1122 : : // -----------------------------------------------------------------------
1123 : :
1124 : 4811 : PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const
1125 : : {
1126 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1127 : : DBG_CHKOBJ( &rLogicPolyPoly, PolyPolygon, NULL );
1128 : :
1129 [ + + ]: 4811 : if ( !mbMap )
1130 [ + - ]: 4184 : return rLogicPolyPoly;
1131 : :
1132 [ + - ]: 627 : PolyPolygon aPolyPoly( rLogicPolyPoly );
1133 [ + - ]: 627 : sal_uInt16 nPoly = aPolyPoly.Count();
1134 [ + + ]: 1265 : for( sal_uInt16 i = 0; i < nPoly; i++ )
1135 : : {
1136 [ + - ]: 638 : Polygon& rPoly = aPolyPoly[i];
1137 [ + - ][ + - ]: 638 : rPoly = LogicToPixel( rPoly );
[ + - ]
1138 : : }
1139 [ + - ][ + - ]: 4811 : return aPolyPoly;
1140 : : }
1141 : :
1142 : : // -----------------------------------------------------------------------
1143 : :
1144 : 283710 : Region OutputDevice::LogicToPixel( const Region& rLogicRegion ) const
1145 : : {
1146 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1147 : : DBG_CHKOBJ( &rLogicRegion, Region, ImplDbgTestRegion );
1148 : :
1149 [ + - ]: 283710 : RegionType eType = rLogicRegion.GetType();
1150 : :
1151 [ + + ][ + - ]: 283710 : if ( !mbMap || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
[ - + ]
1152 [ + - ]: 195619 : return rLogicRegion;
1153 : :
1154 [ + - ]: 88091 : Region aRegion;
1155 : 88091 : const ImplRegion& rImplRegion = *rLogicRegion.ImplGetImplRegion();
1156 : 88091 : const PolyPolygon* pPolyPoly = rImplRegion.mpPolyPoly;
1157 : 88091 : const basegfx::B2DPolyPolygon* pB2DPolyPoly = rImplRegion.mpB2DPolyPoly;
1158 : :
1159 [ + + ]: 88091 : if ( pPolyPoly )
1160 [ + - ][ + - ]: 11 : aRegion = Region( LogicToPixel( *pPolyPoly ) );
[ + - ][ + - ]
[ + - ]
1161 [ - + ]: 88080 : else if( pB2DPolyPoly )
1162 : : {
1163 [ # # ]: 0 : basegfx::B2DPolyPolygon aTransformedPoly = *pB2DPolyPoly;
1164 [ # # ]: 0 : const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation();
1165 [ # # ]: 0 : aTransformedPoly.transform( rTransformationMatrix );
1166 [ # # ][ # # ]: 0 : aRegion = Region( aTransformedPoly );
[ # # ][ # # ]
[ # # ]
1167 : : }
1168 : : else
1169 : : {
1170 : : long nX;
1171 : : long nY;
1172 : : long nWidth;
1173 : : long nHeight;
1174 : : ImplRegionInfo aInfo;
1175 : : sal_Bool bRegionRect;
1176 : :
1177 [ + - ]: 88080 : aRegion.ImplBeginAddRect();
1178 [ + - ]: 88080 : bRegionRect = rLogicRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
1179 [ + + ]: 178674 : while ( bRegionRect )
1180 : : {
1181 [ + - ]: 90594 : Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
1182 [ + - ][ + - ]: 90594 : aRegion.ImplAddRect( LogicToPixel( aRect ) );
1183 [ + - ]: 90594 : bRegionRect = rLogicRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
1184 : : }
1185 [ + - ]: 88080 : aRegion.ImplEndAddRect();
1186 : : }
1187 : :
1188 [ + - ][ + - ]: 283710 : return aRegion;
1189 : : }
1190 : :
1191 : : // -----------------------------------------------------------------------
1192 : :
1193 : 5092 : Point OutputDevice::LogicToPixel( const Point& rLogicPt,
1194 : : const MapMode& rMapMode ) const
1195 : : {
1196 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1197 : :
1198 [ + - ][ + + ]: 5092 : if ( rMapMode.IsDefault() )
1199 : 24 : return rLogicPt;
1200 : :
1201 : : // MapMode-Aufloesung berechnen und Umrechnen
1202 : : ImplMapRes aMapRes;
1203 : : ImplThresholdRes aThresRes;
1204 [ + - ]: 5068 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1205 : :
1206 : 5068 : return Point( ImplLogicToPixel( rLogicPt.X() + aMapRes.mnMapOfsX, mnDPIX,
1207 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1208 : 5068 : aThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1209 : 5068 : ImplLogicToPixel( rLogicPt.Y() + aMapRes.mnMapOfsY, mnDPIY,
1210 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1211 : 10160 : aThresRes.mnThresLogToPixY )+mnOutOffOrigY );
1212 : : }
1213 : :
1214 : : // -----------------------------------------------------------------------
1215 : :
1216 : 451587 : Size OutputDevice::LogicToPixel( const Size& rLogicSize,
1217 : : const MapMode& rMapMode ) const
1218 : : {
1219 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1220 : :
1221 [ + - ][ - + ]: 451587 : if ( rMapMode.IsDefault() )
1222 : 0 : return rLogicSize;
1223 : :
1224 : : // MapMode-Aufloesung berechnen und Umrechnen
1225 : : ImplMapRes aMapRes;
1226 : : ImplThresholdRes aThresRes;
1227 [ + - ]: 451587 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1228 : :
1229 : : return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
1230 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1231 : : aThresRes.mnThresLogToPixX ),
1232 : : ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
1233 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1234 : 451587 : aThresRes.mnThresLogToPixY ) );
1235 : : }
1236 : :
1237 : : // -----------------------------------------------------------------------
1238 : :
1239 : 5946 : Rectangle OutputDevice::LogicToPixel( const Rectangle& rLogicRect,
1240 : : const MapMode& rMapMode ) const
1241 : : {
1242 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1243 : :
1244 [ + - ][ + + ]: 5946 : if ( rMapMode.IsDefault() || rLogicRect.IsEmpty() )
[ + - ][ - + ]
[ + + ]
1245 : 8 : return rLogicRect;
1246 : :
1247 : : // MapMode-Aufloesung berechnen und Umrechnen
1248 : : ImplMapRes aMapRes;
1249 : : ImplThresholdRes aThresRes;
1250 [ + - ]: 5938 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1251 : :
1252 : 5938 : return Rectangle( ImplLogicToPixel( rLogicRect.Left() + aMapRes.mnMapOfsX, mnDPIX,
1253 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1254 : 5938 : aThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1255 : 5938 : ImplLogicToPixel( rLogicRect.Top() + aMapRes.mnMapOfsY, mnDPIY,
1256 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1257 : 5938 : aThresRes.mnThresLogToPixY )+mnOutOffOrigY,
1258 : 5938 : ImplLogicToPixel( rLogicRect.Right() + aMapRes.mnMapOfsX, mnDPIX,
1259 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1260 : 5938 : aThresRes.mnThresLogToPixX )+mnOutOffOrigX,
1261 : 5938 : ImplLogicToPixel( rLogicRect.Bottom() + aMapRes.mnMapOfsY, mnDPIY,
1262 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1263 [ + - ]: 11884 : aThresRes.mnThresLogToPixY )+mnOutOffOrigY );
1264 : : }
1265 : :
1266 : : // -----------------------------------------------------------------------
1267 : :
1268 : 0 : Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly,
1269 : : const MapMode& rMapMode ) const
1270 : : {
1271 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1272 : : DBG_CHKOBJ( &rLogicPoly, Polygon, NULL );
1273 : :
1274 [ # # ][ # # ]: 0 : if ( rMapMode.IsDefault() )
1275 [ # # ]: 0 : return rLogicPoly;
1276 : :
1277 : : // MapMode-Aufloesung berechnen und Umrechnen
1278 : : ImplMapRes aMapRes;
1279 : : ImplThresholdRes aThresRes;
1280 [ # # ]: 0 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1281 : :
1282 : : sal_uInt16 i;
1283 [ # # ]: 0 : sal_uInt16 nPoints = rLogicPoly.GetSize();
1284 [ # # ]: 0 : Polygon aPoly( rLogicPoly );
1285 : :
1286 : : // Pointer auf das Point-Array holen (Daten werden kopiert)
1287 [ # # ]: 0 : const Point* pPointAry = aPoly.GetConstPointAry();
1288 : :
1289 [ # # ]: 0 : for ( i = 0; i < nPoints; i++ )
1290 : : {
1291 : 0 : const Point* pPt = &(pPointAry[i]);
1292 : 0 : Point aPt;
1293 : 0 : aPt.X() = ImplLogicToPixel( pPt->X() + aMapRes.mnMapOfsX, mnDPIX,
1294 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1295 : 0 : aThresRes.mnThresLogToPixX )+mnOutOffOrigX;
1296 : 0 : aPt.Y() = ImplLogicToPixel( pPt->Y() + aMapRes.mnMapOfsY, mnDPIY,
1297 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1298 : 0 : aThresRes.mnThresLogToPixY )+mnOutOffOrigY;
1299 [ # # ]: 0 : aPoly[i] = aPt;
1300 : : }
1301 : :
1302 [ # # ][ # # ]: 0 : return aPoly;
1303 : : }
1304 : :
1305 : : // -----------------------------------------------------------------------
1306 : :
1307 : 0 : basegfx::B2DPolyPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1308 : : const MapMode& rMapMode ) const
1309 : : {
1310 : 0 : basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly;
1311 [ # # ]: 0 : const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation( rMapMode );
1312 [ # # ]: 0 : aTransformedPoly.transform( rTransformationMatrix );
1313 [ # # ]: 0 : return aTransformedPoly;
1314 : : }
1315 : :
1316 : : // -----------------------------------------------------------------------
1317 : :
1318 : 234732 : Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const
1319 : : {
1320 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1321 : :
1322 [ + + ]: 234732 : if ( !mbMap )
1323 : 32822 : return rDevicePt;
1324 : :
1325 : : return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1326 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1327 : 201910 : maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX - mnOutOffLogicX,
1328 : : ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1329 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1330 : 436642 : maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY - mnOutOffLogicY );
1331 : : }
1332 : :
1333 : : // -----------------------------------------------------------------------
1334 : :
1335 : 1248127 : Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const
1336 : : {
1337 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1338 : :
1339 [ + + ]: 1248127 : if ( !mbMap )
1340 : 439940 : return rDeviceSize;
1341 : :
1342 : : return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1343 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1344 : : maThresRes.mnThresPixToLogX ),
1345 : : ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1346 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1347 : 1248127 : maThresRes.mnThresPixToLogY ) );
1348 : : }
1349 : :
1350 : : // -----------------------------------------------------------------------
1351 : :
1352 : 585965 : Rectangle OutputDevice::PixelToLogic( const Rectangle& rDeviceRect ) const
1353 : : {
1354 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1355 : :
1356 [ + + ][ + + ]: 585965 : if ( !mbMap || rDeviceRect.IsEmpty() )
[ + + ]
1357 : 115075 : return rDeviceRect;
1358 : :
1359 : : return Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
1360 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1361 : 470890 : maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX - mnOutOffLogicX,
1362 : : ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
1363 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1364 : 470890 : maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY - mnOutOffLogicY,
1365 : : ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
1366 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1367 : 470890 : maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX - mnOutOffLogicX,
1368 : : ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
1369 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1370 : 1056855 : maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY - mnOutOffLogicY );
1371 : : }
1372 : :
1373 : : // -----------------------------------------------------------------------
1374 : :
1375 : 0 : Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly ) const
1376 : : {
1377 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1378 : : DBG_CHKOBJ( &rDevicePoly, Polygon, NULL );
1379 : :
1380 [ # # ]: 0 : if ( !mbMap )
1381 [ # # ]: 0 : return rDevicePoly;
1382 : :
1383 : : sal_uInt16 i;
1384 [ # # ]: 0 : sal_uInt16 nPoints = rDevicePoly.GetSize();
1385 [ # # ]: 0 : Polygon aPoly( rDevicePoly );
1386 : :
1387 : : // Pointer auf das Point-Array holen (Daten werden kopiert)
1388 [ # # ]: 0 : const Point* pPointAry = aPoly.GetConstPointAry();
1389 : :
1390 [ # # ]: 0 : for ( i = 0; i < nPoints; i++ )
1391 : : {
1392 : 0 : const Point* pPt = &(pPointAry[i]);
1393 : 0 : Point aPt;
1394 : 0 : aPt.X() = ImplPixelToLogic( pPt->X(), mnDPIX,
1395 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
1396 : 0 : maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX - mnOutOffLogicX;
1397 : 0 : aPt.Y() = ImplPixelToLogic( pPt->Y(), mnDPIY,
1398 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
1399 : 0 : maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY - mnOutOffLogicY;
1400 [ # # ]: 0 : aPoly[i] = aPt;
1401 : : }
1402 : :
1403 [ # # ][ # # ]: 0 : return aPoly;
1404 : : }
1405 : :
1406 : : // -----------------------------------------------------------------------
1407 : :
1408 : 0 : PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const
1409 : : {
1410 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1411 : : DBG_CHKOBJ( &rDevicePolyPoly, PolyPolygon, NULL );
1412 : :
1413 [ # # ]: 0 : if ( !mbMap )
1414 [ # # ]: 0 : return rDevicePolyPoly;
1415 : :
1416 [ # # ]: 0 : PolyPolygon aPolyPoly( rDevicePolyPoly );
1417 [ # # ]: 0 : sal_uInt16 nPoly = aPolyPoly.Count();
1418 [ # # ]: 0 : for( sal_uInt16 i = 0; i < nPoly; i++ )
1419 : : {
1420 [ # # ]: 0 : Polygon& rPoly = aPolyPoly[i];
1421 [ # # ][ # # ]: 0 : rPoly = PixelToLogic( rPoly );
[ # # ]
1422 : : }
1423 [ # # ][ # # ]: 0 : return aPolyPoly;
1424 : : }
1425 : :
1426 : : // -----------------------------------------------------------------------
1427 : :
1428 : 314553 : Region OutputDevice::PixelToLogic( const Region& rDeviceRegion ) const
1429 : : {
1430 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1431 : : DBG_CHKOBJ( &rDeviceRegion, Region, ImplDbgTestRegion );
1432 : :
1433 [ + - ]: 314553 : RegionType eType = rDeviceRegion.GetType();
1434 : :
1435 [ + + ][ + - ]: 314553 : if ( !mbMap || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
[ + + ]
1436 [ + - ]: 265636 : return rDeviceRegion;
1437 : :
1438 [ + - ]: 48917 : Region aRegion;
1439 : 48917 : PolyPolygon* pPolyPoly = rDeviceRegion.ImplGetImplRegion()->mpPolyPoly;
1440 : :
1441 [ - + ]: 48917 : if ( pPolyPoly )
1442 [ # # ][ # # ]: 0 : aRegion = Region( PixelToLogic( *pPolyPoly ) );
[ # # ][ # # ]
[ # # ]
1443 : : else
1444 : : {
1445 : : long nX;
1446 : : long nY;
1447 : : long nWidth;
1448 : : long nHeight;
1449 : : ImplRegionInfo aInfo;
1450 : : sal_Bool bRegionRect;
1451 : :
1452 [ + - ]: 48917 : aRegion.ImplBeginAddRect();
1453 [ + - ]: 48917 : bRegionRect = rDeviceRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
1454 [ + + ]: 100312 : while ( bRegionRect )
1455 : : {
1456 [ + - ]: 51395 : Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
1457 [ + - ][ + - ]: 51395 : aRegion.ImplAddRect( PixelToLogic( aRect ) );
1458 [ + - ]: 51395 : bRegionRect = rDeviceRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
1459 : : }
1460 [ + - ]: 48917 : aRegion.ImplEndAddRect();
1461 : : }
1462 : :
1463 [ + - ][ + - ]: 314553 : return aRegion;
1464 : : }
1465 : :
1466 : : // -----------------------------------------------------------------------
1467 : :
1468 : 14914 : Point OutputDevice::PixelToLogic( const Point& rDevicePt,
1469 : : const MapMode& rMapMode ) const
1470 : : {
1471 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1472 : :
1473 : : // Ist Default-MapMode, dann bereche nichts
1474 [ + - ][ + + ]: 14914 : if ( rMapMode.IsDefault() )
1475 : 4 : return rDevicePt;
1476 : :
1477 : : // MapMode-Aufloesung berechnen und Umrechnen
1478 : : ImplMapRes aMapRes;
1479 : : ImplThresholdRes aThresRes;
1480 [ + - ]: 14910 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1481 : :
1482 : : return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1483 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1484 : 14910 : aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1485 : : ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1486 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1487 : 29824 : aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1488 : : }
1489 : :
1490 : : // -----------------------------------------------------------------------
1491 : :
1492 : 10428 : Size OutputDevice::PixelToLogic( const Size& rDeviceSize,
1493 : : const MapMode& rMapMode ) const
1494 : : {
1495 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1496 : :
1497 : : // Ist Default-MapMode, dann bereche nichts
1498 [ + - ][ - + ]: 10428 : if ( rMapMode.IsDefault() )
1499 : 0 : return rDeviceSize;
1500 : :
1501 : : // MapMode-Aufloesung berechnen und Umrechnen
1502 : : ImplMapRes aMapRes;
1503 : : ImplThresholdRes aThresRes;
1504 [ + - ]: 10428 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1505 : :
1506 : : return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1507 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1508 : : aThresRes.mnThresPixToLogX ),
1509 : : ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1510 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1511 : 10428 : aThresRes.mnThresPixToLogY ) );
1512 : : }
1513 : :
1514 : : // -----------------------------------------------------------------------
1515 : :
1516 : 7225 : Rectangle OutputDevice::PixelToLogic( const Rectangle& rDeviceRect,
1517 : : const MapMode& rMapMode ) const
1518 : : {
1519 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1520 : :
1521 : : // Ist Default-MapMode, dann bereche nichts
1522 [ + - ][ + - ]: 7225 : if ( rMapMode.IsDefault() || rDeviceRect.IsEmpty() )
[ + - ][ - + ]
[ - + ]
1523 : 0 : return rDeviceRect;
1524 : :
1525 : : // MapMode-Aufloesung berechnen und Umrechnen
1526 : : ImplMapRes aMapRes;
1527 : : ImplThresholdRes aThresRes;
1528 [ + - ]: 7225 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1529 : :
1530 : : return Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
1531 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1532 : 7225 : aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1533 : : ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
1534 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1535 : 7225 : aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY - mnOutOffLogicY,
1536 : : ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
1537 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1538 : 7225 : aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1539 : : ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
1540 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1541 [ + - ]: 14450 : aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1542 : : }
1543 : :
1544 : : // -----------------------------------------------------------------------
1545 : :
1546 : 0 : Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly,
1547 : : const MapMode& rMapMode ) const
1548 : : {
1549 : : DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
1550 : : DBG_CHKOBJ( &rDevicePoly, Polygon, NULL );
1551 : :
1552 : : // Ist Default-MapMode, dann bereche nichts
1553 [ # # ][ # # ]: 0 : if ( rMapMode.IsDefault() )
1554 [ # # ]: 0 : return rDevicePoly;
1555 : :
1556 : : // MapMode-Aufloesung berechnen und Umrechnen
1557 : : ImplMapRes aMapRes;
1558 : : ImplThresholdRes aThresRes;
1559 [ # # ]: 0 : ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
1560 : :
1561 : : sal_uInt16 i;
1562 [ # # ]: 0 : sal_uInt16 nPoints = rDevicePoly.GetSize();
1563 [ # # ]: 0 : Polygon aPoly( rDevicePoly );
1564 : :
1565 : : // Pointer auf das Point-Array holen (Daten werden kopiert)
1566 [ # # ]: 0 : const Point* pPointAry = aPoly.GetConstPointAry();
1567 : :
1568 [ # # ]: 0 : for ( i = 0; i < nPoints; i++ )
1569 : : {
1570 : 0 : const Point* pPt = &(pPointAry[i]);
1571 : 0 : Point aPt;
1572 : 0 : aPt.X() = ImplPixelToLogic( pPt->X(), mnDPIX,
1573 : : aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
1574 : 0 : aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX - mnOutOffLogicX;
1575 : 0 : aPt.Y() = ImplPixelToLogic( pPt->Y(), mnDPIY,
1576 : : aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
1577 : 0 : aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY - mnOutOffLogicY;
1578 [ # # ]: 0 : aPoly[i] = aPt;
1579 : : }
1580 : :
1581 [ # # ][ # # ]: 0 : return aPoly;
1582 : : }
1583 : :
1584 : : // -----------------------------------------------------------------------
1585 : :
1586 : 0 : basegfx::B2DPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolygon& rPixelPoly,
1587 : : const MapMode& rMapMode ) const
1588 : : {
1589 : 0 : basegfx::B2DPolygon aTransformedPoly = rPixelPoly;
1590 [ # # ]: 0 : const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1591 [ # # ]: 0 : aTransformedPoly.transform( rTransformationMatrix );
1592 [ # # ]: 0 : return aTransformedPoly;
1593 : : }
1594 : :
1595 : : // -----------------------------------------------------------------------
1596 : :
1597 : 0 : basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygon& rPixelPolyPoly,
1598 : : const MapMode& rMapMode ) const
1599 : : {
1600 : 0 : basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly;
1601 [ # # ]: 0 : const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1602 [ # # ]: 0 : aTransformedPoly.transform( rTransformationMatrix );
1603 [ # # ]: 0 : return aTransformedPoly;
1604 : : }
1605 : :
1606 : : // -----------------------------------------------------------------------
1607 : :
1608 : : #define ENTER0( rSource, pMapModeSource, pMapModeDest ) \
1609 : : if ( !pMapModeSource ) \
1610 : : pMapModeSource = &maMapMode; \
1611 : : if ( !pMapModeDest ) \
1612 : : pMapModeDest = &maMapMode; \
1613 : : if ( *pMapModeSource == *pMapModeDest ) \
1614 : : return rSource
1615 : :
1616 : : // -----------------------------------------------------------------------
1617 : :
1618 : : #define ENTER1( rSource, pMapModeSource, pMapModeDest ) \
1619 : : ENTER0( rSource, pMapModeSource, pMapModeDest ); \
1620 : : \
1621 : : ImplMapRes aMapResSource; \
1622 : : ImplMapRes aMapResDest; \
1623 : : \
1624 : : if ( !mbMap || pMapModeSource != &maMapMode ) \
1625 : : { \
1626 : : if ( pMapModeSource->GetMapUnit() == MAP_RELATIVE ) \
1627 : : aMapResSource = maMapRes; \
1628 : : ImplCalcMapResolution( *pMapModeSource, \
1629 : : mnDPIX, mnDPIY, aMapResSource ); \
1630 : : } \
1631 : : else \
1632 : : aMapResSource = maMapRes; \
1633 : : if ( !mbMap || pMapModeDest != &maMapMode ) \
1634 : : { \
1635 : : if ( pMapModeDest->GetMapUnit() == MAP_RELATIVE ) \
1636 : : aMapResDest = maMapRes; \
1637 : : ImplCalcMapResolution( *pMapModeDest, \
1638 : : mnDPIX, mnDPIY, aMapResDest ); \
1639 : : } \
1640 : : else \
1641 : : aMapResDest = maMapRes
1642 : :
1643 : : // -----------------------------------------------------------------------
1644 : :
1645 : : #define ENTER2( eUnitSource, eUnitDest ) \
1646 : : DBG_ASSERT( eUnitSource != MAP_SYSFONT \
1647 : : && eUnitSource != MAP_APPFONT \
1648 : : && eUnitSource != MAP_RELATIVE, \
1649 : : "Source MapUnit nicht erlaubt" ); \
1650 : : DBG_ASSERT( eUnitDest != MAP_SYSFONT \
1651 : : && eUnitDest != MAP_APPFONT \
1652 : : && eUnitDest != MAP_RELATIVE, \
1653 : : "Destination MapUnit nicht erlaubt" ); \
1654 : : DBG_ASSERTWARNING( eUnitSource != MAP_PIXEL, \
1655 : : "MAP_PIXEL mit 72dpi angenaehert" ); \
1656 : : DBG_ASSERTWARNING( eUnitDest != MAP_PIXEL, \
1657 : : "MAP_PIXEL mit 72dpi angenaehert" )
1658 : :
1659 : : // -----------------------------------------------------------------------
1660 : :
1661 : : #define ENTER3( eUnitSource, eUnitDest ) \
1662 : : long nNumerator = 1; \
1663 : : long nDenominator = 1; \
1664 : : DBG_ASSERT( eUnitSource < s_ImplArySize, "Invalid source map unit"); \
1665 : : DBG_ASSERT( eUnitDest < s_ImplArySize, "Invalid destination map unit"); \
1666 : : if( (eUnitSource < s_ImplArySize) && (eUnitDest < s_ImplArySize) ) \
1667 : : { \
1668 : : nNumerator = aImplNumeratorAry[eUnitSource] * \
1669 : : aImplDenominatorAry[eUnitDest]; \
1670 : : nDenominator = aImplNumeratorAry[eUnitDest] * \
1671 : : aImplDenominatorAry[eUnitSource]; \
1672 : : } \
1673 : : if ( eUnitSource == MAP_PIXEL ) \
1674 : : nDenominator *= 72; \
1675 : : else if( eUnitDest == MAP_PIXEL ) \
1676 : : nNumerator *= 72
1677 : :
1678 : : // -----------------------------------------------------------------------
1679 : :
1680 : : #define ENTER4( rMapModeSource, rMapModeDest ) \
1681 : : ImplMapRes aMapResSource; \
1682 : : ImplMapRes aMapResDest; \
1683 : : \
1684 : : ImplCalcMapResolution( rMapModeSource, 72, 72, aMapResSource ); \
1685 : : ImplCalcMapResolution( rMapModeDest, 72, 72, aMapResDest )
1686 : :
1687 : : // -----------------------------------------------------------------------
1688 : :
1689 : : // return (n1 * n2 * n3) / (n4 * n5)
1690 : 750 : static long fn5( const long n1,
1691 : : const long n2,
1692 : : const long n3,
1693 : : const long n4,
1694 : : const long n5 )
1695 : : {
1696 [ + + ][ + - ]: 750 : if ( n1 == 0 || n2 == 0 || n3 == 0 || n4 == 0 || n5 == 0 )
[ + - ][ + - ]
[ - + ]
1697 : 184 : return 0;
1698 [ + + ]: 566 : if ( LONG_MAX / Abs(n2) < Abs(n3) )
1699 : : {
1700 : : // a6 wird "ubersprungen
1701 [ + - ]: 104 : BigInt a7 = n2;
1702 [ + - ][ + - ]: 104 : a7 *= n3;
1703 [ + - ][ + - ]: 104 : a7 *= n1;
1704 : :
1705 [ + - ]: 104 : if ( LONG_MAX / Abs(n4) < Abs(n5) )
1706 : : {
1707 [ + - ]: 104 : BigInt a8 = n4;
1708 [ + - ][ + - ]: 104 : a8 *= n5;
1709 : :
1710 [ + - ]: 104 : BigInt a9 = a8;
1711 [ + - ][ + - ]: 104 : a9 /= 2;
1712 [ + - ][ - + ]: 104 : if ( a7.IsNeg() )
1713 [ # # ]: 0 : a7 -= a9;
1714 : : else
1715 [ + - ]: 104 : a7 += a9;
1716 : :
1717 [ + - ]: 104 : a7 /= a8;
1718 : : } // of if
1719 : : else
1720 : : {
1721 : 0 : long n8 = n4 * n5;
1722 : :
1723 [ # # ][ # # ]: 0 : if ( a7.IsNeg() )
1724 [ # # ][ # # ]: 0 : a7 -= n8 / 2;
1725 : : else
1726 [ # # ][ # # ]: 0 : a7 += n8 / 2;
1727 : :
1728 [ # # ][ # # ]: 0 : a7 /= n8;
1729 : : } // of else
1730 [ + - ]: 104 : return (long)a7;
1731 : : } // of if
1732 : : else
1733 : : {
1734 : 462 : long n6 = n2 * n3;
1735 : :
1736 [ + + ]: 462 : if ( LONG_MAX / Abs(n1) < Abs(n6) )
1737 : : {
1738 [ + - ]: 86 : BigInt a7 = n1;
1739 [ + - ][ + - ]: 86 : a7 *= n6;
1740 : :
1741 [ - + ]: 86 : if ( LONG_MAX / Abs(n4) < Abs(n5) )
1742 : : {
1743 [ # # ]: 0 : BigInt a8 = n4;
1744 [ # # ][ # # ]: 0 : a8 *= n5;
1745 : :
1746 [ # # ]: 0 : BigInt a9 = a8;
1747 [ # # ][ # # ]: 0 : a9 /= 2;
1748 [ # # ][ # # ]: 0 : if ( a7.IsNeg() )
1749 [ # # ]: 0 : a7 -= a9;
1750 : : else
1751 [ # # ]: 0 : a7 += a9;
1752 : :
1753 [ # # ]: 0 : a7 /= a8;
1754 : : } // of if
1755 : : else
1756 : : {
1757 : 86 : long n8 = n4 * n5;
1758 : :
1759 [ + - ][ - + ]: 86 : if ( a7.IsNeg() )
1760 [ # # ][ # # ]: 0 : a7 -= n8 / 2;
1761 : : else
1762 [ + - ][ + - ]: 86 : a7 += n8 / 2;
1763 : :
1764 [ + - ][ + - ]: 86 : a7 /= n8;
1765 : : } // of else
1766 [ + - ]: 86 : return (long)a7;
1767 : : } // of if
1768 : : else
1769 : : {
1770 : 376 : long n7 = n1 * n6;
1771 : :
1772 [ - + ]: 376 : if ( LONG_MAX / Abs(n4) < Abs(n5) )
1773 : : {
1774 [ # # ]: 0 : BigInt a7 = n7;
1775 [ # # ]: 0 : BigInt a8 = n4;
1776 [ # # ][ # # ]: 0 : a8 *= n5;
1777 : :
1778 [ # # ]: 0 : BigInt a9 = a8;
1779 [ # # ][ # # ]: 0 : a9 /= 2;
1780 [ # # ][ # # ]: 0 : if ( a7.IsNeg() )
1781 [ # # ]: 0 : a7 -= a9;
1782 : : else
1783 [ # # ]: 0 : a7 += a9;
1784 : :
1785 [ # # ]: 0 : a7 /= a8;
1786 [ # # ]: 0 : return (long)a7;
1787 : : } // of if
1788 : : else
1789 : : {
1790 : 376 : const long n8 = n4 * n5;
1791 : 376 : const long n8_2 = n8 / 2;
1792 : :
1793 [ + + ]: 376 : if( n7 < 0 )
1794 : : {
1795 [ + - ]: 24 : if( ( n7 - LONG_MIN ) >= n8_2 )
1796 : 24 : n7 -= n8_2;
1797 : : }
1798 [ + - ]: 352 : else if( ( LONG_MAX - n7 ) >= n8_2 )
1799 : 352 : n7 += n8_2;
1800 : :
1801 : 750 : return n7 / n8;
1802 : : } // of else
1803 : : } // of else
1804 : : } // of else
1805 : : }
1806 : :
1807 : : // -----------------------------------------------------------------------
1808 : :
1809 : : // return (n1 * n2) / n3
1810 : 33765 : static long fn3( const long n1, const long n2, const long n3 )
1811 : : {
1812 [ + + ][ + - ]: 33765 : if ( n1 == 0 || n2 == 0 || n3 == 0 )
[ - + ]
1813 : 12670 : return 0;
1814 [ - + ]: 21095 : if ( LONG_MAX / Abs(n1) < Abs(n2) )
1815 : : {
1816 [ # # ]: 0 : BigInt a4 = n1;
1817 [ # # ][ # # ]: 0 : a4 *= n2;
1818 : :
1819 [ # # ][ # # ]: 0 : if ( a4.IsNeg() )
1820 [ # # ][ # # ]: 0 : a4 -= n3 / 2;
1821 : : else
1822 [ # # ][ # # ]: 0 : a4 += n3 / 2;
1823 : :
1824 [ # # ][ # # ]: 0 : a4 /= n3;
1825 [ # # ]: 0 : return (long)a4;
1826 : : } // of if
1827 : : else
1828 : : {
1829 : 21095 : long n4 = n1 * n2;
1830 : 21095 : const long n3_2 = n3 / 2;
1831 : :
1832 [ + + ]: 21095 : if( n4 < 0 )
1833 : : {
1834 [ + - ]: 7486 : if( ( n4 - LONG_MIN ) >= n3_2 )
1835 : 7486 : n4 -= n3_2;
1836 : : }
1837 [ + - ]: 13609 : else if( ( LONG_MAX - n4 ) >= n3_2 )
1838 : 13609 : n4 += n3_2;
1839 : :
1840 : 33765 : return n4 / n3;
1841 : : } // of else
1842 : : }
1843 : :
1844 : : // -----------------------------------------------------------------------
1845 : :
1846 : 6866 : Point OutputDevice::LogicToLogic( const Point& rPtSource,
1847 : : const MapMode* pMapModeSource,
1848 : : const MapMode* pMapModeDest ) const
1849 : : {
1850 [ + - ][ - + ]: 6866 : ENTER1( rPtSource, pMapModeSource, pMapModeDest );
[ + - ][ + + ]
[ + - ][ - + ]
[ # # ][ # # ]
[ + - ][ + - ]
[ - + ][ + - ]
1851 : :
1852 : 19 : return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1853 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1854 [ + - ]: 19 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1855 : : aMapResDest.mnMapOfsX,
1856 : 19 : fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1857 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1858 [ + - ]: 19 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1859 : 6866 : aMapResDest.mnMapOfsY );
1860 : : }
1861 : :
1862 : : // -----------------------------------------------------------------------
1863 : :
1864 : 6932 : Size OutputDevice::LogicToLogic( const Size& rSzSource,
1865 : : const MapMode* pMapModeSource,
1866 : : const MapMode* pMapModeDest ) const
1867 : : {
1868 [ - + ][ + + ]: 6932 : ENTER1( rSzSource, pMapModeSource, pMapModeDest );
[ + - ][ + + ]
[ + - ][ + - ]
[ - + ][ + - ]
[ + - ][ - + ]
[ # # ][ # # ]
1869 : :
1870 : : return Size( fn5( rSzSource.Width(),
1871 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1872 : : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1873 : : fn5( rSzSource.Height(),
1874 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1875 [ + - ][ + - ]: 6932 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1876 : : }
1877 : :
1878 : : // -----------------------------------------------------------------------
1879 : :
1880 : 0 : Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource,
1881 : : const MapMode* pMapModeSource,
1882 : : const MapMode* pMapModeDest ) const
1883 : : {
1884 [ # # ][ # # ]: 0 : ENTER1( rRectSource, pMapModeSource, pMapModeDest );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1885 : :
1886 : 0 : return Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
1887 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1888 [ # # ]: 0 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1889 : : aMapResDest.mnMapOfsX,
1890 : 0 : fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
1891 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1892 [ # # ]: 0 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1893 : : aMapResDest.mnMapOfsY,
1894 : 0 : fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
1895 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1896 [ # # ]: 0 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1897 : : aMapResDest.mnMapOfsX,
1898 : 0 : fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
1899 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1900 [ # # ]: 0 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1901 [ # # ]: 0 : aMapResDest.mnMapOfsY );
1902 : : }
1903 : :
1904 : : // -----------------------------------------------------------------------
1905 : :
1906 : 28436 : Point OutputDevice::LogicToLogic( const Point& rPtSource,
1907 : : const MapMode& rMapModeSource,
1908 : : const MapMode& rMapModeDest )
1909 : : {
1910 [ + + ]: 28436 : if ( rMapModeSource == rMapModeDest )
1911 : 28210 : return rPtSource;
1912 : :
1913 : 226 : MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1914 : 226 : MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1915 : : ENTER2( eUnitSource, eUnitDest );
1916 : :
1917 [ + + ][ + + ]: 226 : if ( rMapModeSource.mpImplMapMode->mbSimple &&
1918 : : rMapModeDest.mpImplMapMode->mbSimple )
1919 : : {
1920 [ + - ][ + - ]: 107 : ENTER3( eUnitSource, eUnitDest );
[ - + ][ - + ]
1921 : :
1922 : : return Point( fn3( rPtSource.X(), nNumerator, nDenominator ),
1923 : 107 : fn3( rPtSource.Y(), nNumerator, nDenominator ) );
1924 : : }
1925 : : else
1926 : : {
1927 [ + - ][ + - ]: 119 : ENTER4( rMapModeSource, rMapModeDest );
1928 : :
1929 : 119 : return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1930 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1931 [ + - ]: 119 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1932 : : aMapResDest.mnMapOfsX,
1933 : 119 : fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1934 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1935 [ + - ]: 119 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1936 : 28436 : aMapResDest.mnMapOfsY );
1937 : : }
1938 : : }
1939 : :
1940 : : // -----------------------------------------------------------------------
1941 : :
1942 : 10513 : Size OutputDevice::LogicToLogic( const Size& rSzSource,
1943 : : const MapMode& rMapModeSource,
1944 : : const MapMode& rMapModeDest )
1945 : : {
1946 [ + + ]: 10513 : if ( rMapModeSource == rMapModeDest )
1947 : 5567 : return rSzSource;
1948 : :
1949 : 4946 : MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1950 : 4946 : MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1951 : : ENTER2( eUnitSource, eUnitDest );
1952 : :
1953 [ + + ][ + + ]: 4946 : if ( rMapModeSource.mpImplMapMode->mbSimple &&
1954 : : rMapModeDest.mpImplMapMode->mbSimple )
1955 : : {
1956 [ + - ][ + - ]: 4786 : ENTER3( eUnitSource, eUnitDest );
[ - + ][ - + ]
1957 : :
1958 : : return Size( fn3( rSzSource.Width(), nNumerator, nDenominator ),
1959 : 4786 : fn3( rSzSource.Height(), nNumerator, nDenominator ) );
1960 : : }
1961 : : else
1962 : : {
1963 [ + - ][ + - ]: 160 : ENTER4( rMapModeSource, rMapModeDest );
1964 : :
1965 : : return Size( fn5( rSzSource.Width(),
1966 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1967 : : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1968 : : fn5( rSzSource.Height(),
1969 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1970 [ + - ][ + - ]: 10513 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1971 : : }
1972 : : }
1973 : :
1974 : : // -----------------------------------------------------------------------
1975 : :
1976 : 0 : basegfx::B2DPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolygon& rPolySource,
1977 : : const MapMode& rMapModeSource,
1978 : : const MapMode& rMapModeDest )
1979 : : {
1980 [ # # ][ # # ]: 0 : if ( rMapModeSource == rMapModeDest )
1981 [ # # ]: 0 : return rPolySource;
1982 : :
1983 : 0 : MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1984 : 0 : MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1985 : : ENTER2( eUnitSource, eUnitDest );
1986 : :
1987 [ # # ]: 0 : basegfx::B2DHomMatrix aTransform;
1988 : :
1989 [ # # ][ # # ]: 0 : if ( rMapModeSource.mpImplMapMode->mbSimple &&
1990 : : rMapModeDest.mpImplMapMode->mbSimple )
1991 : : {
1992 [ # # ][ # # ]: 0 : ENTER3( eUnitSource, eUnitDest );
[ # # ][ # # ]
1993 : :
1994 : 0 : const double fScaleFactor((double)nNumerator / (double)nDenominator);
1995 [ # # ]: 0 : aTransform.set(0, 0, fScaleFactor);
1996 [ # # ]: 0 : aTransform.set(1, 1, fScaleFactor);
1997 : : }
1998 : : else
1999 : : {
2000 [ # # ][ # # ]: 0 : ENTER4( rMapModeSource, rMapModeDest );
2001 : :
2002 : : const double fScaleFactorX( (double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX))
2003 : 0 : / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)) );
2004 : : const double fScaleFactorY( (double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY))
2005 : 0 : / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)) );
2006 : 0 : const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX));
2007 : 0 : const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY));
2008 : :
2009 [ # # ]: 0 : aTransform.set(0, 0, fScaleFactorX);
2010 [ # # ]: 0 : aTransform.set(1, 1, fScaleFactorY);
2011 [ # # ]: 0 : aTransform.set(0, 2, fZeroPointX);
2012 [ # # ]: 0 : aTransform.set(1, 2, fZeroPointY);
2013 : : }
2014 [ # # ]: 0 : basegfx::B2DPolygon aPoly( rPolySource );
2015 [ # # ]: 0 : aPoly.transform( aTransform );
2016 [ # # ][ # # ]: 0 : return aPoly;
[ # # ]
2017 : : }
2018 : :
2019 : : // -----------------------------------------------------------------------
2020 : :
2021 : 20087 : Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource,
2022 : : const MapMode& rMapModeSource,
2023 : : const MapMode& rMapModeDest )
2024 : : {
2025 [ + + ]: 20087 : if ( rMapModeSource == rMapModeDest )
2026 : 14735 : return rRectSource;
2027 : :
2028 : 5352 : MapUnit eUnitSource = rMapModeSource.GetMapUnit();
2029 : 5352 : MapUnit eUnitDest = rMapModeDest.GetMapUnit();
2030 : : ENTER2( eUnitSource, eUnitDest );
2031 : :
2032 [ + - ][ + + ]: 5352 : if ( rMapModeSource.mpImplMapMode->mbSimple &&
2033 : : rMapModeDest.mpImplMapMode->mbSimple )
2034 : : {
2035 [ + - ][ + - ]: 5340 : ENTER3( eUnitSource, eUnitDest );
[ - + ][ - + ]
2036 : :
2037 : : return Rectangle( fn3( rRectSource.Left(), nNumerator, nDenominator ),
2038 : : fn3( rRectSource.Top(), nNumerator, nDenominator ),
2039 : : fn3( rRectSource.Right(), nNumerator, nDenominator ),
2040 : 5340 : fn3( rRectSource.Bottom(), nNumerator, nDenominator ) );
2041 : : }
2042 : : else
2043 : : {
2044 [ + - ][ + - ]: 12 : ENTER4( rMapModeSource, rMapModeDest );
2045 : :
2046 : 12 : return Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
2047 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
2048 [ + - ]: 12 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
2049 : : aMapResDest.mnMapOfsX,
2050 : 12 : fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
2051 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
2052 [ + - ]: 12 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
2053 : : aMapResDest.mnMapOfsY,
2054 : 12 : fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
2055 : : aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
2056 [ + - ]: 12 : aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
2057 : : aMapResDest.mnMapOfsX,
2058 : 12 : fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
2059 : : aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
2060 [ + - ]: 12 : aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
2061 [ + - ]: 20087 : aMapResDest.mnMapOfsY );
2062 : : }
2063 : : }
2064 : :
2065 : : // -----------------------------------------------------------------------
2066 : :
2067 : 2769 : long OutputDevice::LogicToLogic( long nLongSource,
2068 : : MapUnit eUnitSource, MapUnit eUnitDest )
2069 : : {
2070 [ + + ]: 2769 : if ( eUnitSource == eUnitDest )
2071 : 150 : return nLongSource;
2072 : :
2073 : : ENTER2( eUnitSource, eUnitDest );
2074 [ + - ][ + - ]: 2619 : ENTER3( eUnitSource, eUnitDest );
[ - + ][ - + ]
2075 : :
2076 : 2769 : return fn3( nLongSource, nNumerator, nDenominator );
2077 : : }
2078 : :
2079 : : // -----------------------------------------------------------------------
2080 : :
2081 : 642 : void OutputDevice::SetPixelOffset( const Size& rOffset )
2082 : : {
2083 : 642 : mnOutOffOrigX = rOffset.Width();
2084 : 642 : mnOutOffOrigY = rOffset.Height();
2085 : :
2086 : : mnOutOffLogicX = ImplPixelToLogic( mnOutOffOrigX, mnDPIX,
2087 : : maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
2088 : 642 : maThresRes.mnThresPixToLogX );
2089 : : mnOutOffLogicY = ImplPixelToLogic( mnOutOffOrigY, mnDPIY,
2090 : : maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
2091 : 642 : maThresRes.mnThresPixToLogY );
2092 : :
2093 [ - + ]: 642 : if( mpAlphaVDev )
2094 : 0 : mpAlphaVDev->SetPixelOffset( rOffset );
2095 : 642 : }
2096 : :
2097 : : // -----------------------------------------------------------------------
2098 : :
2099 : 321 : Size OutputDevice::GetPixelOffset() const
2100 : : {
2101 : 321 : return Size(mnOutOffOrigX, mnOutOffOrigY);
2102 : : }
2103 : :
2104 : : // -----------------------------------------------------------------------
2105 : :
2106 : 2736 : long Window::ImplLogicUnitToPixelX( long nX, MapUnit eUnit )
2107 : : {
2108 [ + - ]: 2736 : if ( eUnit != MAP_PIXEL )
2109 : : {
2110 : 2736 : ImplFrameData* pFrameData = mpWindowImpl->mpFrameData;
2111 : :
2112 : : // Map-Einheit verschieden, dann neu berechnen
2113 [ + + ]: 2736 : if ( pFrameData->meMapUnit != eUnit )
2114 : : {
2115 : 1159 : pFrameData->meMapUnit = eUnit;
2116 : : ImplCalcMapResolution( MapMode( eUnit ), mnDPIX, mnDPIY,
2117 [ + - ]: 1159 : pFrameData->maMapUnitRes );
2118 : : }
2119 : :
2120 : : // Es wird kein BigInt gebraucht, da diese Funktion nur zur Umrechnung
2121 : : // von Fensterposition benutzt wird
2122 : 2736 : nX = nX * mnDPIX * pFrameData->maMapUnitRes.mnMapScNumX;
2123 : : nX += nX >= 0 ? (pFrameData->maMapUnitRes.mnMapScDenomX/2) :
2124 [ + - ]: 2736 : -((pFrameData->maMapUnitRes.mnMapScDenomX-1)/2);
2125 : 2736 : nX /= pFrameData->maMapUnitRes.mnMapScDenomX;
2126 : : }
2127 : :
2128 : 2736 : return nX;
2129 : : }
2130 : :
2131 : : // -----------------------------------------------------------------------
2132 : :
2133 : 2736 : long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit )
2134 : : {
2135 [ + - ]: 2736 : if ( eUnit != MAP_PIXEL )
2136 : : {
2137 : 2736 : ImplFrameData* pFrameData = mpWindowImpl->mpFrameData;
2138 : :
2139 : : // Map-Einheit verschieden, dann neu berechnen
2140 [ - + ]: 2736 : if ( pFrameData->meMapUnit != eUnit )
2141 : : {
2142 : 0 : pFrameData->meMapUnit = eUnit;
2143 : : ImplCalcMapResolution( MapMode( eUnit ), mnDPIX, mnDPIY,
2144 [ # # ]: 0 : pFrameData->maMapUnitRes );
2145 : : }
2146 : :
2147 : : // Es wird kein BigInt gebraucht, da diese Funktion nur zur Umrechnung
2148 : : // von Fensterposition benutzt wird
2149 : 2736 : nY = nY * mnDPIY * pFrameData->maMapUnitRes.mnMapScNumY;
2150 : : nY += nY >= 0 ? (pFrameData->maMapUnitRes.mnMapScDenomY/2) :
2151 [ + - ]: 2736 : -((pFrameData->maMapUnitRes.mnMapScDenomY-1)/2);
2152 : 2736 : nY /= pFrameData->maMapUnitRes.mnMapScDenomY;
2153 : : }
2154 : :
2155 : 2736 : return nY;
2156 : : }
2157 : :
2158 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|