summaryrefslogtreecommitdiff
path: root/drawinglayer/source/texture/texture.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/texture/texture.cxx')
-rw-r--r--drawinglayer/source/texture/texture.cxx130
1 files changed, 27 insertions, 103 deletions
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index 109409357f..fea376384d 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -158,15 +158,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fTop(mfBorder);
- const double fStripeWidth((1.0 - fTop) / maGradientInfo.mnSteps);
-
+ const double fStripeWidth(1.0 / maGradientInfo.mnSteps);
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
- const double fOffsetUpper(fStripeWidth * (double)a);
-
- // create matrix
- const basegfx::B2DRange aRect(0.0, fTop + fOffsetUpper, 1.0, 1.0);
+ const basegfx::B2DRange aRect(0.0, fStripeWidth * a, 1.0, 1.0);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -218,17 +213,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder(mfBorder * 0.5);
- double fTop(fHalfBorder);
- double fBottom(1.0 - fHalfBorder);
- const double fStripeWidth((fBottom - fTop) / ((maGradientInfo.mnSteps * 2L) - 1L));
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
+ const double fStripeWidth=1.0 / (maGradientInfo.mnSteps - 1L);
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a != 0; a--)
{
- const double fOffset(fStripeWidth * (double)a);
-
- // create matrix
- const basegfx::B2DRange aRect(0.0, fTop + fOffset, 1.0, fBottom - fOffset);
+ const basegfx::B2DRange aRect(0, 0, 1.0, fStripeWidth * a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -280,34 +268,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
- else
+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--)
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
-
- // create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -352,34 +316,29 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
+ double fWidth(1);
+ double fHeight(1);
double fIncrementX, fIncrementY;
if(maGradientInfo.mfAspectRatio > 1.0)
{
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementY = fHeight / maGradientInfo.mnSteps;
fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
}
else
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementX = fWidth / maGradientInfo.mnSteps;
fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
}
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
// next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
+ fWidth -= fIncrementX;
+ fHeight -= fIncrementY;
// create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -424,42 +383,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
- const double fWidth(fRight - fLeft);
- const double fHalfAspectExpansion(((maGradientInfo.mfAspectRatio - 1.0) * 0.5) * fWidth);
- fTop -= fHalfAspectExpansion;
- fBottom += fHalfAspectExpansion;
- fIncrementX = fWidth / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
- else
+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--)
{
- const double fHeight(fBottom - fTop);
- const double fHalfAspectExpansion((((1.0 / maGradientInfo.mfAspectRatio) - 1.0) * 0.5) * fHeight);
- fLeft -= fHalfAspectExpansion;
- fRight += fHalfAspectExpansion;
- fIncrementY = fHeight / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
-
- // create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -504,34 +431,29 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
+ double fWidth(1);
+ double fHeight(1);
double fIncrementX, fIncrementY;
if(maGradientInfo.mfAspectRatio > 1.0)
{
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementY = fHeight / maGradientInfo.mnSteps;
fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
}
else
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementX = fWidth / maGradientInfo.mnSteps;
fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
}
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
// next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
+ fWidth -= fIncrementX;
+ fHeight -= fIncrementY;
// create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -567,6 +489,8 @@ namespace drawinglayer
double fTargetOffsetX(rTargetRange.getMinX());
double fTargetOffsetY(rTargetRange.getMinY());
+ fAngle = -fAngle;
+
// add object expansion
if(0.0 != fAngle)
{