зеркало из https://github.com/mozilla/pjs.git
Bug 344696: Remove nsIDeviceContext::Get/SetZoom. r+sr=roc.
This commit is contained in:
Родитель
bae4fbcd3c
Коммит
daf26752ad
|
@ -1530,36 +1530,14 @@ NS_IMETHODIMP
|
|||
nsDocShell::GetZoom(float *zoom)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(zoom);
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(mDeviceContext->GetZoom(*zoom), NS_ERROR_FAILURE);
|
||||
|
||||
*zoom = 1.0f;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetZoom(float zoom)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
mDeviceContext->SetZoom(zoom);
|
||||
|
||||
// get the pres shell
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
|
||||
// get the view manager
|
||||
nsIViewManager* vm = presShell->GetViewManager();
|
||||
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
|
||||
|
||||
// get the root view
|
||||
nsIView *rootView = nsnull; // views are not ref counted
|
||||
vm->GetRootView(rootView);
|
||||
if (rootView)
|
||||
vm->UpdateView(rootView, 0);
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -107,9 +107,6 @@ public:
|
|||
nsIFontMetrics*& aMetrics);
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics);
|
||||
|
||||
NS_IMETHOD SetZoom(float aZoom);
|
||||
NS_IMETHOD GetZoom(float &aZoom) const;
|
||||
|
||||
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName);
|
||||
|
||||
NS_IMETHOD GetLocalFontName(const nsString& aFaceName, nsString& aLocalName,
|
||||
|
@ -154,7 +151,6 @@ protected:
|
|||
|
||||
nsFontCache *mFontCache;
|
||||
nsCOMPtr<nsIAtom> mLocaleLangGroup; // XXX temp fix for performance bug - erik
|
||||
float mZoom;
|
||||
nsHashtable* mFontAliasTable;
|
||||
float mCPixelScale;
|
||||
|
||||
|
|
|
@ -401,11 +401,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics) = 0;
|
||||
|
||||
//get and set the document zoom value used for display-time
|
||||
//scaling. default is 1.0 (no zoom)
|
||||
NS_IMETHOD SetZoom(float aZoom) = 0;
|
||||
NS_IMETHOD GetZoom(float &aZoom) const = 0;
|
||||
|
||||
/**
|
||||
* Check to see if a particular named font exists.
|
||||
* @param aFontName character string of font face name
|
||||
|
|
|
@ -55,11 +55,13 @@ NS_IMPL_ISUPPORTS3(DeviceContextImpl, nsIDeviceContext, nsIObserver, nsISupports
|
|||
|
||||
DeviceContextImpl::DeviceContextImpl()
|
||||
{
|
||||
mFontCache = nsnull;
|
||||
|
||||
mDevUnitsToAppUnits = 1.0f;
|
||||
mAppUnitsToDevUnits = 1.0f;
|
||||
mTwipsToPixels = 1.0f;
|
||||
mPixelsToTwips = 1.0f;
|
||||
mFontCache = nsnull;
|
||||
mCPixelScale = 1.0f;
|
||||
mZoom = 1.0f;
|
||||
mWidget = nsnull;
|
||||
mFontAliasTable = nsnull;
|
||||
|
||||
|
@ -341,18 +343,6 @@ NS_IMETHODIMP DeviceContextImpl::GetMetricsFor(const nsFont& aFont, nsIFontMetri
|
|||
return mFontCache->GetMetricsFor(aFont, mLocaleLangGroup, aMetrics);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::SetZoom(float aZoom)
|
||||
{
|
||||
mZoom = aZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetZoom(float &aZoom) const
|
||||
{
|
||||
aZoom = mZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetDepth(PRUint32& aDepth)
|
||||
{
|
||||
aDepth = 24;
|
||||
|
|
|
@ -106,14 +106,10 @@ nsThebesDeviceContext::nsThebesDeviceContext()
|
|||
|
||||
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("#### Creating DeviceContext %p\n", this));
|
||||
|
||||
mDevUnitsToAppUnits = 1.0f;
|
||||
mAppUnitsToDevUnits = 1.0f;
|
||||
mCPixelScale = 1.0f;
|
||||
mZoom = 1.0f;
|
||||
mDepth = 0;
|
||||
mDpi = -1;
|
||||
mWidth = 0;
|
||||
mHeight = 0;
|
||||
|
||||
mWidget = nsnull;
|
||||
mPrinter = PR_FALSE;
|
||||
|
||||
mWidgetSurfaceCache.Init();
|
||||
|
@ -140,7 +136,7 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI)
|
|||
PRInt32 OSVal;
|
||||
PRBool do_round = PR_TRUE;
|
||||
|
||||
mDpi = 96;
|
||||
PRInt32 dpi = 96;
|
||||
|
||||
#if defined(MOZ_ENABLE_GTK2)
|
||||
float screenWidthIn = float(::gdk_screen_width_mm()) / 25.4f;
|
||||
|
@ -149,22 +145,22 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI)
|
|||
if (aPrefDPI > 0) {
|
||||
// If there's a valid pref value for the logical resolution,
|
||||
// use it.
|
||||
mDpi = aPrefDPI;
|
||||
dpi = aPrefDPI;
|
||||
} else if ((aPrefDPI == 0) || (OSVal > 96)) {
|
||||
// Either if the pref is 0 (force use of OS value) or the OS
|
||||
// value is bigger than 96, use the OS value.
|
||||
mDpi = OSVal;
|
||||
dpi = OSVal;
|
||||
} else {
|
||||
// if we couldn't get the pref or it's negative, and the OS
|
||||
// value is under 96ppi, then use 96.
|
||||
mDpi = 96;
|
||||
dpi = 96;
|
||||
}
|
||||
|
||||
if (mPrinter) {
|
||||
// cairo printing doesn't really have the
|
||||
// notion of DPI so we have to use 72...
|
||||
// XXX is this an issue? we force everything else to be 96+
|
||||
mDpi = 72;
|
||||
dpi = 72;
|
||||
do_round = PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -180,13 +176,13 @@ nsThebesDeviceContext::SetDPI(PRInt32 aPrefDPI)
|
|||
ReleaseDC((HWND)nsnull, dc);
|
||||
|
||||
if (OSVal != 0)
|
||||
mDpi = OSVal;
|
||||
dpi = OSVal;
|
||||
#endif
|
||||
|
||||
int in2pt = 72;
|
||||
|
||||
// make p2t a nice round number - this prevents rounding problems
|
||||
mPixelsToTwips = float(NSIntPointsToTwips(in2pt)) / float(mDpi);
|
||||
mPixelsToTwips = float(NSIntPointsToTwips(in2pt)) / float(dpi);
|
||||
if (do_round)
|
||||
mPixelsToTwips = float(NSToIntRound(mPixelsToTwips));
|
||||
mTwipsToPixels = 1.0f / mPixelsToTwips;
|
||||
|
|
|
@ -137,15 +137,10 @@ protected:
|
|||
PRUint32 mDepth;
|
||||
|
||||
private:
|
||||
nsNativeWidget mWidget;
|
||||
|
||||
nsCOMPtr<nsIScreenManager> mScreenManager;
|
||||
|
||||
float mWidthFloat;
|
||||
float mHeightFloat;
|
||||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
PRInt32 mDpi;
|
||||
|
||||
PRBool mPrinter;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ nsPrintData::nsPrintData(ePrintDataType aType) :
|
|||
mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE),
|
||||
mShrinkToFit(PR_FALSE), mPrintFrameType(nsIPrintSettings::kFramesAsIs),
|
||||
mNumPrintableDocs(0), mNumDocsPrinted(0), mNumPrintablePages(0), mNumPagesPrinted(0),
|
||||
mShrinkRatio(1.0), mOrigDCScale(1.0), mOrigZoom(1.0), mPPEventListeners(NULL),
|
||||
mShrinkRatio(1.0), mOrigDCScale(1.0), mPPEventListeners(NULL),
|
||||
mBrandName(nsnull)
|
||||
{
|
||||
|
||||
|
@ -101,12 +101,6 @@ nsPrintData::nsPrintData(ePrintDataType aType) :
|
|||
|
||||
nsPrintData::~nsPrintData()
|
||||
{
|
||||
|
||||
// Set the cached Zoom value back into the DC
|
||||
if (mPrintDC) {
|
||||
mPrintDC->SetZoom(mOrigZoom);
|
||||
}
|
||||
|
||||
// remove the event listeners
|
||||
if (mPPEventListeners) {
|
||||
mPPEventListeners->RemoveListeners();
|
||||
|
|
|
@ -158,7 +158,6 @@ public:
|
|||
PRInt32 mNumPagesPrinted;
|
||||
float mShrinkRatio;
|
||||
float mOrigDCScale;
|
||||
float mOrigZoom;
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsCOMPtr<nsIPrintOptions> mPrintOptions;
|
||||
|
|
|
@ -931,9 +931,7 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
// Check to see if we need to transfer any of our old values
|
||||
// over to the new PrintData object
|
||||
if (mOldPrtPreview) {
|
||||
mPrt->mOrigZoom = mOldPrtPreview->mOrigZoom;
|
||||
mPrt->mOrigDCScale = mOldPrtPreview->mOrigDCScale;
|
||||
|
||||
} else {
|
||||
// Get the Original PixelScale in case we need to start changing it
|
||||
mDeviceContext->GetCanonicalPixelScale(mPrt->mOrigDCScale);
|
||||
|
@ -1084,10 +1082,6 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
|
||||
mPrt->mPrintDC = mDeviceContext;
|
||||
|
||||
// Cache original Zoom value and then set it to 1.0
|
||||
mPrt->mPrintDC->GetZoom(mPrt->mOrigZoom);
|
||||
mPrt->mPrintDC->SetZoom(1.0f);
|
||||
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->SetUseAltDC(kUseAltDCFor_FONTMETRICS, PR_TRUE);
|
||||
mDeviceContext->SetUseAltDC(kUseAltDCFor_CREATERC_REFLOW, PR_TRUE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче