sceneprimitive2d.cxx (464702f4) | sceneprimitive2d.cxx (78d93489) |
---|---|
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 --- 191 unchanged lines hidden (view full) --- 200 if(fReducedVisualisationFactor != 1.0) 201 { 202 fReduceFactor *= fReducedVisualisationFactor; 203 fViewSizeX *= fReducedVisualisationFactor; 204 fViewSizeY *= fReducedVisualisationFactor; 205 } 206 } 207 | 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 --- 191 unchanged lines hidden (view full) --- 200 if(fReducedVisualisationFactor != 1.0) 201 { 202 fReduceFactor *= fReducedVisualisationFactor; 203 fViewSizeX *= fReducedVisualisationFactor; 204 fViewSizeY *= fReducedVisualisationFactor; 205 } 206 } 207 |
208 // calculate logic render size in world coordinates for usage in renderer 209 basegfx::B2DVector aLogicRenderSize( 210 aDiscreteRange.getWidth() * fReduceFactor, 211 aDiscreteRange.getHeight() * fReduceFactor); 212 aLogicRenderSize *= rViewInformation.getInverseObjectToViewTransformation(); 213 | |
214 // determine the oversample value 215 static sal_uInt16 nDefaultOversampleValue(3); 216 const sal_uInt16 nOversampleValue(aDrawinglayerOpt.IsAntiAliasing() ? nDefaultOversampleValue : 0); 217 | 208 // determine the oversample value 209 static sal_uInt16 nDefaultOversampleValue(3); 210 const sal_uInt16 nOversampleValue(aDrawinglayerOpt.IsAntiAliasing() ? nDefaultOversampleValue : 0); 211 |
212 geometry::ViewInformation3D aViewInformation3D(getViewInformation3D()); 213 { 214 // calculate a transformation from DiscreteRange to evtl. rotated/sheared content. 215 // Start with full transformation from object to discrete units 216 basegfx::B2DHomMatrix aObjToUnit(rViewInformation.getObjectToViewTransformation() * getObjectTransformation()); 217 218 // bring to unit coordinates by applying inverse DiscreteRange 219 aObjToUnit.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY()); 220 aObjToUnit.scale(1.0 / aDiscreteRange.getWidth(), 1.0 / aDiscreteRange.getHeight()); 221 222 // calculate transformed user coordinate system 223 const basegfx::B2DPoint aStandardNull(0.0, 0.0); 224 const basegfx::B2DPoint aUnitRangeTopLeft(aObjToUnit * aStandardNull); 225 const basegfx::B2DVector aStandardXAxis(1.0, 0.0); 226 const basegfx::B2DVector aUnitRangeXAxis(aObjToUnit * aStandardXAxis); 227 const basegfx::B2DVector aStandardYAxis(0.0, 1.0); 228 const basegfx::B2DVector aUnitRangeYAxis(aObjToUnit * aStandardYAxis); 229 230 if(!aUnitRangeTopLeft.equal(aStandardNull) || !aUnitRangeXAxis.equal(aStandardXAxis) || !aUnitRangeYAxis.equal(aStandardYAxis)) 231 { 232 // build transformation from unit range to user coordinate system; the unit range 233 // X and Y axes are the column vectors, the null point is the offset 234 basegfx::B2DHomMatrix aUnitRangeToUser; 235 236 aUnitRangeToUser.set3x2( 237 aUnitRangeXAxis.getX(), aUnitRangeYAxis.getX(), aUnitRangeTopLeft.getX(), 238 aUnitRangeXAxis.getY(), aUnitRangeYAxis.getY(), aUnitRangeTopLeft.getY()); 239 240 // decompose to allow to apply this to the 3D transformation 241 basegfx::B2DVector aScale, aTranslate; 242 double fRotate, fShearX; 243 aUnitRangeToUser.decompose(aScale, aTranslate, fRotate, fShearX); 244 245 // apply before DeviceToView and after Projection, 3D is in range [-1.0 .. 1.0] in X,Y and Z 246 // and not yet flipped in Y 247 basegfx::B3DHomMatrix aExtendedProjection(aViewInformation3D.getProjection()); 248 249 // bring to unit coordiantes, flip Y, leave Z unchanged 250 aExtendedProjection.scale(0.5, -0.5, 1.0); 251 aExtendedProjection.translate(0.5, 0.5, 0.0); 252 253 // apply extra; Y is flipped now, go with positive shear and rotate values 254 aExtendedProjection.scale(aScale.getX(), aScale.getY(), 1.0); 255 aExtendedProjection.shearXZ(fShearX, 0.0); 256 aExtendedProjection.rotate(0.0, 0.0, fRotate); 257 aExtendedProjection.translate(aTranslate.getX(), aTranslate.getY(), 0.0); 258 259 // back to state after projection 260 aExtendedProjection.translate(-0.5, -0.5, 0.0); 261 aExtendedProjection.scale(2.0, -2.0, 1.0); 262 263 aViewInformation3D = geometry::ViewInformation3D( 264 aViewInformation3D.getObjectTransformation(), 265 aViewInformation3D.getOrientation(), 266 aExtendedProjection, 267 aViewInformation3D.getDeviceToView(), 268 aViewInformation3D.getViewTime(), 269 aViewInformation3D.getExtendedInformationSequence()); 270 } 271 } 272 273 // calculate logic render size in world coordinates for usage in renderer 274 const basegfx::B2DHomMatrix aInverseOToV(rViewInformation.getInverseObjectToViewTransformation()); 275 const double fLogicX((aInverseOToV * basegfx::B2DVector(aDiscreteRange.getWidth() * fReduceFactor, 0.0)).getLength()); 276 const double fLogicY((aInverseOToV * basegfx::B2DVector(0.0, aDiscreteRange.getHeight() * fReduceFactor)).getLength()); 277 |
|
218 // use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process 219 processor3d::ZBufferProcessor3D aZBufferProcessor3D( | 278 // use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process 279 processor3d::ZBufferProcessor3D aZBufferProcessor3D( |
220 getViewInformation3D(), | 280 aViewInformation3D, |
221 rViewInformation, 222 getSdrSceneAttribute(), 223 getSdrLightingAttribute(), | 281 rViewInformation, 282 getSdrSceneAttribute(), 283 getSdrLightingAttribute(), |
224 aLogicRenderSize.getX(), 225 aLogicRenderSize.getY(), | 284 fLogicX, 285 fLogicY, |
226 aUnitVisibleRange, 227 nOversampleValue); 228 229 aZBufferProcessor3D.process(getChildren3D()); 230 aZBufferProcessor3D.finish(); 231 232 const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); 233 const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); --- 4 unchanged lines hidden (view full) --- 238 basegfx::B2DHomMatrix aNew2DTransform; 239 240 aNew2DTransform.set(0, 0, aVisibleDiscreteRange.getWidth()); 241 aNew2DTransform.set(1, 1, aVisibleDiscreteRange.getHeight()); 242 aNew2DTransform.set(0, 2, aVisibleDiscreteRange.getMinX()); 243 aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); 244 245 // transform back to world coordinates for usage in primitive creation | 286 aUnitVisibleRange, 287 nOversampleValue); 288 289 aZBufferProcessor3D.process(getChildren3D()); 290 aZBufferProcessor3D.finish(); 291 292 const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); 293 const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); --- 4 unchanged lines hidden (view full) --- 298 basegfx::B2DHomMatrix aNew2DTransform; 299 300 aNew2DTransform.set(0, 0, aVisibleDiscreteRange.getWidth()); 301 aNew2DTransform.set(1, 1, aVisibleDiscreteRange.getHeight()); 302 aNew2DTransform.set(0, 2, aVisibleDiscreteRange.getMinX()); 303 aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); 304 305 // transform back to world coordinates for usage in primitive creation |
246 aNew2DTransform *= rViewInformation.getInverseObjectToViewTransformation(); | 306 aNew2DTransform *= aInverseOToV; |
247 248 // create bitmap primitive and add 249 const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform)); 250 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef); 251 252 // test: Allow to add an outline in the debugger when tests are needed 253 static bool bAddOutlineToCreated3DSceneRepresentation(false); 254 --- 222 unchanged lines hidden --- | 307 308 // create bitmap primitive and add 309 const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform)); 310 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef); 311 312 // test: Allow to add an outline in the debugger when tests are needed 313 static bool bAddOutlineToCreated3DSceneRepresentation(false); 314 --- 222 unchanged lines hidden --- |