Kaydet (Commit) ed2f0490 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Avoid a couple of pointless constant variables

Change-Id: If1dcb577d2dcc6477f43ad1be0e970e08d9093c6
üst 590d851f
......@@ -1458,8 +1458,6 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY )
return COL_BLACK;
}
// prepare creation of matching a CGBitmapContext
CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big;
#if defined OSL_BIGENDIAN
struct{ unsigned char b, g, r, a; } aPixel;
#else
......@@ -1469,8 +1467,8 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY )
// create a one-pixel bitmap context
// TODO: is it worth to cache it?
CGContextRef xOnePixelContext =
CGBitmapContextCreate( &aPixel, 1, 1, 8, sizeof(aPixel),
aCGColorSpace, aCGBmpInfo );
CGBitmapContextCreate( &aPixel, 1, 1, 8, 32,
GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big );
CG_TRACE( "CGBitmapContextCreate(1x1x8) = " << xOnePixelContext );
......
......@@ -184,8 +184,6 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
if( mnBitmapDepth && (mnBitmapDepth < 16) )
{
mnBitmapDepth = 8; // TODO: are 1bit vdevs worth it?
const CGColorSpaceRef aCGColorSpace = GetSalData()->mxGraySpace;
const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNone;
const int nBytesPerRow = (mnBitmapDepth * nDX + 7) / 8;
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
......@@ -194,7 +192,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
((sal_uInt8*)pRawData)[i] = (i & 0xFF);
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
mnBitmapDepth, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
mnBitmapDepth, nBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone );
CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x" << mnBitmapDepth << ") = " << mxBitmapContext );
xCGContext = mxBitmapContext;
}
......@@ -233,8 +231,6 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
{
// fall back to a bitmap context
mnBitmapDepth = 32;
const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst;
const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
......@@ -243,15 +239,13 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
((sal_uInt8*)pRawData)[i] = (i & 0xFF);
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
8, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
8, nBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
xCGContext = mxBitmapContext;
}
}
#else
mnBitmapDepth = 32;
const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst;
const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
......@@ -260,7 +254,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
((sal_uInt8*)pRawData)[i] = (i & 0xFF);
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
8, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
8, nBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
xCGContext = mxBitmapContext;
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment