summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-23 12:46:28 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-12 14:31:10 +0100
commite717d1dcce7f8906311c5ccdbb2326b61a702630 (patch)
tree91290db5179fa4b4927af94c0f023f40dcda434c /vcl/inc
parent9e50e5f82927742c56e89258b80bc8cd93bb7e3b (diff)
Resolves: #i121237# Rework/Cleanup of Region code...
due to missing complete support for B2DPolygon class (cherry picked from commit cab10eeb7878edf224a004fd7640bd4adf8d3c51) Conflicts: cppcanvas/source/mtfrenderer/implrenderer.cxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/svdraw/svdpntv.cxx vcl/aqua/source/gdi/salgdi.cxx vcl/inc/region.h vcl/inc/unx/gtk/gtkgdi.hxx vcl/inc/vcl/regband.hxx vcl/inc/vcl/region.hxx vcl/os2/source/gdi/salgdi.cxx vcl/source/gdi/bmpacc3.cxx vcl/source/gdi/outdev2.cxx vcl/source/gdi/outmap.cxx vcl/source/gdi/regband.cxx vcl/source/gdi/region.cxx vcl/source/window/window.cxx vcl/unx/generic/gdi/pspgraphics.cxx vcl/unx/headless/svpgdi.cxx vcl/unx/headless/svppspgraphics.cxx vcl/win/source/gdi/salgdi.cxx Change-Id: Iee9a66ff431c3cecb7603e445147b67715de0f7d Remove unused variable to prevent compiler warning (cherry picked from commit 0ac65ccf079e3e22ac23cbe7ae546504c863c31f) Change-Id: Icbcaa9d576a7e560d96debc7360bdbe9090b3fd3 Wrong comparison with bool corrected (cherry picked from commit 612cefdcf6176b6bb847ce899d89af40ef313a90) Change-Id: I1cf5de6734b588f78d8e870ba7b7860634b461ce
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/region.h128
-rw-r--r--vcl/inc/regionband.hxx83
2 files changed, 83 insertions, 128 deletions
diff --git a/vcl/inc/region.h b/vcl/inc/region.h
deleted file mode 100644
index 457bb1e6fa79..000000000000
--- a/vcl/inc/region.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _SV_REGION_H
-#define _SV_REGION_H
-
-#include <vcl/regband.hxx>
-#include <tools/poly.hxx>
-#include <vcl/region.hxx>
-
-// -----------------
-// - Hilfsmethoden -
-// -----------------
-
-#ifdef DBG_UTIL
-const char* ImplDbgTestRegion( const void* pObj );
-#endif
-
-// --------------------
-// - ImplRegionHandle -
-// --------------------
-
-struct ImplRegionHandle
-{
- Region* mpRegion;
- ImplRegionBand* mpCurrRectBand;
- ImplRegionBandSep* mpCurrRectBandSep;
- sal_Bool mbFirst;
-};
-
-// ------------------
-// - ImplRegionInfo -
-// ------------------
-
-struct ImplRegionInfo
-{
- void* mpVoidCurrRectBand;
- void* mpVoidCurrRectBandSep;
-};
-
-// --------------
-// - ImplRegion -
-// --------------
-
-struct ImplRegionBase
-{
-public:
- ImplRegionBase( int nCount = 1 ); // TODO: replace manual refcounting
- virtual ~ImplRegionBase();
-public:
- sal_uIntPtr mnRefCount;
- sal_uIntPtr mnRectCount;
- PolyPolygon* mpPolyPoly;
- basegfx::B2DPolyPolygon* mpB2DPolyPoly;
-};
-
-class ImplRegion : public ImplRegionBase
-{
- friend class Region;
-
-private:
- ImplRegionBand* mpFirstBand; // root of the list with y-bands
- ImplRegionBand* mpLastCheckedBand;
-
-public:
- ImplRegion();
- ImplRegion( const PolyPolygon& rPolyPoly );
- ImplRegion( const basegfx::B2DPolyPolygon& );
- ImplRegion( const ImplRegion& rImplRegion );
- ~ImplRegion();
-
- ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; }
- PolyPolygon* ImplGetPolyPoly() const { return mpPolyPoly; }
-
- void CreateBandRange( long nYTop, long nYBottom );
- void InsertBands( long nYTop, long nYBottom );
- sal_Bool InsertSingleBand( ImplRegionBand* mpImplRegionBand,
- long nYBandPosition );
- sal_Bool InsertLine( const Point & rFirstPoint,
- const Point & rSecondPoint,
- long nLineID );
- sal_Bool InsertPoint( const Point &rPoint,
- long nLineID,
- sal_Bool bEndPoint, LineType eLineType );
-
- /** Insert one band either after another band or as the first or only
- band. Both the forward as well as the backward links are updated.
- @param pPreviousBand
- When <NULL/> then pBandToInsert is inserted as first band or as
- only band when there are no other bands.
- When not <NULL/> then pBandToInsert is inserted directly after
- pPreviousBand.
- @param pBandToInsert
- The band to insert.
- */
- void InsertBand (ImplRegionBand* pPreviousBand,
- ImplRegionBand* pBandToInsert);
-
- void Union( long nLeft, long nTop, long nRight, long nBottom );
- void Exclude( long nLeft, long nTop, long nRight, long nBottom );
- void XOr( long nLeft, long nTop, long nRight, long nBottom );
-
- // remove emtpy rects
- sal_Bool OptimizeBandList();
-
- friend SvStream& operator>>( SvStream& rIStm, Region& rRegion );
- friend SvStream& operator<<( SvStream& rOStm, const Region& rRegion );
-};
-
-#endif // _SV_REGION_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/regionband.hxx b/vcl/inc/regionband.hxx
new file mode 100644
index 000000000000..89657036adff
--- /dev/null
+++ b/vcl/inc/regionband.hxx
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SV_REGIONBAND_HXX
+#define _SV_REGIONBAND_HXX
+
+#include <vcl/regband.hxx>
+#include <vcl/region.hxx>
+
+#ifdef DBG_UTIL
+const char* ImplDbgTestRegionBand(const void*);
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+class RegionBand
+{
+private:
+ friend const char* ImplDbgTestRegionBand(const void*);
+
+ ImplRegionBand* mpFirstBand; // root of the list with y-bands
+ ImplRegionBand* mpLastCheckedBand;
+
+ void implReset();
+
+public:
+ RegionBand();
+ RegionBand(const RegionBand&);
+ RegionBand& operator=(const RegionBand&);
+ RegionBand(const Rectangle&);
+ ~RegionBand();
+
+ bool operator==( const RegionBand& rRegionBand ) const;
+ bool operator!=( const RegionBand& rRegionBand ) const { return !(RegionBand::operator==( rRegionBand )); }
+
+ void load(SvStream& rIStrm);
+ void save(SvStream& rIStrm) const;
+
+ bool isSingleRectangle() const;
+ ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; }
+ void ImplAddMissingBands(const long nTop, const long nBottom);
+ void InsertBand(ImplRegionBand* pPreviousBand, ImplRegionBand* pBandToInsert);
+ void processPoints();
+ void CreateBandRange(long nYTop, long nYBottom);
+ bool InsertLine(const Point& rStartPt, const Point& rEndPt, long nLineId);
+ bool InsertPoint(const Point &rPoint, long nLineID, bool bEndPoint, LineType eLineType);
+ bool OptimizeBandList();
+ void Move(long nHorzMove, long nVertMove);
+ void Scale(double fScaleX, double fScaleY);
+ void InsertBands(long nTop, long nBottom);
+ bool InsertSingleBand(ImplRegionBand* pBand, long nYBandPosition);
+ void Union(long nLeft, long nTop, long nRight, long nBottom);
+ void Intersect(long nLeft, long nTop, long nRight, long nBottom);
+ void Union(const RegionBand& rSource);
+ void Exclude(long nLeft, long nTop, long nRight, long nBottom);
+ void XOr(long nLeft, long nTop, long nRight, long nBottom);
+ void Intersect(const RegionBand& rSource);
+ bool Exclude(const RegionBand& rSource);
+ void XOr(const RegionBand& rSource);
+ Rectangle GetBoundRect() const;
+ bool IsInside(const Point& rPoint) const;
+ sal_uInt32 getRectangleCount() const; // only users are Region::Intersect and PSWriter::ImplBmp
+ void GetRegionRectangles(RectangleVector& rTarget) const;
+};
+
+#endif // _SV_REGIONBAND_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+//eof