graphicprimitive2d.cxx (035a2f44) | graphicprimitive2d.cxx (2376739d) |
---|---|
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 --- 83 unchanged lines hidden (view full) --- 92 93 if(aRetval.getLength()) 94 { 95 // check for cropping 96 if(getGraphicAttr().IsCropped()) 97 { 98 // calculate scalings between real image size and logic object size. This 99 // is necessary since the crop values are relative to original bitmap size | 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 --- 83 unchanged lines hidden (view full) --- 92 93 if(aRetval.getLength()) 94 { 95 // check for cropping 96 if(getGraphicAttr().IsCropped()) 97 { 98 // calculate scalings between real image size and logic object size. This 99 // is necessary since the crop values are relative to original bitmap size |
100 double fFactorX(1.0); 101 double fFactorY(1.0); 102 103 { 104 const MapMode aMapMode100thmm(MAP_100TH_MM); 105 Size aBitmapSize(rGraphicObject.GetPrefSize()); 106 107 // #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 108 if(MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit()) 109 { 110 aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm); 111 } 112 else 113 { 114 aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm); 115 } 116 117 const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop()); 118 const double fDivY(aBitmapSize.Height() - getGraphicAttr().GetTopCrop() - getGraphicAttr().GetBottomCrop()); 119 const basegfx::B2DVector aScale(aTransform * basegfx::B2DVector(1.0, 1.0)); 120 121 if(!basegfx::fTools::equalZero(fDivX)) 122 { 123 fFactorX = fabs(aScale.getX()) / fDivX; 124 } 125 126 if(!basegfx::fTools::equalZero(fDivY)) 127 { 128 fFactorY = fabs(aScale.getY()) / fDivY; 129 } 130 } | 100 const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0)); 101 const basegfx::B2DVector aCropScaleFactor( 102 rGraphicObject.calculateCropScaling( 103 aObjectScale.getX(), 104 aObjectScale.getY(), 105 getGraphicAttr().GetLeftCrop(), 106 getGraphicAttr().GetTopCrop(), 107 getGraphicAttr().GetRightCrop(), 108 getGraphicAttr().GetBottomCrop())); |
131 132 // embed content in cropPrimitive 133 Primitive2DReference xPrimitive( 134 new CropPrimitive2D( 135 aRetval, 136 aTransform, | 109 110 // embed content in cropPrimitive 111 Primitive2DReference xPrimitive( 112 new CropPrimitive2D( 113 aRetval, 114 aTransform, |
137 getGraphicAttr().GetLeftCrop() * fFactorX, 138 getGraphicAttr().GetTopCrop() * fFactorY, 139 getGraphicAttr().GetRightCrop() * fFactorX, 140 getGraphicAttr().GetBottomCrop() * fFactorY)); | 115 getGraphicAttr().GetLeftCrop() * aCropScaleFactor.getX(), 116 getGraphicAttr().GetTopCrop() * aCropScaleFactor.getY(), 117 getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(), 118 getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY())); |
141 142 aRetval = Primitive2DSequence(&xPrimitive, 1); 143 } 144 } 145 } 146 147 return aRetval; 148 } --- 51 unchanged lines hidden --- | 119 120 aRetval = Primitive2DSequence(&xPrimitive, 1); 121 } 122 } 123 } 124 125 return aRetval; 126 } --- 51 unchanged lines hidden --- |