mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 577224 - Fix nsCARenderer warnings; r=smichaud
This commit is contained in:
parent
d291ab8e5a
commit
c9729f2d7f
@ -74,7 +74,7 @@ public:
|
|||||||
nsIOSurface *surf,
|
nsIOSurface *surf,
|
||||||
CGColorSpaceRef aColorSpace,
|
CGColorSpaceRef aColorSpace,
|
||||||
int aX, int aY,
|
int aX, int aY,
|
||||||
int aWidth, int aHeight);
|
size_t aWidth, size_t aHeight);
|
||||||
private:
|
private:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
|
|||||||
nsIOSurface *surf,
|
nsIOSurface *surf,
|
||||||
CGColorSpaceRef aColorSpace,
|
CGColorSpaceRef aColorSpace,
|
||||||
int aX, int aY,
|
int aX, int aY,
|
||||||
int aWidth, int aHeight) {
|
size_t aWidth, size_t aHeight) {
|
||||||
surf->Lock();
|
surf->Lock();
|
||||||
size_t bytesPerRow = surf->GetBytesPerRow();
|
size_t bytesPerRow = surf->GetBytesPerRow();
|
||||||
size_t ioWidth = surf->GetWidth();
|
size_t ioWidth = surf->GetWidth();
|
||||||
@ -729,11 +729,16 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
|
|||||||
|
|
||||||
// We get rendering glitches if we use a width/height that falls
|
// We get rendering glitches if we use a width/height that falls
|
||||||
// outside of the IOSurface.
|
// outside of the IOSurface.
|
||||||
if (aWidth > ioWidth - aX)
|
if (aWidth + aX > ioWidth)
|
||||||
aWidth = ioWidth - aX;
|
aWidth = ioWidth - aX;
|
||||||
if (aHeight > ioHeight - aY)
|
if (aHeight + aY > ioHeight)
|
||||||
aHeight = ioHeight - aY;
|
aHeight = ioHeight - aY;
|
||||||
|
|
||||||
|
if (aX < 0 || aX >= ioWidth ||
|
||||||
|
aY < 0 || aY >= ioHeight) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
|
CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
|
||||||
aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
|
aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
|
||||||
dataProvider, NULL, true, kCGRenderingIntentDefault);
|
dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||||
@ -751,7 +756,10 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
::CGContextScaleCTM(aContext, 1.0f, -1.0f);
|
::CGContextScaleCTM(aContext, 1.0f, -1.0f);
|
||||||
::CGContextDrawImage(aContext, CGRectMake(aX, -aY-aHeight, aWidth, aHeight), subImage);
|
::CGContextDrawImage(aContext,
|
||||||
|
CGRectMake(aX, -(CGFloat)aY - (CGFloat)aHeight,
|
||||||
|
aWidth, aHeight),
|
||||||
|
subImage);
|
||||||
|
|
||||||
::CGImageRelease(subImage);
|
::CGImageRelease(subImage);
|
||||||
::CGImageRelease(cgImage);
|
::CGImageRelease(cgImage);
|
||||||
|
Loading…
Reference in New Issue
Block a user