[Libreoffice-commits] core.git: vcl/inc vcl/osx vcl/quartz

Tor Lillqvist tml at collabora.com
Wed Dec 18 14:23:08 PST 2013


 vcl/inc/headless/svpgdi.hxx |    4 ----
 vcl/inc/quartz/salgdi.h     |    8 ++------
 vcl/osx/salprn.cxx          |    2 +-
 vcl/quartz/ctfonts.cxx      |   10 +++++-----
 vcl/quartz/salgdi.cxx       |    4 +---
 vcl/quartz/salgdicommon.cxx |    7 ++-----
 vcl/quartz/salgdiutils.cxx  |    3 +--
 7 files changed, 12 insertions(+), 26 deletions(-)

New commits:
commit 0d9c4baf86c502e7cc2b6072a530c6fad2179abe
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Dec 19 00:04:55 2013 +0200

    The "fake DPI scale" was always 1
    
    Thanks to kendy for noticing.
    
    Change-Id: I6b62d5a0c1dc5df374629a8f7c6e7d2f7cd7ffbd

diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 1135c7d..c3ffc65 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -74,10 +74,6 @@ class SvpSalGraphics : public SalGraphics
     int                                     mnWidth;
     int                                     mnHeight;
     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
     CGMutablePathRef                        mxClipPath;
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 49140fa..e0b86c3 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -92,7 +92,7 @@ public:
 
     SalLayout* GetTextLayout( void ) const;
 
-    void       GetFontMetric( float fPDIY, ImplFontMetricData& ) const;
+    void       GetFontMetric( ImplFontMetricData& ) const;
     bool       GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
     bool       GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
 
@@ -156,10 +156,6 @@ protected:
     /// device resolution of this graphics
     long                                    mnRealDPIX;
     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
     CGMutablePathRef                        mxClipPath;
@@ -194,7 +190,7 @@ public:
     bool                IsBrushVisible() const  { return maFillColor.IsVisible(); }
 
     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                initResolution( NSWindow* );
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 082fa1c..37fa0ec 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -139,7 +139,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
                 // scale to be top/down and reflect our "virtual" DPI
                 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
             OSL_FAIL( "no print info in SetupPrinterGraphics" );
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index d93d4b5..8211b9f 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -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
     // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here?
     CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName );
 
-    rMetric.mnAscent       = lrint( CTFontGetAscent( aCTFontRef ) * fPixelSize);
-    rMetric.mnDescent      = lrint( CTFontGetDescent( aCTFontRef ) * fPixelSize);
-    rMetric.mnExtLeading   = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize);
+    rMetric.mnAscent       = CTFontGetAscent( aCTFontRef );
+    rMetric.mnDescent      = CTFontGetDescent( aCTFontRef );
+    rMetric.mnExtLeading   = CTFontGetLeading( aCTFontRef );
     rMetric.mnIntLeading   = 0;
     // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
     // setting this width to the pixel height of the fontsize is good enough
     // 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
     rMetric.mbScalableFont = true;
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 25a219f..ceef023 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -254,7 +254,6 @@ AquaSalGraphics::AquaSalGraphics()
     , mnBitmapDepth( 0 )
     , mnRealDPIX( 0 )
     , mnRealDPIY( 0 )
-    , mfFakeDPIScale( 1.0 )
     , mxClipPath( NULL )
     , maLineColor( COL_WHITE )
     , maFillColor( COL_BLACK )
@@ -274,7 +273,6 @@ AquaSalGraphics::AquaSalGraphics()
     , mnWidth( 0 )
     , mnHeight( 0 )
     , mnBitmapDepth( 0 )
-    , mfFakeDPIScale( 1.0 )
     , mxClipPath( NULL )
     , maLineColor( COL_WHITE )
     , maFillColor( COL_BLACK )
@@ -325,7 +323,7 @@ void AquaSalGraphics::SetTextColor( SalColor nSalColor )
 
 void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int /*nFallbackLevel*/ )
 {
-    mpTextStyle->GetFontMetric( mfFakeDPIScale, *pMetric );
+    mpTextStyle->GetFontMetric( *pMetric );
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 6f96a6c..59edb05 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -519,7 +519,6 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics )
     }
     mnRealDPIX = rGraphics.mnRealDPIX;
     mnRealDPIY = rGraphics.mnRealDPIY;
-    mfFakeDPIScale = rGraphics.mfFakeDPIScale;
 }
 
 #endif
@@ -1241,8 +1240,8 @@ void AquaSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
         initResolution( (mbWindow && mpFrame) ? mpFrame->getNSWindow() : nil );
     }
 
-    rDPIX = lrint( mfFakeDPIScale * mnRealDPIX);
-    rDPIY = lrint( mfFakeDPIScale * mnRealDPIY);
+    rDPIX = mnRealDPIX;
+    rDPIY = mnRealDPIY;
 }
 
 #endif
@@ -1353,8 +1352,6 @@ void AquaSalGraphics::initResolution( NSWindow* )
         mnRealDPIX = pSalData->mnDPIX;
         mnRealDPIY = pSalData->mnDPIY;
     }
-
-    mfFakeDPIScale = 1.0;
 }
 
 #endif
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index f31b09a..c48089f 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -44,14 +44,13 @@ void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame )
     mbVirDev    = false;
 }
 
-void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY, double fScale )
+void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY )
 {
     mbWindow    = false;
     mbPrinter   = true;
     mbVirDev    = false;
 
     mrContext   = xContext;
-    mfFakeDPIScale = fScale;
     mnRealDPIX  = nDPIX;
     mnRealDPIY  = nDPIY;
 


More information about the Libreoffice-commits mailing list