diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-28 19:03:55 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-28 19:03:55 +0000 |
commit | 04b74d9eadff586cab293db3cd473108ca1d5827 (patch) | |
tree | 5f81a44eeb200306c4b261e9312ae48426e1b3b4 /drawinglayer | |
parent | edcc547422e9d869bf1d7982a49430b6c398533a (diff) | |
parent | d1886d07b439e7197f731c9d98c0b2ec31c62faa (diff) |
koheidatapilot03: merge with DEV300_m57
Diffstat (limited to 'drawinglayer')
4 files changed, 61 insertions, 25 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 75e66a5422d2..0055af3ea4bd 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -286,12 +286,14 @@ namespace drawinglayer nIndex, nLength); - return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); - } - else - { - return basegfx::B2DRange(); + // #i102556# take empty results into account + if(!aRect.IsEmpty()) + { + return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + } } + + return basegfx::B2DRange(); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 8188265ff8e7..7c62c235c21d 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -312,26 +312,31 @@ namespace drawinglayer // get basic text range basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); -#ifdef WIN32 - // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor - if(bCorrectScale) + + // #i102556# take empty results into account + if(!aNewRange.isEmpty()) { - aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation()); - } +#ifdef WIN32 + // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor + if(bCorrectScale) + { + aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation()); + } #endif - // prepare object transformation for range - basegfx::B2DHomMatrix aRangeTransformation; + // prepare object transformation for range + basegfx::B2DHomMatrix aRangeTransformation; - aRangeTransformation.scale(aScale.getX(), aScale.getY()); - aRangeTransformation.shearX(fShearX); - aRangeTransformation.rotate(fRotate); - aRangeTransformation.translate(aTranslate.getX(), aTranslate.getY()); + aRangeTransformation.scale(aScale.getX(), aScale.getY()); + aRangeTransformation.shearX(fShearX); + aRangeTransformation.rotate(fRotate); + aRangeTransformation.translate(aTranslate.getX(), aTranslate.getY()); - // apply range transformation to it - aNewRange.transform(aRangeTransformation); + // apply range transformation to it + aNewRange.transform(aRangeTransformation); - // assign to buffered value - const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; + // assign to buffered value + const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; + } } } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index d6eb6e1695b2..adc33c4d676d 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -682,6 +682,15 @@ namespace drawinglayer double fRotate, fShearX; aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX); + if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) + { + // #i102175# handle special case: If scale is negative in (x,y) (3rd quadrant), it can + // be expressed as rotation by PI. This needs to be done for Metafiles since + // these can be rotated, but not really mirrored + aScale = basegfx::absolute(aScale); + fRotate += F_PI; + } + // get BoundRect basegfx::B2DRange aOutlineRange(rMetaCandidate.getB2DRange(getViewInformation2D())); aOutlineRange.transform(maCurrentTransformation); @@ -715,8 +724,18 @@ namespace drawinglayer // rotation if(!basegfx::fTools::equalZero(fRotate)) { - double fRotation((fRotate / F_PI180) * -10.0); - aMetaFile.Rotate((sal_uInt16)(fRotation)); + // #i103530# + // MetaFile::Rotate has no input parameter check, so the parameter needs to be + // well-aligned to the old range [0..3600] 10th degrees with inverse orientation + sal_Int16 nRotation((sal_Int16)((fRotate / F_PI180) * -10.0)); + + while(nRotation < 0) + nRotation += 3600; + + while(nRotation >= 3600) + nRotation -= 3600; + + aMetaFile.Rotate(nRotation); } // Prepare target output size diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 0a15ff224073..b5a59e10a119 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -675,15 +675,25 @@ namespace drawinglayer { // step two: // - // bring from [0.0 .. 1.0] in X,Y and Z to view cordinates. also: - // - scale Z to [0.0 .. fMaxZDepth] - const double fMaxZDepth(double(0x0000ff00)); + // bring from [0.0 .. 1.0] in X,Y and Z to view cordinates + // + // #i102611# + // also: scale Z to [1.5 .. 65534.5]. Normally, a range of [0.0 .. 65535.0] + // could be used, but a 'unused' value is needed, so '0' is used what reduces + // the range to [1.0 .. 65535.0]. It has also shown that small numerical errors + // (smaller as basegfx::fTools::mfSmallValue, which is 0.000000001) happen. + // Instead of checking those by basegfx::fTools methods which would cost + // runtime, just add another 0.5 tolerance to the start and end of the Z-Buffer + // range, thus resulting in [1.5 .. 65534.5] + const double fMaxZDepth(65533.0); aDeviceToView.translate(-rVisiblePart.getMinX(), -rVisiblePart.getMinY(), 0.0); if(mnAntiAlialize) aDeviceToView.scale(fFullViewSizeX * mnAntiAlialize, fFullViewSizeY * mnAntiAlialize, fMaxZDepth); else aDeviceToView.scale(fFullViewSizeX, fFullViewSizeY, fMaxZDepth); + + aDeviceToView.translate(0.0, 0.0, 1.5); } // update local ViewInformation3D with own DeviceToView |