Kaydet (Commit) 0d9c4baf authored tarafından Tor Lillqvist's avatar Tor Lillqvist

The "fake DPI scale" was always 1

Thanks to kendy for noticing.

Change-Id: I6b62d5a0c1dc5df374629a8f7c6e7d2f7cd7ffbd
üst 2753bc1e
...@@ -74,10 +74,6 @@ class SvpSalGraphics : public SalGraphics ...@@ -74,10 +74,6 @@ class SvpSalGraphics : public SalGraphics
int mnWidth; int mnWidth;
int mnHeight; int mnHeight;
int mnBitmapDepth; // zero unless bitmap int mnBitmapDepth; // zero unless bitmap
/// some graphics implementations (e.g. AquaSalInfoPrinter) scale
/// everything down by a factor (see SetupPrinterGraphics for details)
/// so we have to compensate for it with the inverse factor
double mfFakeDPIScale;
/// path representing current clip region /// path representing current clip region
CGMutablePathRef mxClipPath; CGMutablePathRef mxClipPath;
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
SalLayout* GetTextLayout( void ) const; SalLayout* GetTextLayout( void ) const;
void GetFontMetric( float fPDIY, ImplFontMetricData& ) const; void GetFontMetric( ImplFontMetricData& ) const;
bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const; bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const; bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
...@@ -156,10 +156,6 @@ protected: ...@@ -156,10 +156,6 @@ protected:
/// device resolution of this graphics /// device resolution of this graphics
long mnRealDPIX; long mnRealDPIX;
long mnRealDPIY; long mnRealDPIY;
/// some graphics implementations (e.g. AquaSalInfoPrinter) scale
/// everything down by a factor (see SetupPrinterGraphics for details)
/// so we have to compensate for it with the inverse factor
double mfFakeDPIScale;
/// path representing current clip region /// path representing current clip region
CGMutablePathRef mxClipPath; CGMutablePathRef mxClipPath;
...@@ -194,7 +190,7 @@ public: ...@@ -194,7 +190,7 @@ public:
bool IsBrushVisible() const { return maFillColor.IsVisible(); } bool IsBrushVisible() const { return maFillColor.IsVisible(); }
void SetWindowGraphics( AquaSalFrame* pFrame ); void SetWindowGraphics( AquaSalFrame* pFrame );
void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale ); void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY );
void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 ); void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
void initResolution( NSWindow* ); void initResolution( NSWindow* );
......
...@@ -139,7 +139,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const ...@@ -139,7 +139,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
// scale to be top/down and reflect our "virtual" DPI // scale to be top/down and reflect our "virtual" DPI
CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) ); CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) );
} }
mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 ); mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY );
} }
else else
OSL_FAIL( "no print info in SetupPrinterGraphics" ); OSL_FAIL( "no print info in SetupPrinterGraphics" );
......
...@@ -112,20 +112,20 @@ CoreTextStyle::~CoreTextStyle( void ) ...@@ -112,20 +112,20 @@ CoreTextStyle::~CoreTextStyle( void )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void CoreTextStyle::GetFontMetric( float fPixelSize, ImplFontMetricData& rMetric ) const void CoreTextStyle::GetFontMetric( ImplFontMetricData& rMetric ) const
{ {
// get the matching CoreText font handle // get the matching CoreText font handle
// TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here? // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here?
CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ); CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName );
rMetric.mnAscent = lrint( CTFontGetAscent( aCTFontRef ) * fPixelSize); rMetric.mnAscent = CTFontGetAscent( aCTFontRef );
rMetric.mnDescent = lrint( CTFontGetDescent( aCTFontRef ) * fPixelSize); rMetric.mnDescent = CTFontGetDescent( aCTFontRef );
rMetric.mnExtLeading = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize); rMetric.mnExtLeading = CTFontGetLeading( aCTFontRef );
rMetric.mnIntLeading = 0; rMetric.mnIntLeading = 0;
// since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
// setting this width to the pixel height of the fontsize is good enough // setting this width to the pixel height of the fontsize is good enough
// it also makes the calculation of the stretch factor simple // it also makes the calculation of the stretch factor simple
rMetric.mnWidth = lrint( CTFontGetSize( aCTFontRef ) * fPixelSize * mfFontStretch); rMetric.mnWidth = lrint( CTFontGetSize( aCTFontRef ) * mfFontStretch);
// all CoreText fonts are scalable // all CoreText fonts are scalable
rMetric.mbScalableFont = true; rMetric.mbScalableFont = true;
......
...@@ -254,7 +254,6 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -254,7 +254,6 @@ AquaSalGraphics::AquaSalGraphics()
, mnBitmapDepth( 0 ) , mnBitmapDepth( 0 )
, mnRealDPIX( 0 ) , mnRealDPIX( 0 )
, mnRealDPIY( 0 ) , mnRealDPIY( 0 )
, mfFakeDPIScale( 1.0 )
, mxClipPath( NULL ) , mxClipPath( NULL )
, maLineColor( COL_WHITE ) , maLineColor( COL_WHITE )
, maFillColor( COL_BLACK ) , maFillColor( COL_BLACK )
...@@ -274,7 +273,6 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -274,7 +273,6 @@ AquaSalGraphics::AquaSalGraphics()
, mnWidth( 0 ) , mnWidth( 0 )
, mnHeight( 0 ) , mnHeight( 0 )
, mnBitmapDepth( 0 ) , mnBitmapDepth( 0 )
, mfFakeDPIScale( 1.0 )
, mxClipPath( NULL ) , mxClipPath( NULL )
, maLineColor( COL_WHITE ) , maLineColor( COL_WHITE )
, maFillColor( COL_BLACK ) , maFillColor( COL_BLACK )
...@@ -325,7 +323,7 @@ void AquaSalGraphics::SetTextColor( SalColor nSalColor ) ...@@ -325,7 +323,7 @@ void AquaSalGraphics::SetTextColor( SalColor nSalColor )
void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int /*nFallbackLevel*/ ) void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int /*nFallbackLevel*/ )
{ {
mpTextStyle->GetFontMetric( mfFakeDPIScale, *pMetric ); mpTextStyle->GetFontMetric( *pMetric );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
...@@ -519,7 +519,6 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics ) ...@@ -519,7 +519,6 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics )
} }
mnRealDPIX = rGraphics.mnRealDPIX; mnRealDPIX = rGraphics.mnRealDPIX;
mnRealDPIY = rGraphics.mnRealDPIY; mnRealDPIY = rGraphics.mnRealDPIY;
mfFakeDPIScale = rGraphics.mfFakeDPIScale;
} }
#endif #endif
...@@ -1241,8 +1240,8 @@ void AquaSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) ...@@ -1241,8 +1240,8 @@ void AquaSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
initResolution( (mbWindow && mpFrame) ? mpFrame->getNSWindow() : nil ); initResolution( (mbWindow && mpFrame) ? mpFrame->getNSWindow() : nil );
} }
rDPIX = lrint( mfFakeDPIScale * mnRealDPIX); rDPIX = mnRealDPIX;
rDPIY = lrint( mfFakeDPIScale * mnRealDPIY); rDPIY = mnRealDPIY;
} }
#endif #endif
...@@ -1353,8 +1352,6 @@ void AquaSalGraphics::initResolution( NSWindow* ) ...@@ -1353,8 +1352,6 @@ void AquaSalGraphics::initResolution( NSWindow* )
mnRealDPIX = pSalData->mnDPIX; mnRealDPIX = pSalData->mnDPIX;
mnRealDPIY = pSalData->mnDPIY; mnRealDPIY = pSalData->mnDPIY;
} }
mfFakeDPIScale = 1.0;
} }
#endif #endif
......
...@@ -44,14 +44,13 @@ void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame ) ...@@ -44,14 +44,13 @@ void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame )
mbVirDev = false; mbVirDev = false;
} }
void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY, double fScale ) void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY )
{ {
mbWindow = false; mbWindow = false;
mbPrinter = true; mbPrinter = true;
mbVirDev = false; mbVirDev = false;
mrContext = xContext; mrContext = xContext;
mfFakeDPIScale = fScale;
mnRealDPIX = nDPIX; mnRealDPIX = nDPIX;
mnRealDPIY = nDPIY; mnRealDPIY = nDPIY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment