зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 281455: bits of background image of abs-positioned div draw in the wrong place. Fixed by ensuring that nsRenderingContextMac fixes up the port origin before calling the image tiling code (since the caret draw may have nuked the origin). r=mark, sr=jhpedemonte, a=bsmedberg
This commit is contained in:
Родитель
30298a402a
Коммит
7d92cd6651
|
@ -175,7 +175,7 @@ protected:
|
|||
NS_ASSERTION(ValidateDrawingState(), "Bad drawing state");
|
||||
// we assume that if the port has been set, then the port/GDevice are
|
||||
// valid, and do nothing (for speed)
|
||||
mPortChanged = (newPort != CGrafPtr(GetQDGlobalsThePort));
|
||||
mPortChanged = (newPort != CGrafPtr(GetQDGlobalsThePort()));
|
||||
if (mPortChanged)
|
||||
{
|
||||
::GetGWorld(&mOldPort, &mOldDevice);
|
||||
|
|
|
@ -896,7 +896,6 @@ NS_IMETHODIMP nsRenderingContextMac::DrawPolyline(const nsPoint aPoints[], PRInt
|
|||
{
|
||||
SetupPortState();
|
||||
|
||||
PRUint32 i;
|
||||
PRInt32 x,y;
|
||||
|
||||
x = aPoints[0].x;
|
||||
|
@ -904,7 +903,8 @@ NS_IMETHODIMP nsRenderingContextMac::DrawPolyline(const nsPoint aPoints[], PRInt
|
|||
mGS->mTMatrix.TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::MoveTo(x,y);
|
||||
|
||||
for (i = 1; i < aNumPoints; i++){
|
||||
for (PRInt32 i = 1; i < aNumPoints; i++)
|
||||
{
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
|
||||
|
@ -996,7 +996,6 @@ NS_IMETHODIMP nsRenderingContextMac::DrawPolygon(const nsPoint aPoints[], PRInt3
|
|||
{
|
||||
SetupPortState();
|
||||
|
||||
PRUint32 i;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
|
||||
|
@ -1010,7 +1009,7 @@ NS_IMETHODIMP nsRenderingContextMac::DrawPolygon(const nsPoint aPoints[], PRInt3
|
|||
mGS->mTMatrix.TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::MoveTo(x,y);
|
||||
|
||||
for (i = 1; i < aNumPoints; i++) {
|
||||
for (PRInt32 i = 1; i < aNumPoints; i++) {
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
|
||||
|
@ -1032,7 +1031,6 @@ NS_IMETHODIMP nsRenderingContextMac::FillPolygon(const nsPoint aPoints[], PRInt3
|
|||
{
|
||||
SetupPortState();
|
||||
|
||||
PRUint32 i;
|
||||
PolyHandle thepoly;
|
||||
PRInt32 x,y;
|
||||
|
||||
|
@ -1046,7 +1044,7 @@ NS_IMETHODIMP nsRenderingContextMac::FillPolygon(const nsPoint aPoints[], PRInt3
|
|||
mGS->mTMatrix.TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
::MoveTo(x,y);
|
||||
|
||||
for (i = 1; i < aNumPoints; i++) {
|
||||
for (PRInt32 i = 1; i < aNumPoints; i++) {
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
mGS->mTMatrix.TransformCoord((PRInt32*)&x,(PRInt32*)&y);
|
||||
|
@ -1141,7 +1139,7 @@ NS_IMETHODIMP nsRenderingContextMac::DrawArc(nscoord aX, nscoord aY, nscoord aWi
|
|||
|
||||
mGS->mTMatrix.TransformCoord(&x,&y,&w,&h);
|
||||
::SetRect(&therect, pinToShort(x), pinToShort(y), pinToShort(x + w), pinToShort(y + h));
|
||||
::FrameArc(&therect,aStartAngle,aEndAngle);
|
||||
::FrameArc(&therect, (short)aStartAngle, (short)aEndAngle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1171,7 +1169,7 @@ NS_IMETHODIMP nsRenderingContextMac::FillArc(nscoord aX, nscoord aY, nscoord aWi
|
|||
|
||||
mGS->mTMatrix.TransformCoord(&x,&y,&w,&h);
|
||||
::SetRect(&therect, pinToShort(x), pinToShort(y), pinToShort(x + w), pinToShort(y + h));
|
||||
::PaintArc(&therect,aStartAngle,aEndAngle);
|
||||
::PaintArc(&therect, (short)aStartAngle, (short)aEndAngle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1416,25 +1414,25 @@ NS_IMETHODIMP
|
|||
nsRenderingContextMac::FlushRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
if (mPort) {
|
||||
SetupPortState();
|
||||
if (mPort) {
|
||||
SetupPortState();
|
||||
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mGS->mTMatrix.TransformCoord(&x, &y, &w, &h);
|
||||
RgnHandle rgn = ::NewRgn();
|
||||
::SetRectRgn(rgn, pinToShort(x), pinToShort(y), pinToShort(x + w), pinToShort(y + h));
|
||||
::QDFlushPortBuffer(mPort, rgn);
|
||||
::DisposeRgn(rgn);
|
||||
}
|
||||
nscoord x,y,w,h;
|
||||
Rect therect;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mGS->mTMatrix.TransformCoord(&x, &y, &w, &h);
|
||||
RgnHandle rgn = ::NewRgn();
|
||||
::SetRectRgn(rgn, pinToShort(x), pinToShort(y), pinToShort(x + w), pinToShort(y + h));
|
||||
::QDFlushPortBuffer(mPort, rgn);
|
||||
::DisposeRgn(rgn);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
|
@ -1479,6 +1477,22 @@ nsRenderingContextMac::SetRightToLeftText(PRBool aIsRTL)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextMac::DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect)
|
||||
{
|
||||
SetupPortState();
|
||||
return nsRenderingContextImpl::DrawImage(aImage, aSrcRect, aDestRect);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextMac::DrawTile(imgIContainer *aImage,
|
||||
nscoord aXImageStart, nscoord aYImageStart,
|
||||
const nsRect * aTargetRect)
|
||||
{
|
||||
SetupPortState();
|
||||
return nsRenderingContextImpl::DrawTile(aImage, aXImageStart, aYImageStart, aTargetRect);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// override to set the port back to the window port
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
nsTextDimensions& aDimensions);
|
||||
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
|
||||
nsTextDimensions& aDimensions, PRInt32 *aFontID);
|
||||
|
||||
|
||||
NS_IMETHOD CopyOffScreenBits(nsIDrawingSurface* aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
|
||||
|
@ -173,6 +173,12 @@ public:
|
|||
* right-to-left base direction
|
||||
*/
|
||||
NS_IMETHOD SetRightToLeftText(PRBool aIsRTL);
|
||||
|
||||
NS_IMETHOD DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect);
|
||||
NS_IMETHOD DrawTile(imgIContainer *aImage,
|
||||
nscoord aXImageStart, nscoord aYImageStart,
|
||||
const nsRect * aTargetRect);
|
||||
|
||||
//locals
|
||||
nsresult SetPortTextState();
|
||||
nsresult Init(nsIDeviceContext* aContext, CGrafPtr aPort);
|
||||
|
|
Загрузка…
Ссылка в новой задаче