View | Details | Raw Unified | Return to issue 75339
Collapse All | Expand All

(-)source/mtfrenderer/implrenderer.cxx (-9 / +74 lines)
Lines 457-462 namespace Link Here
457
            }
457
            }
458
        }
458
        }
459
    }
459
    }
460
461
    /** Normalize bitmap
462
463
        Negative dest size on OutputDevice denotes mirroring along the
464
        corresponding axis. Function performs the mirror manually
465
        directly on the bitmap, and sets the sizes back to positive
466
        values.
467
     */
468
    void normalizeBmp(Bitmap& rBitmap, ::Size& rSize)
469
    {
470
        ULONG nMirrorFlags(0);
471
472
        if( rSize.Width() < 0 )
473
        {
474
            nMirrorFlags = BMP_MIRROR_HORZ;
475
            rSize.Width() *= -1;
476
        }
477
478
        if( rSize.Height() < 0 )
479
        {
480
            nMirrorFlags |= BMP_MIRROR_VERT;
481
            rSize.Height() *= -1;
482
        }
483
484
        rBitmap.Mirror( nMirrorFlags );
485
    }
486
487
    void normalizeBmpEx(BitmapEx& rBitmap, ::Size& rSize)
488
    {
489
        ULONG nMirrorFlags(0);
490
491
        if( rSize.Width() < 0 )
492
        {
493
            nMirrorFlags = BMP_MIRROR_HORZ;
494
            rSize.Width() *= -1;
495
        }
496
497
        if( rSize.Height() < 0 )
498
        {
499
            nMirrorFlags |= BMP_MIRROR_VERT;
500
            rSize.Height() *= -1;
501
        }
502
503
        rBitmap.Mirror( nMirrorFlags );
504
    }
460
}
505
}
461
506
462
507
Lines 2191-2203 namespace cppcanvas Link Here
2191
                    {
2236
                    {
2192
                        MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pCurrAct);
2237
                        MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pCurrAct);
2193
2238
2239
                        Bitmap aBmp = pAct->GetBitmap();
2240
                        Size   aSize = pAct->GetSize();
2241
                        normalizeBmp( aBmp,aSize );
2242
2194
                        ActionSharedPtr pBmpAction(
2243
                        ActionSharedPtr pBmpAction(
2195
                                internal::BitmapActionFactory::createBitmapAction(
2244
                                internal::BitmapActionFactory::createBitmapAction(
2196
                                    pAct->GetBitmap(),
2245
                                    aBmp,
2197
                                    getState( rStates ).mapModeTransform * 
2246
                                    getState( rStates ).mapModeTransform * 
2198
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2247
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2199
                                    getState( rStates ).mapModeTransform * 
2248
                                    getState( rStates ).mapModeTransform * 
2200
                                    ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
2249
                                    ::vcl::unotools::b2DSizeFromSize( aSize ),
2201
                                    rCanvas,
2250
                                    rCanvas,
2202
                                    getState( rStates ) ) );
2251
                                    getState( rStates ) ) );
2203
2252
Lines 2221-2236 namespace cppcanvas Link Here
2221
                        // need to copy and convert the whole bitmap)
2270
                        // need to copy and convert the whole bitmap)
2222
                        Bitmap aBmp( pAct->GetBitmap() );
2271
                        Bitmap aBmp( pAct->GetBitmap() );
2223
                        const Rectangle aCropRect( pAct->GetSrcPoint(),
2272
                        const Rectangle aCropRect( pAct->GetSrcPoint(),
2224
                                                    pAct->GetSrcSize() );
2273
                                                   pAct->GetSrcSize() );
2225
                        aBmp.Crop( aCropRect );
2274
                        aBmp.Crop( aCropRect );
2226
2275
2276
                        Size aSize = pAct->GetDestSize();
2277
                        normalizeBmp( aBmp,aSize );
2278
2227
                        ActionSharedPtr pBmpAction(
2279
                        ActionSharedPtr pBmpAction(
2228
                                internal::BitmapActionFactory::createBitmapAction(
2280
                                internal::BitmapActionFactory::createBitmapAction(
2229
                                    aBmp,
2281
                                    aBmp,
2230
                                    getState( rStates ).mapModeTransform * 
2282
                                    getState( rStates ).mapModeTransform * 
2231
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2283
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2232
                                    getState( rStates ).mapModeTransform * 
2284
                                    getState( rStates ).mapModeTransform * 
2233
                                    ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
2285
                                    ::vcl::unotools::b2DSizeFromSize( aSize ),
2234
                                    rCanvas,
2286
                                    rCanvas,
2235
                                    getState( rStates ) ) );
2287
                                    getState( rStates ) ) );
2236
2288
Lines 2274-2286 namespace cppcanvas Link Here
2274
                    {
2326
                    {
2275
                        MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pCurrAct);
2327
                        MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pCurrAct);
2276
2328
2329
                        BitmapEx aBmp  = pAct->GetBitmapEx();
2330
                        Size     aSize = pAct->GetSize();
2331
                        normalizeBmpEx( aBmp,aSize );
2332
2277
                        ActionSharedPtr pBmpAction(
2333
                        ActionSharedPtr pBmpAction(
2278
                                internal::BitmapActionFactory::createBitmapAction(
2334
                                internal::BitmapActionFactory::createBitmapAction(
2279
                                    pAct->GetBitmapEx(),
2335
                                    aBmp,
2280
                                    getState( rStates ).mapModeTransform * 
2336
                                    getState( rStates ).mapModeTransform * 
2281
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2337
                                    ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2282
                                    getState( rStates ).mapModeTransform * 
2338
                                    getState( rStates ).mapModeTransform * 
2283
                                    ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
2339
                                    ::vcl::unotools::b2DSizeFromSize( aSize ),
2284
                                    rCanvas,
2340
                                    rCanvas,
2285
                                    getState( rStates ) ) );
2341
                                    getState( rStates ) ) );
2286
2342
Lines 2307-2319 namespace cppcanvas Link Here
2307
                                                   pAct->GetSrcSize() );
2363
                                                   pAct->GetSrcSize() );
2308
                        aBmp.Crop( aCropRect );
2364
                        aBmp.Crop( aCropRect );
2309
2365
2366
                        Size aSize = pAct->GetDestSize();
2367
                        normalizeBmpEx( aBmp,aSize );
2368
2310
                        ActionSharedPtr pBmpAction(
2369
                        ActionSharedPtr pBmpAction(
2311
                            internal::BitmapActionFactory::createBitmapAction(
2370
                            internal::BitmapActionFactory::createBitmapAction(
2312
                                aBmp,
2371
                                aBmp,
2313
                                getState( rStates ).mapModeTransform * 
2372
                                getState( rStates ).mapModeTransform * 
2314
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2373
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2315
                                getState( rStates ).mapModeTransform * 
2374
                                getState( rStates ).mapModeTransform * 
2316
                                ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
2375
                                ::vcl::unotools::b2DSizeFromSize( aSize ),
2317
                                rCanvas,
2376
                                rCanvas,
2318
                                getState( rStates ) ) );
2377
                                getState( rStates ) ) );
2319
2378
Lines 2369-2381 namespace cppcanvas Link Here
2369
                        BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
2428
                        BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
2370
                                                        pAct->GetColor() ));
2429
                                                        pAct->GetColor() ));
2371
2430
2431
                        Size aSize = pAct->GetSize();
2432
                        normalizeBmpEx( aBmp,aSize );
2433
2372
                        ActionSharedPtr pBmpAction(
2434
                        ActionSharedPtr pBmpAction(
2373
                            internal::BitmapActionFactory::createBitmapAction(
2435
                            internal::BitmapActionFactory::createBitmapAction(
2374
                                aBmp,
2436
                                aBmp,
2375
                                getState( rStates ).mapModeTransform * 
2437
                                getState( rStates ).mapModeTransform * 
2376
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2438
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
2377
                                getState( rStates ).mapModeTransform * 
2439
                                getState( rStates ).mapModeTransform * 
2378
                                ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
2440
                                ::vcl::unotools::b2DSizeFromSize( aSize ),
2379
                                rCanvas,
2441
                                rCanvas,
2380
                                getState( rStates ) ) );
2442
                                getState( rStates ) ) );
2381
                        
2443
                        
Lines 2407-2419 namespace cppcanvas Link Here
2407
                                                   pAct->GetSrcSize() );
2469
                                                   pAct->GetSrcSize() );
2408
                        aBmp.Crop( aCropRect );
2470
                        aBmp.Crop( aCropRect );
2409
2471
2472
                        Size aSize = pAct->GetDestSize();
2473
                        normalizeBmpEx( aBmp,aSize );
2474
2410
                        ActionSharedPtr pBmpAction(
2475
                        ActionSharedPtr pBmpAction(
2411
                            internal::BitmapActionFactory::createBitmapAction(
2476
                            internal::BitmapActionFactory::createBitmapAction(
2412
                                aBmp,
2477
                                aBmp,
2413
                                getState( rStates ).mapModeTransform * 
2478
                                getState( rStates ).mapModeTransform * 
2414
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2479
                                ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
2415
                                getState( rStates ).mapModeTransform * 
2480
                                getState( rStates ).mapModeTransform * 
2416
                                ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
2481
                                ::vcl::unotools::b2DSizeFromSize( aSize ),
2417
                                rCanvas,
2482
                                rCanvas,
2418
                                getState( rStates ) ) );
2483
                                getState( rStates ) ) );
2419
2484

Return to issue 75339