1*25ea7f45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*25ea7f45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*25ea7f45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*25ea7f45SAndrew Rist * distributed with this work for additional information 6*25ea7f45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*25ea7f45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*25ea7f45SAndrew Rist * "License"); you may not use this file except in compliance 9*25ea7f45SAndrew Rist * with the License. You may obtain a copy of the License at 10*25ea7f45SAndrew Rist * 11*25ea7f45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*25ea7f45SAndrew Rist * 13*25ea7f45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*25ea7f45SAndrew Rist * software distributed under the License is distributed on an 15*25ea7f45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*25ea7f45SAndrew Rist * KIND, either express or implied. See the License for the 17*25ea7f45SAndrew Rist * specific language governing permissions and limitations 18*25ea7f45SAndrew Rist * under the License. 19*25ea7f45SAndrew Rist * 20*25ea7f45SAndrew Rist *************************************************************/ 21*25ea7f45SAndrew Rist 22*25ea7f45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_canvas.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx> 28cdf0e10cSrcweir #include "dx_linepolypolygon.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir using namespace ::com::sun::star; 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace dxcanvas 34cdf0e10cSrcweir { LinePolyPolygon(const::basegfx::B2DPolyPolygon & rPolyPoly)35cdf0e10cSrcweir LinePolyPolygon::LinePolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ) : 36cdf0e10cSrcweir ::basegfx::unotools::UnoPolyPolygon( rPolyPoly ), 37cdf0e10cSrcweir mpGdiPlusUser( GDIPlusUser::createInstance() ), 38cdf0e10cSrcweir mpPath() 39cdf0e10cSrcweir { 40cdf0e10cSrcweir } 41cdf0e10cSrcweir getGraphicsPath(bool bNoLineJoin) const42cdf0e10cSrcweir GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const 43cdf0e10cSrcweir { 44cdf0e10cSrcweir // generate GraphicsPath only on demand (gets deleted as soon 45cdf0e10cSrcweir // as any of the modifying methods above touches the 46cdf0e10cSrcweir // B2DPolyPolygon). 47cdf0e10cSrcweir if( !mpPath ) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin ); 50cdf0e10cSrcweir mpPath->SetFillMode( const_cast<LinePolyPolygon*>(this)->getFillRule() == rendering::FillRule_EVEN_ODD ? 51cdf0e10cSrcweir Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding ); 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir return mpPath; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir modifying() const57cdf0e10cSrcweir void LinePolyPolygon::modifying() const 58cdf0e10cSrcweir { 59cdf0e10cSrcweir mpPath.reset(); 60cdf0e10cSrcweir } 61cdf0e10cSrcweir } 62