build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / drawinglayer / primitive2d / patternfillprimitive2d.hxx
blob11d064737c45803ca97b6fba1dd3b91cf0bb01fd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 namespace drawinglayer
31 namespace primitive2d
33 /** PatternFillPrimitive2D class
35 This primitive allows filling a given tools::PolyPolygon with a pattern
36 defined by a sequence of primitives which are mapped to the unit range.
37 The pattern is defined using a reference range which defines a rectangular
38 area relative to the tools::PolyPolygon (in unit coordinates) which is virtually
39 infinitely repeated.
41 class DRAWINGLAYER_DLLPUBLIC PatternFillPrimitive2D : public BufferedDecompositionPrimitive2D
43 private:
44 const basegfx::B2DPolyPolygon maMask;
45 const Primitive2DContainer maChildren;
46 const basegfx::B2DRange maReferenceRange;
48 /// values holding the discrete buffer size
49 sal_uInt32 mnDiscreteWidth;
50 sal_uInt32 mnDiscreteHeight;
52 /// helper that is capable to calculate the needed discrete buffer size for
53 /// eventually buffered content
54 void calculateNeededDiscreteBufferSize(
55 sal_uInt32& rWidth,
56 sal_uInt32& rHeight,
57 const geometry::ViewInformation2D& rViewInformation) const;
59 /// helper which creates the content - checks if clipping is needed and eventually
60 /// creates buffered content to speed up rendering
61 Primitive2DContainer createContent(const geometry::ViewInformation2D& rViewInformation) const;
63 protected:
64 /// create local decomposition
65 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
67 public:
68 /// constructor
69 PatternFillPrimitive2D(
70 const basegfx::B2DPolyPolygon& rMask,
71 const Primitive2DContainer& rChildren,
72 const basegfx::B2DRange& rReferenceRange);
74 /// data read access
75 const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
76 const Primitive2DContainer& getChildren() const { return maChildren; }
77 const basegfx::B2DRange& getReferenceRange() const { return maReferenceRange; }
79 /// compare operator
80 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
82 /// get range
83 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
85 /// overload to react on evtl. buffered content
86 virtual void get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
88 /// provide unique ID
89 DeclPrimitive2DIDBlock()
91 // XAccounting
92 virtual sal_Int64 SAL_CALL estimateUsage() throw (css::uno::RuntimeException) override;
94 } // end of namespace primitive2d
95 } // end of namespace drawinglayer
98 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */