зеркало из https://github.com/mozilla/gecko-dev.git
More changes to nsIDeviceContext API
This commit is contained in:
Родитель
623dd22c56
Коммит
5dc353b3bf
|
@ -190,22 +190,25 @@ nsIFontMetrics* DeviceContextImpl::GetMetricsFor(const nsFont& aFont)
|
|||
return mFontCache->GetMetricsFor(aFont);
|
||||
}
|
||||
|
||||
void DeviceContextImpl :: SetZoom(float aZoom)
|
||||
NS_IMETHODIMP DeviceContextImpl :: SetZoom(float aZoom)
|
||||
{
|
||||
mZoom = aZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float DeviceContextImpl :: GetZoom() const
|
||||
NS_IMETHODIMP DeviceContextImpl :: GetZoom(float &aZoom) const
|
||||
{
|
||||
return mZoom;
|
||||
aZoom = mZoom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float DeviceContextImpl :: GetGamma(void)
|
||||
NS_IMETHODIMP DeviceContextImpl :: GetGamma(float &aGamma)
|
||||
{
|
||||
return mGammaValue;
|
||||
aGamma = mGammaValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void DeviceContextImpl :: SetGamma(float aGamma)
|
||||
NS_IMETHODIMP DeviceContextImpl :: SetGamma(float aGamma)
|
||||
{
|
||||
if (aGamma != mGammaValue)
|
||||
{
|
||||
|
@ -218,13 +221,14 @@ void DeviceContextImpl :: SetGamma(float aGamma)
|
|||
|
||||
mGammaValue = aGamma;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint8 * DeviceContextImpl :: GetGammaTable(void)
|
||||
NS_IMETHODIMP DeviceContextImpl :: GetGammaTable(PRUint8 *&aGammaTable)
|
||||
{
|
||||
//XXX we really need to ref count this somehow. MMP
|
||||
|
||||
return mGammaTable;
|
||||
aGammaTable = mGammaTable;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void DeviceContextImpl :: SetGammaTable(PRUint8 * aTable, float aCurrentGamma, float aNewGamma)
|
||||
|
|
|
@ -51,13 +51,13 @@ public:
|
|||
|
||||
virtual nsIFontMetrics* GetMetricsFor(const nsFont& aFont);
|
||||
|
||||
virtual void SetZoom(float aZoom);
|
||||
virtual float GetZoom() const;
|
||||
NS_IMETHOD SetZoom(float aZoom);
|
||||
NS_IMETHOD GetZoom(float &aZoom) const;
|
||||
|
||||
virtual float GetGamma(void);
|
||||
virtual void SetGamma(float aGamma);
|
||||
NS_IMETHOD GetGamma(float &aGamma);
|
||||
NS_IMETHOD SetGamma(float aGamma);
|
||||
|
||||
virtual PRUint8 * GetGammaTable(void);
|
||||
NS_IMETHOD GetGammaTable(PRUint8 *&aGammaTable);
|
||||
|
||||
virtual nsNativeWidget GetNativeWidget(void);
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ public:
|
|||
|
||||
//get and set the document zoom value used for display-time
|
||||
//scaling. default is 1.0 (no zoom)
|
||||
virtual void SetZoom(float aZoom) = 0;
|
||||
virtual float GetZoom() const = 0;
|
||||
NS_IMETHOD SetZoom(float aZoom) = 0;
|
||||
NS_IMETHOD GetZoom(float &aZoom) const = 0;
|
||||
|
||||
//get a low level drawing surface for rendering. the rendering context
|
||||
//that is passed in is used to create the drawing surface if there isn't
|
||||
|
@ -110,11 +110,11 @@ public:
|
|||
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext) = 0;
|
||||
|
||||
//functions for handling gamma correction of output device
|
||||
virtual float GetGamma(void) = 0;
|
||||
virtual void SetGamma(float aGamma) = 0;
|
||||
NS_IMETHOD GetGamma(float &aGamms) = 0;
|
||||
NS_IMETHOD SetGamma(float aGamma) = 0;
|
||||
|
||||
//XXX the return from this really needs to be ref counted somehow. MMP
|
||||
virtual PRUint8 * GetGammaTable(void) = 0;
|
||||
NS_IMETHOD GetGammaTable(PRUint8 *&aGammaTable) = 0;
|
||||
|
||||
virtual nsNativeWidget GetNativeWidget(void) = 0;
|
||||
|
||||
|
|
|
@ -209,10 +209,13 @@ void nsImageWin :: ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRe
|
|||
PRUint8 *pixels = mImageBits +
|
||||
(mBHead->biHeight - aUpdateRect->y - aUpdateRect->height) * span +
|
||||
aUpdateRect->x * 3;
|
||||
PRUint8 *gamma = aContext->GetGammaTable();
|
||||
PRUint8 *gamma;
|
||||
float gammaValue;
|
||||
aContext->GetGammaTable(gamma);
|
||||
aContext->GetGamma(gammaValue);
|
||||
|
||||
// Gamma correct the image
|
||||
if (aContext->GetGamma() != 1.0)
|
||||
if (1.0 != gammaValue)
|
||||
{
|
||||
for (y = 0; y < aUpdateRect->height; y++)
|
||||
{
|
||||
|
|
|
@ -471,7 +471,7 @@ nsresult nsRenderingContextWin :: CommonInit(void)
|
|||
DEFAULT_QUALITY, FF_ROMAN | VARIABLE_PITCH, "Times New Roman");
|
||||
mBlackPen = ::CreatePen(PS_SOLID, 0, RGB(0, 0, 0));
|
||||
|
||||
mGammaTable = mContext->GetGammaTable();
|
||||
mContext->GetGammaTable(mGammaTable);
|
||||
|
||||
return SetupDC(nsnull, mDC);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче