vclprocessor2d.cxx (5496114c) vclprocessor2d.cxx (1f69a0e2)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 456 unchanged lines hidden (view full) ---

465 if(nOWidth > 0 && nOHeight > 0)
466 {
467 // transform graphic range to device coordinates (pixels). Use
468 // the device transformation for better accuracy
469 basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange());
470 aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform);
471
472 // extract discrete size of graphic
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 456 unchanged lines hidden (view full) ---

465 if(nOWidth > 0 && nOHeight > 0)
466 {
467 // transform graphic range to device coordinates (pixels). Use
468 // the device transformation for better accuracy
469 basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange());
470 aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform);
471
472 // extract discrete size of graphic
473 const sal_Int32 nBWidth(basegfx::fround(aGraphicRange.getWidth()));
474 const sal_Int32 nBHeight(basegfx::fround(aGraphicRange.getHeight()));
473 // caution: when getting to zero, nothing would be painted; thus, do not allow this
474 const sal_Int32 nBWidth(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getWidth())));
475 const sal_Int32 nBHeight(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getHeight())));
475
476 // only do something when bitmap fill has a size in discrete units
477 if(nBWidth > 0 && nBHeight > 0)
478 {
479 // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
480 // in vcl many times, create a size-optimized version
481 const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
482 BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());
483 static bool bEnablePreScaling(true);
484 const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250));
485
476
477 // only do something when bitmap fill has a size in discrete units
478 if(nBWidth > 0 && nBHeight > 0)
479 {
480 // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
481 // in vcl many times, create a size-optimized version
482 const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
483 BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());
484 static bool bEnablePreScaling(true);
485 const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250));
486
487 // ... but only up to a maximum size, else it gets too expensive
486 if(bPreScaled)
487 {
488 if(bPreScaled)
489 {
488 // ... but only up to a maximum size, else it gets too expensive
490 // if color depth is below 24bit, expand before scaling for better quality.
491 // This is even needed for low colors, else the scale will produce
492 // a bitmap in gray or Black/White (!)
493 if(aBitmapEx.GetBitCount() < 24)
494 {
495 aBitmapEx.Convert(BMP_CONVERSION_24BIT);
496 }
497
489 aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE);
490 }
491
492 bool bPainted(false);
493
494 if(maBColorModifierStack.count())
495 {
496 // when color modifier, apply to bitmap

--- 1017 unchanged lines hidden ---
498 aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE);
499 }
500
501 bool bPainted(false);
502
503 if(maBColorModifierStack.count())
504 {
505 // when color modifier, apply to bitmap

--- 1017 unchanged lines hidden ---