diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-05 13:44:12 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-05 13:44:12 +0000 |
commit | db75fe5503d06675e3c57349c2201ea42daab83a (patch) | |
tree | eae8d4dcba9c37c7f725462e3fc6fc9bfa7efb16 /drawinglayer | |
parent | ab9bee4720820ebd1a2d851bcb4f7db79145931e (diff) |
CWS-TOOLING: integrate CWS aw059
2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways
2008-12-15 16:49:58 +0100 wg r265512 : i97278
2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks!
2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas
2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case
2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes.
2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly
2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed
2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround
2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning
2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW
2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction
2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints
2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA
2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA
2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag
2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected
2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support
2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL
2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL
2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL
2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE
2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border
2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D
2008-12-08 12:15:10 +0100 ufi r264987 : aw059
2008-12-08 12:14:40 +0100 ufi r264986 : aw059
2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37)
2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning
2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32
2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available
2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay
2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay
2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer
2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01
2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers
2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check.
2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA
2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive
2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities
2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities
2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities
2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities
2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit
2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM
2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32
2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected
2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected
2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output
2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays
2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes
2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries
2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries
2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation
2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel
2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging
2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation
2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw
2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning
2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones
2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones
2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones
2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier
2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot
2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot
2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot
2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot
2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot
2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot
2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot
2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot
2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build
2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build
2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build
2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working
2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working
2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working
2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working
2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working
2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing
2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment
2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment
2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change
2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change
2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change
2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change
2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
Diffstat (limited to 'drawinglayer')
20 files changed, 477 insertions, 330 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 926ecfe96137..9e3e322a3ac4 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -99,6 +99,7 @@ #define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) #define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) #define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) +#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) #define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index ff0356f07988..f0aad415bfce 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -39,6 +39,7 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/color/bcolor.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// // GridPrimitive2D class @@ -58,6 +59,7 @@ namespace drawinglayer sal_uInt32 mnSubdivisionsX; sal_uInt32 mnSubdivisionsY; basegfx::BColor maBColor; + BitmapEx maCrossMarker; // the last used object to view transformtion and the last Viewport, // used from getDecomposition for decide buffering @@ -77,7 +79,8 @@ namespace drawinglayer double fSmallestSubdivisionViewDistance, sal_uInt32 nSubdivisionsX, sal_uInt32 nSubdivisionsY, - const basegfx::BColor& rBColor); + const basegfx::BColor& rBColor, + const BitmapEx& rCrossMarker); // get data const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } @@ -88,6 +91,7 @@ namespace drawinglayer sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; } sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; } const basegfx::BColor& getBColor() const { return maBColor; } + const BitmapEx& getCrossMarker() const { return maCrossMarker; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index a5927d41b3a6..4e8357a3eac1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -61,7 +61,7 @@ namespace drawinglayer HelplineStyle2D meStyle; basegfx::BColor maRGBColA; basegfx::BColor maRGBColB; - double mfViewDashLength; + double mfDiscreteDashLength; // the last used object to view transformtion and the last Viewport, // used from getDecomposition for decide buffering @@ -79,7 +79,7 @@ namespace drawinglayer HelplineStyle2D eStyle, const basegfx::BColor& rRGBColA, const basegfx::BColor& aRGBColB, - double fViewDashLength); + double fDiscreteDashLength); // get data const basegfx::B2DPoint getPosition() const { return maPosition; } @@ -87,7 +87,7 @@ namespace drawinglayer HelplineStyle2D getStyle() const { return meStyle; } const basegfx::BColor& getRGBColA() const { return maRGBColA; } const basegfx::BColor& getRGBColB() const { return maRGBColB; } - double getViewDashLength() const { return mfViewDashLength; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index f19b2562e547..350471f4aff3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -38,6 +38,7 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/color/bcolor.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// // MarkerPrimitive2D class @@ -46,25 +47,11 @@ namespace drawinglayer { namespace primitive2d { - enum MarkerStyle2D - { - /// Point: Uses RGBColor, 1x1 pixel - MARKERSTYLE2D_POINT, - - /// Cross: Uses RGBColor, 3x3 pixel, centered, form of a plus sign - MARKERSTYLE2D_CROSS, - - /// Gluepoint: Uses RGBColor as outline and hardcoded COL_LIGHTBLUE as inner - /// line pen, 7x7 pixel, centered, looks like a x with thee pixel lines - MARKERSTYLE2D_GLUEPOINT - }; - class MarkerArrayPrimitive2D : public BasePrimitive2D { private: std::vector< basegfx::B2DPoint > maPositions; - basegfx::BColor maRGBColor; - MarkerStyle2D meStyle; + BitmapEx maMarker; protected: // create local decomposition @@ -73,13 +60,11 @@ namespace drawinglayer public: MarkerArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, - MarkerStyle2D eStyle, - const basegfx::BColor& rRGBColor); + const BitmapEx& rMarker); // get data const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; } - const basegfx::BColor& getRGBColor() const { return maRGBColor; } - MarkerStyle2D getStyle() const { return meStyle; } + const BitmapEx& getMarker() const { return maMarker; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index bbe382219f49..48ec5e80aa09 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -40,6 +40,7 @@ #include <drawinglayer/attribute/lineattribute.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> #include <drawinglayer/attribute/linestartendattribute.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> ////////////////////////////////////////////////////////////////////////////// // PolygonHairlinePrimitive2D class @@ -86,7 +87,10 @@ namespace drawinglayer basegfx::B2DPolygon maPolygon; basegfx::BColor maRGBColorA; basegfx::BColor maRGBColorB; - double mfDashLength; + double mfDiscreteDashLength; + + // decomposition is view-dependent, remember last InverseObjectToViewTransformation + basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation; protected: // local decomposition. @@ -97,13 +101,13 @@ namespace drawinglayer const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, - double fDashLength); + double fDiscreteDashLength); // get data const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } - double getDashLength() const { return mfDashLength; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; @@ -111,6 +115,9 @@ namespace drawinglayer // get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + // get local decomposition. Overloaded since this decomposition is view-dependent + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index a2e103cd6831..9991a3109e10 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -45,7 +45,7 @@ #include <drawinglayer/attribute/linestartendattribute.hxx> ////////////////////////////////////////////////////////////////////////////// -// PolyPolygonStrokePrimitive2D class +// PolyPolygonHairlinePrimitive2D class namespace drawinglayer { @@ -81,6 +81,50 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +// PolyPolygonMarkerPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + class PolyPolygonMarkerPrimitive2D : public BasePrimitive2D + { + private: + basegfx::B2DPolyPolygon maPolyPolygon; + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + // local decomposition. + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + PolyPolygonMarkerPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // get data + basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// // PolyPolygonStrokePrimitive2D class namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index acac9fa01956..d322ee87b48c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -82,6 +82,9 @@ namespace drawinglayer double getUnderlineHeight() const; double getUnderlineOffset() const; double getStrikeoutOffset() const; +#ifdef WIN32 + double getCurrentFontRelation() const; +#endif double getTextWidth( const String& rText, diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index b8461ae90607..ffceaf8ce04a 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -297,7 +297,18 @@ namespace drawinglayer { const MapMode aMapMode100thmm(MAP_100TH_MM); - const Size aBitmapSize(Application::GetDefaultDevice()->LogicToLogic(getGraphicObject().GetPrefSize(), getGraphicObject().GetPrefMapMode(), aMapMode100thmm)); + Size aBitmapSize(getGraphicObject().GetPrefSize()); + + // #i95968# better support PrefMapMode; special for MAP_PIXEL was missing + if(MAP_PIXEL == getGraphicObject().GetPrefMapMode().GetMapUnit()) + { + aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm); + } + else + { + aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, getGraphicObject().GetPrefMapMode(), aMapMode100thmm); + } + const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop()); const double fDivY(aBitmapSize.Height() - getGraphicAttr().GetTopCrop() - getGraphicAttr().GetBottomCrop()); diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index c122b123fa7b..df4171309389 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -175,7 +175,7 @@ namespace drawinglayer { double fF(fX + fSmallStepX); - for(sal_uInt32 a(0L); a < nSmallStepsX && fF < aScale.getX(); a++, fF += fSmallStepX) + for(sal_uInt32 a(1L); a < nSmallStepsX && fF < aScale.getX(); a++, fF += fSmallStepX) { const basegfx::B2DPoint aViewPos(aRST * basegfx::B2DPoint(fF, fY)); @@ -191,7 +191,7 @@ namespace drawinglayer { double fF(fY + fSmallStepY); - for(sal_uInt32 a(0L); a < nSmallStepsY && fF < aScale.getY(); a++, fF += fSmallStepY) + for(sal_uInt32 a(1L); a < nSmallStepsY && fF < aScale.getY(); a++, fF += fSmallStepY) { const basegfx::B2DPoint aViewPos(aRST * basegfx::B2DPoint(fX, fF)); @@ -222,7 +222,16 @@ namespace drawinglayer // add MarkerArrayPrimitive2D if cross markers were added if(nCountCross) { - aRetval[nInsertCounter++] = Primitive2DReference(new MarkerArrayPrimitive2D(aPositionsCross, MARKERSTYLE2D_CROSS, getBColor())); + if(!getSubdivisionsX() && !getSubdivisionsY()) + { + // no subdivisions, so fall back to points at grid positions, no need to + // visualize a difference between divisions and sub-divisions + aRetval[nInsertCounter++] = Primitive2DReference(new PointArrayPrimitive2D(aPositionsCross, getBColor())); + } + else + { + aRetval[nInsertCounter++] = Primitive2DReference(new MarkerArrayPrimitive2D(aPositionsCross, getCrossMarker())); + } } } @@ -237,7 +246,8 @@ namespace drawinglayer double fSmallestSubdivisionViewDistance, sal_uInt32 nSubdivisionsX, sal_uInt32 nSubdivisionsY, - const basegfx::BColor& rBColor) + const basegfx::BColor& rBColor, + const BitmapEx& rCrossMarker) : BasePrimitive2D(), maTransform(rTransform), mfWidth(fWidth), @@ -247,6 +257,7 @@ namespace drawinglayer mnSubdivisionsX(nSubdivisionsX), mnSubdivisionsY(nSubdivisionsY), maBColor(rBColor), + maCrossMarker(rCrossMarker), maLastObjectToViewTransformation(), maLastViewport() { @@ -265,7 +276,8 @@ namespace drawinglayer && getSmallestSubdivisionViewDistance() == rCompare.getSmallestSubdivisionViewDistance() && getSubdivisionsX() == rCompare.getSubdivisionsX() && getSubdivisionsY() == rCompare.getSubdivisionsY() - && getBColor() == rCompare.getBColor()); + && getBColor() == rCompare.getBColor() + && getCrossMarker() == rCompare.getCrossMarker()); } return false; diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index 510d55d8337c..3232e635b561 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -62,8 +62,6 @@ namespace drawinglayer { // position to view coordinates, DashLen and DashLen in logic const basegfx::B2DPoint aViewPosition(rViewInformation.getObjectToViewTransformation() * getPosition()); - const double fLogicDashLen((rViewInformation.getInverseObjectToViewTransformation() * - basegfx::B2DVector(getViewDashLength(), 0.0)).getLength()); switch(getStyle()) { @@ -79,7 +77,7 @@ namespace drawinglayer aLineA.append(aStartA); aLineA.append(aEndA); aLineA.transform(rViewInformation.getInverseObjectToViewTransformation()); - PolygonMarkerPrimitive2D* pNewA = new PolygonMarkerPrimitive2D(aLineA, getRGBColA(), getRGBColB(), fLogicDashLen); + PolygonMarkerPrimitive2D* pNewA = new PolygonMarkerPrimitive2D(aLineA, getRGBColA(), getRGBColB(), getDiscreteDashLength()); aTempPrimitiveTarget.push_back(pNewA); const basegfx::B2DVector aPerpendicularNormalizedDirection(basegfx::getPerpendicular(aNormalizedDirection)); @@ -89,7 +87,7 @@ namespace drawinglayer aLineB.append(aStartB); aLineB.append(aEndB); aLineB.transform(rViewInformation.getInverseObjectToViewTransformation()); - PolygonMarkerPrimitive2D* pNewB = new PolygonMarkerPrimitive2D(aLineB, getRGBColA(), getRGBColB(), fLogicDashLen); + PolygonMarkerPrimitive2D* pNewB = new PolygonMarkerPrimitive2D(aLineB, getRGBColA(), getRGBColB(), getDiscreteDashLength()); aTempPrimitiveTarget.push_back(pNewB); break; @@ -140,7 +138,7 @@ namespace drawinglayer { basegfx::B2DPolygon aPart(aResult.getB2DPolygon(a)); aPart.transform(rViewInformation.getInverseObjectToViewTransformation()); - PolygonMarkerPrimitive2D* pNew = new PolygonMarkerPrimitive2D(aPart, getRGBColA(), getRGBColB(), fLogicDashLen); + PolygonMarkerPrimitive2D* pNew = new PolygonMarkerPrimitive2D(aPart, getRGBColA(), getRGBColB(), getDiscreteDashLength()); aTempPrimitiveTarget.push_back(pNew); } } @@ -168,14 +166,14 @@ namespace drawinglayer HelplineStyle2D eStyle, const basegfx::BColor& rRGBColA, const basegfx::BColor& rRGBColB, - double fViewDashLength) + double fDiscreteDashLength) : BasePrimitive2D(), maPosition(rPosition), maDirection(rDirection), meStyle(eStyle), maRGBColA(rRGBColA), maRGBColB(rRGBColB), - mfViewDashLength(fViewDashLength), + mfDiscreteDashLength(fDiscreteDashLength), maLastObjectToViewTransformation(), maLastViewport() { @@ -192,7 +190,7 @@ namespace drawinglayer && getStyle() == rCompare.getStyle() && getRGBColA() == rCompare.getRGBColA() && getRGBColB() == rCompare.getRGBColB() - && getViewDashLength() == rCompare.getViewDashLength()); + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); } return false; diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 78aa04d85a03..5737b9ef6cec 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -38,12 +38,12 @@ #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -58,121 +58,39 @@ namespace drawinglayer Primitive2DSequence MarkerArrayPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval; + const std::vector< basegfx::B2DPoint >& rPositions = getPositions(); + const sal_uInt32 nMarkerCount(rPositions.size()); - switch(getStyle()) + if(nMarkerCount && !getMarker().IsEmpty()) { - default : // MARKERSTYLE2D_POINT - { - // the default produces single points in given color, thus it is a good fallback for - // all evtl. non-implented decompositions, too - const Primitive2DReference xReference(new PointArrayPrimitive2D(getPositions(), getRGBColor())); - xRetval = Primitive2DSequence(&xReference, 1); - break; - } - case MARKERSTYLE2D_CROSS : - case MARKERSTYLE2D_GLUEPOINT : + // get pixel size + Size aBitmapSize(getMarker().GetSizePixel()); + + if(aBitmapSize.Width() && aBitmapSize.Height()) { - // schema to use here: create one ZeroPoint-centered template incarnation of the marker using other primitives - // and multiply it using a seuence of TransformPrimitive2D containing it - const std::vector< basegfx::B2DPoint >& rPositions = getPositions(); - const sal_uInt32 nMarkerCount(rPositions.size()); + // get logic half pixel size + basegfx::B2DVector aLogicHalfSize(rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector(aBitmapSize.getWidth() - 1.0, aBitmapSize.getHeight() - 1.0)); + + // use half size for expand + aLogicHalfSize *= 0.5; + + // number of primitives is known; realloc accordingly + xRetval.realloc(nMarkerCount); - if(nMarkerCount) + for(sal_uInt32 a(0); a < nMarkerCount; a++) { - // get the size of one dicscrete display unit in logic size - const basegfx::B2DVector aDist(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - Primitive2DSequence aTemplate; - - switch(getStyle()) - { - case MARKERSTYLE2D_CROSS : - { - // two lines forming the intended cross. Prefer vector decompose - // over also possible bitmap/PointArrayPrimitive decompose for better quality. - // Also make the discrete unit based lines one pixel longer since non-closed - // polygon primitives will be rendered without the last point by convention - aTemplate.realloc(2); - basegfx::B2DPolygon aPolygon; - - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -1.0, 0.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 2.0, 0.0)); - aTemplate[0] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(0.0, aDist.getY() * -1.0)); - aPolygon.append(basegfx::B2DPoint(0.0, aDist.getY() * 2.0)); - aTemplate[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - break; - } - case MARKERSTYLE2D_GLUEPOINT : - { - // six lines forming the intended gluepoint cross. Prefer vector decompose - // over also possible bitmap/PointArrayPrimitive decompose for better quality - // Also make the discrete unit based lines one pixel longer since non-closed - // polygon primitives will be rendered without the last point by convention - aTemplate.realloc(6); - basegfx::B2DPolygon aPolygon; - - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -2.0, aDist.getY() * -3.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 4.0, aDist.getY() * 3.0)); - aTemplate[0] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -3.0, aDist.getY() * -2.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 3.0, aDist.getY() * 4.0)); - aTemplate[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -3.0, aDist.getY() * 2.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 3.0, aDist.getY() * -4.0)); - aTemplate[2] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -2.0, aDist.getY() * 3.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 4.0, aDist.getY() * -3.0)); - aTemplate[3] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, getRGBColor())); - - const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -2.0, aDist.getY() * -2.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 3.0, aDist.getY() * 3.0)); - aTemplate[4] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aRGBFrontColor)); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * -2.0, aDist.getY() * 2.0)); - aPolygon.append(basegfx::B2DPoint(aDist.getX() * 3.0, aDist.getY() * -3.0)); - aTemplate[5] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aRGBFrontColor)); - - break; - } - default : - { - // nothing to do, keep template empty - break; - } - } - - if(aTemplate.hasElements()) - { - xRetval.realloc(nMarkerCount); - - for(sal_uInt32 a(0); a < nMarkerCount; a++) - { - const basegfx::B2DPoint& rPosition(rPositions[a]); - basegfx::B2DHomMatrix aTransform; - - aTransform.set(0, 2, rPosition.getX()); - aTransform.set(1, 2, rPosition.getY()); - - xRetval[a] = Primitive2DReference(new TransformPrimitive2D(aTransform, aTemplate)); - } - } - - return xRetval; + const basegfx::B2DPoint& rPosition(rPositions[a]); + const basegfx::B2DRange aRange(rPosition - aLogicHalfSize, rPosition + aLogicHalfSize); + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + + xRetval[a] = Primitive2DReference(new BitmapPrimitive2D(getMarker(), aTransform)); } - break; } } @@ -181,12 +99,10 @@ namespace drawinglayer MarkerArrayPrimitive2D::MarkerArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, - MarkerStyle2D eStyle, - const basegfx::BColor& rRGBColor) + const BitmapEx& rMarker) : BasePrimitive2D(), maPositions(rPositions), - maRGBColor(rRGBColor), - meStyle(eStyle) + maMarker(rMarker) { } @@ -197,8 +113,7 @@ namespace drawinglayer const MarkerArrayPrimitive2D& rCompare = (MarkerArrayPrimitive2D&)rPrimitive; return (getPositions() == rCompare.getPositions() - && getRGBColor() == rCompare.getRGBColor() - && getStyle() == rCompare.getStyle()); + && getMarker() == rCompare.getMarker()); } return false; @@ -208,34 +123,32 @@ namespace drawinglayer { basegfx::B2DRange aRetval; - // get the basic range from the position vector - for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) - { - aRetval.expand(*aIter); - } - - switch(getStyle()) + if(getPositions().size()) { - default : // MARKERSTYLE2D_POINT - { - // nothing to do; aRetval is already valid - break; - } - case MARKERSTYLE2D_CROSS : + // get the basic range from the position vector + for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) { - // size is 3x3 centered, expand - const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.5, 1.5)); - aRetval.expand(aRetval.getMinimum() - aDiscreteVector); - aRetval.expand(aRetval.getMinimum() + aDiscreteVector); - break; + aRetval.expand(*aIter); } - case MARKERSTYLE2D_GLUEPOINT : + + if(!getMarker().IsEmpty()) { - // size is 7x7 centered, expand - const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(3.5, 3.5)); - aRetval.expand(aRetval.getMinimum() - aDiscreteVector); - aRetval.expand(aRetval.getMinimum() + aDiscreteVector); - break; + // get pixel size + const Size aBitmapSize(getMarker().GetSizePixel()); + + if(aBitmapSize.Width() && aBitmapSize.Height()) + { + // get logic half size + basegfx::B2DVector aLogicHalfSize(rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector(aBitmapSize.getWidth(), aBitmapSize.getHeight())); + + // use half size for expand + aLogicHalfSize *= 0.5; + + // apply aLogicHalfSize + aRetval.expand(aRetval.getMinimum() - aLogicHalfSize); + aRetval.expand(aRetval.getMaximum() + aLogicHalfSize); + } } } diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 958f11bf81ca..a795e84ed433 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -110,18 +110,22 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonMarkerPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolygonMarkerPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - if(getDashLength() > 0.0) + // calculate logic DashLength + const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0)); + const double fLogicDashLength(aDashVector.getX()); + + if(fLogicDashLength > 0.0) { // apply dashing; get line and gap snippets ::std::vector< double > aDash; basegfx::B2DPolyPolygon aDashedPolyPolyA; basegfx::B2DPolyPolygon aDashedPolyPolyB; - aDash.push_back(getDashLength()); - aDash.push_back(getDashLength()); - basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * getDashLength()); + aDash.push_back(fLogicDashLength); + aDash.push_back(fLogicDashLength); + basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * fLogicDashLength); // prepare return value Primitive2DSequence aRetval(2); @@ -142,12 +146,13 @@ namespace drawinglayer const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, - double fDashLength) + double fDiscreteDashLength) : BasePrimitive2D(), maPolygon(rPolygon), maRGBColorA(rRGBColorA), maRGBColorB(rRGBColorB), - mfDashLength(fDashLength) + mfDiscreteDashLength(fDiscreteDashLength), + maLastInverseObjectToViewTransformation() { } @@ -160,16 +165,62 @@ namespace drawinglayer return (getB2DPolygon() == rCompare.getB2DPolygon() && getRGBColorA() == rCompare.getRGBColorA() && getRGBColorB() == rCompare.getRGBColorB() - && getDashLength() == rCompare.getDashLength()); + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); } return false; } - basegfx::B2DRange PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + basegfx::B2DRange PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { + // this is a hairline, thus the line width is view-dependent. Get range of polygon + // as base size + basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange()); + + if(!aRetval.isEmpty()) + { + // Calculate view-dependent hairline width + const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)); + const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5); + + if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0)) + { + aRetval.grow(fDiscreteHalfLineWidth); + } + } + // return range - return basegfx::tools::getRange(getB2DPolygon()); + return aRetval; + } + + Primitive2DSequence PolygonMarkerPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + bool bNeedNewDecomposition(false); + + if(getLocalDecomposition().hasElements()) + { + if(rViewInformation.getInverseObjectToViewTransformation() != maLastInverseObjectToViewTransformation) + { + bNeedNewDecomposition = true; + } + } + + if(bNeedNewDecomposition) + { + // conditions of last local decomposition have changed, delete + const_cast< PolygonMarkerPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); + } + + if(!getLocalDecomposition().hasElements()) + { + // remember last used InverseObjectToViewTransformation + PolygonMarkerPrimitive2D* pThat = const_cast< PolygonMarkerPrimitive2D* >(this); + pThat->maLastInverseObjectToViewTransformation = rViewInformation.getInverseObjectToViewTransformation(); + } + + // use parent implementation + return BasePrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index edb8752d57ba..9dd14aeb11e3 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -117,6 +117,74 @@ namespace drawinglayer { namespace primitive2d { + Primitive2DSequence PolyPolygonMarkerPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); + const sal_uInt32 nCount(aPolyPolygon.count()); + + if(nCount) + { + Primitive2DSequence aRetval(nCount); + + for(sal_uInt32 a(0L); a < nCount; a++) + { + aRetval[a] = Primitive2DReference(new PolygonMarkerPrimitive2D(aPolyPolygon.getB2DPolygon(a), getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + } + + return aRetval; + } + else + { + return Primitive2DSequence(); + } + } + + PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength) + : BasePrimitive2D(), + maPolyPolygon(rPolyPolygon), + maRGBColorA(rRGBColorA), + maRGBColorB(rRGBColorB), + mfDiscreteDashLength(fDiscreteDashLength) + { + } + + bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive; + + return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() + && getRGBColorA() == rCompare.getRGBColorA() + && getRGBColorB() == rCompare.getRGBColorB() + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); + } + + return false; + } + + basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // return range + return basegfx::tools::getRange(getB2DPolyPolygon()); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { Primitive2DSequence PolyPolygonStrokePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 8725323c6bf5..a788416725d9 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -189,6 +189,18 @@ namespace drawinglayer return fRet; } +#ifdef WIN32 + double TextLayouterDevice::getCurrentFontRelation() const + { + const Font aFont(mrDevice.GetFont()); + const FontMetric aFontMetric(mrDevice.GetFontMetric(aFont)); + const double fWidth(aFontMetric.GetWidth()); + const double fHeight(aFont.GetHeight()); + + return basegfx::fTools::equalZero(fWidth) ? 1.0 : fHeight / fWidth; + } +#endif + double TextLayouterDevice::getUnderlineHeight() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index eade0b56addc..c845289dd4f8 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -137,13 +137,22 @@ namespace drawinglayer // the font size. Since we want to extract polygons here, it is okay to // work just with scaling and to ignore shear, rotation and translation, // all that can be applied to the polygons later +#ifdef WIN32 + const bool bCorrectScale(!basegfx::fTools::equal(fabs(aScale.getX()), fabs(aScale.getY()))); +#endif basegfx::B2DVector aFontScale; getCorrectedScaleAndFontScale(aScale, aFontScale); // prepare textlayoutdevice TextLayouterDevice aTextLayouter; aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY()); - +#ifdef WIN32 + // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor + if(bCorrectScale) + { + aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation()); + } +#endif // get the text outlines. No DXArray is given (would contain integers equal to unit vector // transformed by object's transformation), let VCL do the job aTextLayouter.getTextOutlines(rTarget, getText(), getTextPosition(), getTextLength()); @@ -284,6 +293,9 @@ namespace drawinglayer // the font size. Since we want to extract polygons here, it is okay to // work just with scaling and to ignore shear, rotation and translation, // all that can be applied to the polygons later +#ifdef WIN32 + const bool bCorrectScale(!basegfx::fTools::equal(fabs(aScale.getX()), fabs(aScale.getY()))); +#endif basegfx::B2DVector aFontScale; getCorrectedScaleAndFontScale(aScale, aFontScale); @@ -293,7 +305,13 @@ namespace drawinglayer // get basic text range aRetval = aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength()); - +#ifdef WIN32 + // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor + if(bCorrectScale) + { + aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation()); + } +#endif // prepare object transformation for range basegfx::B2DHomMatrix aRangeTransformation; diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx index 7506309967bc..49039e1a6e5c 100644 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx @@ -43,6 +43,7 @@ #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/alphaprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -63,11 +64,29 @@ namespace drawinglayer } else if(getAlpha() > 0.0 && getAlpha() < 1.0) { - // create fill polygon for TransparenceList - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation))); + // The idea is to create a AlphaPrimitive2D with alpha content using a fill color + // corresponding to the alpha value. Problem is that in most systems, the right + // and bottom pixel array is not filled when filling polygons, thus this would not + // always produce a complete alpha bitmap. There are some solutions: + // + // - Grow the used polygon range by one discrete unit in X and Y. This + // will make the decomposition view-dependent. + // + // - For all filled polygon renderings, dra wthe polygon outline extra. This + // would lead to unwanted side effects when using concatenated polygons. + // + // - At this decomposition, add a filled polygon and a hairline polygon. This + // solution stays view-independent. + // + // I will take the last one here. The small overhead of two primitives will only be + // used when UnifiedAlphaPrimitive2D is not handled directly. + const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); const basegfx::BColor aGray(getAlpha(), getAlpha(), getAlpha()); - const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); - const Primitive2DSequence aAlphaContent(&xRefA, 1L); + Primitive2DSequence aAlphaContent(2); + + aAlphaContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); + aAlphaContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); // create sub-transparence group with a gray-colored rectangular fill polygon const Primitive2DReference xRefB(new AlphaPrimitive2D(getChildren(), aAlphaContent)); diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 0fe629545900..4214d9f866c3 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -1313,7 +1313,11 @@ namespace drawinglayer { // get logic range of transparent part, clip with ViewRange basegfx::B2DRange aLogicRange(aMask.getB2DRange()); - aLogicRange.intersect(getViewInformation2D().getViewport()); + + if(!getViewInformation2D().getViewport().isEmpty()) + { + aLogicRange.intersect(getViewInformation2D().getViewport()); + } if(!aLogicRange.isEmpty()) { @@ -1335,9 +1339,12 @@ namespace drawinglayer uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas); const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D()); - // prepare discrete offset for XBitmap + // prepare discrete offset for XBitmap, do not forget that the buffer bitmap + // may be truncated to discrete visible pixels basegfx::B2DHomMatrix aDiscreteOffset; - aDiscreteOffset.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY()); + aDiscreteOffset.translate( + aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0, + aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0); // create new local ViewInformation2D with new transformation const geometry::ViewInformation2D aViewInformation2D( @@ -1623,7 +1630,11 @@ namespace drawinglayer { // get logic range of transparent part and clip with ViewRange basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D())); - aLogicRange.intersect(getViewInformation2D().getViewport()); + + if(!getViewInformation2D().getViewport().isEmpty()) + { + aLogicRange.intersect(getViewInformation2D().getViewport()); + } if(!aLogicRange.isEmpty()) { @@ -1645,9 +1656,12 @@ namespace drawinglayer uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas); const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D()); - // prepare discrete offset for XBitmap + // prepare discrete offset for XBitmap, do not forget that the buffer bitmap + // may be truncated to discrete visible pixels basegfx::B2DHomMatrix aDiscreteOffset; - aDiscreteOffset.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY()); + aDiscreteOffset.translate( + aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0, + aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0); // create new local ViewInformation2D with new transformation const geometry::ViewInformation2D aViewInformation2D( diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 629ad681a41f..9d63bd5c7df6 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -40,6 +40,7 @@ #include <basegfx/range/b2drange.hxx> #include <vcl/bitmapex.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <tools/stream.hxx> ////////////////////////////////////////////////////////////////////////////// // support for rendering Bitmap and BitmapEx contents @@ -103,27 +104,48 @@ namespace drawinglayer const Point aEmptyPoint; const Size aSizePixel(maContent.GetOutputSizePixel()); const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled()); + static bool bDoSaveForVisualControl(false); mrOutDev.EnableMapMode(false); maContent.EnableMapMode(false); Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + if(bDoSaveForVisualControl) + { + SvFileStream aNew((const String&)String(ByteString( "c:\\content.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + aNew << aContent; + } + if(mpAlpha) { mpAlpha->EnableMapMode(false); - AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); + const AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); + + if(bDoSaveForVisualControl) + { + SvFileStream aNew((const String&)String(ByteString( "c:\\alpha.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + aNew << aAlphaMask.GetBitmap(); + } + mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); } else if(mpMask) { mpMask->EnableMapMode(false); - Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); + const Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); + + if(bDoSaveForVisualControl) + { + SvFileStream aNew((const String&)String(ByteString( "c:\\mask.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + aNew << aMask; + } + mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); } else if(0.0 != fTrans) { sal_uInt8 nMaskValue((sal_uInt8)basegfx::fround(fTrans * 255.0)); - AlphaMask aAlphaMask(aSizePixel, &nMaskValue); + const AlphaMask aAlphaMask(aSizePixel, &nMaskValue); mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); } else diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index cebc2d484889..70cb4dcb4b43 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -339,8 +339,12 @@ namespace drawinglayer if(!bControlIsVisibleAsChildWindow) { - // draw it - xControlView->draw(basegfx::fround(aTopLeftPixel.getX()), basegfx::fround(aTopLeftPixel.getY())); + // draw it. Do not forget to use the evtl. offsetted origin of the target device, + // e.g. when used with mask/transparence buffer device + const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin()); + xControlView->draw( + aOrigin.X() + basegfx::fround(aTopLeftPixel.getX()), + aOrigin.Y() + basegfx::fround(aTopLeftPixel.getY())); } // restore original graphics @@ -466,7 +470,7 @@ namespace drawinglayer // create hatch const basegfx::B2DVector aDiscreteDistance(maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0)); - const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getX())); + const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength())); const sal_uInt16 nAngle10((sal_uInt16)basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800)); ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 96ea516ff8e9..9e397e7c36b0 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -246,11 +246,11 @@ namespace drawinglayer { aTransformedDXArray.reserve(rTextCandidate.getDXArray().size()); const basegfx::B2DVector aPixelVector(aLocalTransform * basegfx::B2DVector(1.0, 0.0)); - const double fPixelVectorLength(aPixelVector.getLength()); + const double fPixelVectorFactor(aPixelVector.getLength()); for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin()); aStart != rTextCandidate.getDXArray().end(); aStart++) { - aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorLength)); + aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor)); } } @@ -421,82 +421,70 @@ namespace drawinglayer sal_Int32 nOWidth(aObjBR.X() - aObjTL.X()); sal_Int32 nOHeight(aObjBR.Y() - aObjTL.Y()); - if(nOWidth < 0L) + // only do something when object has a size in discrete units + if(nOWidth > 0 && nOHeight > 0) { - nOWidth = 1L; - } - - if(nOHeight < 0L) - { - nOHeight = 1L; - } - - sal_Int32 nBWidth(aBmpBR.X() - aBmpTL.X()); - sal_Int32 nBHeight(aBmpBR.Y() - aBmpTL.Y()); - - if(nBWidth < 0L) - { - nBWidth = 1L; - } - - if(nBHeight < 0L) - { - nBHeight = 1L; - } + sal_Int32 nBWidth(aBmpBR.X() - aBmpTL.X()); + sal_Int32 nBHeight(aBmpBR.Y() - aBmpTL.Y()); - sal_Int32 nBLeft(aBmpTL.X()); - sal_Int32 nBTop(aBmpTL.Y()); - - if(nBLeft > aObjTL.X()) - { - nBLeft -= ((nBLeft / nBWidth) + 1L) * nBWidth; - } + // only do something when bitmap fill has a size in discrete units + if(nBWidth > 0 && nBHeight > 0) + { + sal_Int32 nBLeft(aBmpTL.X()); + sal_Int32 nBTop(aBmpTL.Y()); - if(nBLeft + nBWidth <= aObjTL.X()) - { - nBLeft -= (nBLeft / nBWidth) * nBWidth; - } + if(nBLeft > aObjTL.X()) + { + nBLeft -= ((nBLeft / nBWidth) + 1L) * nBWidth; + } - if(nBTop > aObjTL.Y()) - { - nBTop -= ((nBTop / nBHeight) + 1L) * nBHeight; - } + if(nBLeft + nBWidth <= aObjTL.X()) + { + nBLeft -= (nBLeft / nBWidth) * nBWidth; + } - if(nBTop + nBHeight <= aObjTL.Y()) - { - nBTop -= (nBTop / nBHeight) * nBHeight; - } + if(nBTop > aObjTL.Y()) + { + nBTop -= ((nBTop / nBHeight) + 1L) * nBHeight; + } - // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it - // in vcl many times, create a size-optimized version - const Size aNeededBitmapSizePixel(nBWidth, nBHeight); + if(nBTop + nBHeight <= aObjTL.Y()) + { + nBTop -= (nBTop / nBHeight) * nBHeight; + } - if(aNeededBitmapSizePixel != aBitmapEx.GetSizePixel()) - { - aBitmapEx.Scale(aNeededBitmapSizePixel); - } + // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it + // in vcl many times, create a size-optimized version + const Size aNeededBitmapSizePixel(nBWidth, nBHeight); - // prepare OutDev - const Point aEmptyPoint(0, 0); - const Rectangle aVisiblePixel(aEmptyPoint, mpOutputDevice->GetOutputSizePixel()); - const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled()); - mpOutputDevice->EnableMapMode(false); + if(aNeededBitmapSizePixel != aBitmapEx.GetSizePixel()) + { + aBitmapEx.Scale(aNeededBitmapSizePixel); + } - for(sal_Int32 nXPos(nBLeft); nXPos < aObjTL.X() + nOWidth; nXPos += nBWidth) - { - for(sal_Int32 nYPos(nBTop); nYPos < aObjTL.Y() + nOHeight; nYPos += nBHeight) - { - const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel); + // prepare OutDev + const Point aEmptyPoint(0, 0); + const Rectangle aVisiblePixel(aEmptyPoint, mpOutputDevice->GetOutputSizePixel()); + const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled()); + mpOutputDevice->EnableMapMode(false); - if(aOutRectPixel.IsOver(aVisiblePixel)) + for(sal_Int32 nXPos(nBLeft); nXPos < aObjTL.X() + nOWidth; nXPos += nBWidth) { - mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx); + for(sal_Int32 nYPos(nBTop); nYPos < aObjTL.Y() + nOHeight; nYPos += nBHeight) + { + const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel); + + if(aOutRectPixel.IsOver(aVisiblePixel)) + { + mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx); + } + } } + + // restore OutDev + mpOutputDevice->EnableMapMode(bWasEnabled); } } - - // restore OutDev - mpOutputDevice->EnableMapMode(bWasEnabled); } } } @@ -861,69 +849,42 @@ namespace drawinglayer return; } - switch(rMarkArrayCandidate.getStyle()) + // get data + const std::vector< basegfx::B2DPoint >& rPositions = rMarkArrayCandidate.getPositions(); + const sal_uInt32 nCount(rPositions.size()); + + if(nCount && !rMarkArrayCandidate.getMarker().IsEmpty()) { - default : - { - // not handled/unknown MarkerArrayPrimitive2D, use decomposition - process(rMarkArrayCandidate.get2DDecomposition(getViewInformation2D())); - break; - } - case primitive2d::MARKERSTYLE2D_CROSS : - case primitive2d::MARKERSTYLE2D_GLUEPOINT : + // get pixel size + const BitmapEx& rMarker(rMarkArrayCandidate.getMarker()); + const Size aBitmapSize(rMarker.GetSizePixel()); + + if(aBitmapSize.Width() && aBitmapSize.Height()) { - // directly supported markers - const std::vector< basegfx::B2DPoint >& rPositions = rMarkArrayCandidate.getPositions(); - const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rMarkArrayCandidate.getRGBColor())); - const Color aVCLColor(aRGBColor); - const basegfx::B2DHomMatrix aTransObjectToDiscrete(mpOutputDevice->GetViewTransformation() * maCurrentTransformation); + // get discrete half size + const basegfx::B2DVector aDiscreteHalfSize( + (aBitmapSize.getWidth() - 1.0) * 0.5, + (aBitmapSize.getHeight() - 1.0) * 0.5); + const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled()); - for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++) - { - const basegfx::B2DPoint aDiscretePosition(aTransObjectToDiscrete * (*aIter)); - const Point aPos(basegfx::fround(aDiscretePosition.getX()), basegfx::fround(aDiscretePosition.getY())); + // do not forget evtl. moved origin in target device MapMode when + // switching it off; it would be missing and lead to wrong positions. + // All his could be done using logic sizes and coordinates, too, but + // we want a 1:1 bitmap rendering here, so it's more safe and faster + // to work with switching off MapMode usage completely. + const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin()); - switch(rMarkArrayCandidate.getStyle()) - { - default : - { - // this would be an error, ther cases here need to be consistent with the initially - // accepted ones - OSL_ENSURE(false, "Inconsistent RenderMarkerArrayPrimitive2D implementation (!)"); - break; - } - case primitive2d::MARKERSTYLE2D_CROSS : - { - mpOutputDevice->DrawPixel(aPos, aVCLColor); - mpOutputDevice->DrawPixel(Point(aPos.X() - 1L, aPos.Y()), aVCLColor); - mpOutputDevice->DrawPixel(Point(aPos.X() + 1L, aPos.Y()), aVCLColor); - mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() - 1L), aVCLColor); - mpOutputDevice->DrawPixel(Point(aPos.X(), aPos.Y() + 1L), aVCLColor); + mpOutputDevice->EnableMapMode(false); - break; - } - case primitive2d::MARKERSTYLE2D_GLUEPOINT : - { - // backpen - mpOutputDevice->SetLineColor(aVCLColor); - mpOutputDevice->DrawLine(aPos + Point(-2, -3), aPos + Point(+3, +2)); - mpOutputDevice->DrawLine(aPos + Point(-3, -2), aPos + Point(+2, +3)); - mpOutputDevice->DrawLine(aPos + Point(-3, +2), aPos + Point(+2, -3)); - mpOutputDevice->DrawLine(aPos + Point(-2, +3), aPos + Point(+3, -2)); - - // frontpen (hard coded) - const basegfx::BColor aRGBFrontColor(maBColorModifierStack.getModifiedColor(Color(COL_LIGHTBLUE).getBColor())); - mpOutputDevice->SetLineColor(Color(aRGBFrontColor)); - mpOutputDevice->DrawLine(aPos + Point(-2, -2), aPos + Point(+2, +2)); - mpOutputDevice->DrawLine(aPos + Point(-2, +2), aPos + Point(+2, -2)); - - break; - } - } + for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++) + { + const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize); + const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY())); + mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker); } - break; + mpOutputDevice->EnableMapMode(bWasEnabled); } } } @@ -952,8 +913,8 @@ namespace drawinglayer if(basegfx::fTools::more(fLineWidth, 0.0)) { - const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(1.0, 1.0)); - const double fDiscreteLineWidth((fLineWidth * aDiscreteUnit.getX() + fLineWidth * aDiscreteUnit.getY()) * 0.5); + const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0)); + const double fDiscreteLineWidth(aDiscreteUnit.getLength()); if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5)) { |