polygonprimitive2d.cxx (464702f4) | polygonprimitive2d.cxx (5aaf853b) |
---|---|
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 --- 18 unchanged lines hidden (view full) --- 27#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 28#include <basegfx/tools/canvastools.hxx> 29#include <basegfx/polygon/b2dpolygontools.hxx> 30#include <basegfx/polygon/b2dpolypolygontools.hxx> 31#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 32#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> 33#include <drawinglayer/geometry/viewinformation2d.hxx> 34#include <basegfx/polygon/b2dlinegeometry.hxx> | 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 --- 18 unchanged lines hidden (view full) --- 27#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 28#include <basegfx/tools/canvastools.hxx> 29#include <basegfx/polygon/b2dpolygontools.hxx> 30#include <basegfx/polygon/b2dpolypolygontools.hxx> 31#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 32#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> 33#include <drawinglayer/geometry/viewinformation2d.hxx> 34#include <basegfx/polygon/b2dlinegeometry.hxx> |
35#include <com/sun/star/drawing/LineCap.hpp> |
|
35 36////////////////////////////////////////////////////////////////////////////// 37 38using namespace com::sun::star; 39 40////////////////////////////////////////////////////////////////////////////// 41 42namespace drawinglayer --- 204 unchanged lines hidden (view full) --- 247 248 const sal_uInt32 nCount(aHairLinePolyPolygon.count()); 249 250 if(!getLineAttribute().isDefault() && getLineAttribute().getWidth()) 251 { 252 // create fat line data 253 const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); 254 const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin()); | 36 37////////////////////////////////////////////////////////////////////////////// 38 39using namespace com::sun::star; 40 41////////////////////////////////////////////////////////////////////////////// 42 43namespace drawinglayer --- 204 unchanged lines hidden (view full) --- 248 249 const sal_uInt32 nCount(aHairLinePolyPolygon.count()); 250 251 if(!getLineAttribute().isDefault() && getLineAttribute().getWidth()) 252 { 253 // create fat line data 254 const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); 255 const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin()); |
256 const com::sun::star::drawing::LineCap aLineCap(getLineAttribute().getLineCap()); |
|
255 basegfx::B2DPolyPolygon aAreaPolyPolygon; 256 257 for(sal_uInt32 a(0L); a < nCount; a++) 258 { 259 // New version of createAreaGeometry; now creates bezier polygons 260 aAreaPolyPolygon.append(basegfx::tools::createAreaGeometry( | 257 basegfx::B2DPolyPolygon aAreaPolyPolygon; 258 259 for(sal_uInt32 a(0L); a < nCount; a++) 260 { 261 // New version of createAreaGeometry; now creates bezier polygons 262 aAreaPolyPolygon.append(basegfx::tools::createAreaGeometry( |
261 aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin)); | 263 aHairLinePolyPolygon.getB2DPolygon(a), 264 fHalfLineWidth, 265 aLineJoin, 266 aLineCap)); |
262 } 263 264 // prepare return value 265 Primitive2DSequence aRetval(aAreaPolyPolygon.count()); 266 267 // create primitive 268 for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++) 269 { --- 64 unchanged lines hidden (view full) --- 334 } 335 336 basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const 337 { 338 basegfx::B2DRange aRetval; 339 340 if(getLineAttribute().getWidth()) 341 { | 267 } 268 269 // prepare return value 270 Primitive2DSequence aRetval(aAreaPolyPolygon.count()); 271 272 // create primitive 273 for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++) 274 { --- 64 unchanged lines hidden (view full) --- 339 } 340 341 basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const 342 { 343 basegfx::B2DRange aRetval; 344 345 if(getLineAttribute().getWidth()) 346 { |
347 bool bUseDecomposition(false); 348 |
|
342 if(basegfx::B2DLINEJOIN_MITER == getLineAttribute().getLineJoin()) 343 { 344 // if line is mitered, use parent call since mitered line 345 // geometry may use more space than the geometry grown by half line width | 349 if(basegfx::B2DLINEJOIN_MITER == getLineAttribute().getLineJoin()) 350 { 351 // if line is mitered, use parent call since mitered line 352 // geometry may use more space than the geometry grown by half line width |
346 aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); | 353 bUseDecomposition = true; |
347 } | 354 } |
355 356 if(!bUseDecomposition && com::sun::star::drawing::LineCap_SQUARE == getLineAttribute().getLineCap()) 357 { 358 // when drawing::LineCap_SQUARE is used the below method to grow the polygon 359 // range by half line width will not work, so use decomposition. Interestingly, 360 // the grow method below works perfectly for LineCap_ROUND since the grow is in 361 // all directions and the rounded cap needs the same grow in all directions independent 362 // from it's orientation. Unfortunately this is not the case for drawing::LineCap_SQUARE 363 bUseDecomposition = true; 364 } 365 366 if(bUseDecomposition) 367 { 368 // get correct range by using the decomposition fallback, reasons see above cases 369 aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); 370 } |
|
348 else 349 { 350 // for all other B2DLINEJOIN_* get the range from the base geometry 351 // and expand by half the line width 352 aRetval = getB2DPolygon().getB2DRange(); 353 aRetval.grow(getLineAttribute().getWidth() * 0.5); 354 } 355 } --- 279 unchanged lines hidden --- | 371 else 372 { 373 // for all other B2DLINEJOIN_* get the range from the base geometry 374 // and expand by half the line width 375 aRetval = getB2DPolygon().getB2DRange(); 376 aRetval.grow(getLineAttribute().getWidth() * 0.5); 377 } 378 } --- 279 unchanged lines hidden --- |