outdev4.cxx (9f62ea84) outdev4.cxx (6b7345f3)
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

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

1165 mpMetaFile = pOldMtf;
1166 }
1167}
1168
1169// -----------------------------------------------------------------------
1170
1171void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, sal_Bool bMtf )
1172{
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

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

1165 mpMetaFile = pOldMtf;
1166 }
1167}
1168
1169// -----------------------------------------------------------------------
1170
1171void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, sal_Bool bMtf )
1172{
1173 Rectangle aRect( rPolyPoly.GetBoundRect() );
1174 const long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 );
1175 const long nWidth = ImplDevicePixelToLogicWidth( Max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), 3L ) );
1176 Point* pPtBuffer = new Point[ HATCH_MAXPOINTS ];
1177 Point aPt1, aPt2, aEndPt1;
1178 Size aInc;
1173 if(rPolyPoly.Count())
1174 {
1175 // #115630# ImplDrawHatch does not work with beziers included in the polypolygon, take care of that
1176 bool bIsCurve(false);
1179
1177
1180 // Single hatch
1181 aRect.Left() -= nLogPixelWidth; aRect.Top() -= nLogPixelWidth; aRect.Right() += nLogPixelWidth; aRect.Bottom() += nLogPixelWidth;
1182 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle(), aPt1, aPt2, aInc, aEndPt1 );
1183 do
1184 {
1185 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1186 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1187 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1188 }
1189 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1178 for(sal_uInt16 a(0); !bIsCurve && a < rPolyPoly.Count(); a++)
1179 {
1180 if(rPolyPoly[a].HasFlags())
1181 {
1182 bIsCurve = true;
1183 }
1184 }
1190
1185
1191 if( ( rHatch.GetStyle() == HATCH_DOUBLE ) || ( rHatch.GetStyle() == HATCH_TRIPLE ) )
1192 {
1193 // Double hatch
1194 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
1195 do
1196 {
1197 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1198 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1199 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1200 }
1201 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1186 if(bIsCurve)
1187 {
1188 OSL_ENSURE(false, "ImplDrawHatch does *not* support curves, falling back to AdaptiveSubdivide()...");
1189 PolyPolygon aPolyPoly;
1202
1190
1203 if( rHatch.GetStyle() == HATCH_TRIPLE )
1204 {
1205 // Triple hatch
1206 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
1207 do
1208 {
1209 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1210 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1211 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1212 }
1213 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1214 }
1215 }
1191 rPolyPoly.AdaptiveSubdivide(aPolyPoly);
1192 ImplDrawHatch(aPolyPoly, rHatch, bMtf);
1193 }
1194 else
1195 {
1196 Rectangle aRect( rPolyPoly.GetBoundRect() );
1197 const long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 );
1198 const long nWidth = ImplDevicePixelToLogicWidth( Max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), 3L ) );
1199 Point* pPtBuffer = new Point[ HATCH_MAXPOINTS ];
1200 Point aPt1, aPt2, aEndPt1;
1201 Size aInc;
1216
1202
1217 delete[] pPtBuffer;
1203 // Single hatch
1204 aRect.Left() -= nLogPixelWidth; aRect.Top() -= nLogPixelWidth; aRect.Right() += nLogPixelWidth; aRect.Bottom() += nLogPixelWidth;
1205 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle(), aPt1, aPt2, aInc, aEndPt1 );
1206 do
1207 {
1208 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1209 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1210 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1211 }
1212 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1213
1214 if( ( rHatch.GetStyle() == HATCH_DOUBLE ) || ( rHatch.GetStyle() == HATCH_TRIPLE ) )
1215 {
1216 // Double hatch
1217 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
1218 do
1219 {
1220 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1221 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1222 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1223 }
1224 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1225
1226 if( rHatch.GetStyle() == HATCH_TRIPLE )
1227 {
1228 // Triple hatch
1229 ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
1230 do
1231 {
1232 ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
1233 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
1234 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
1235 }
1236 while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
1237 }
1238 }
1239
1240 delete[] pPtBuffer;
1241 }
1242 }
1218}
1219
1220// -----------------------------------------------------------------------
1221
1222void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10,
1223 Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 )
1224{
1225 Point aRef;

--- 193 unchanged lines hidden ---
1243}
1244
1245// -----------------------------------------------------------------------
1246
1247void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10,
1248 Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 )
1249{
1250 Point aRef;

--- 193 unchanged lines hidden ---