graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl
branchRCL_3
changeset 7 5e51caaeeb72
parent 2 5e30ef2e26cb
child 19 bbf46f59e123
--- a/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Tue Apr 27 17:59:32 2010 +0300
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Tue May 11 17:25:23 2010 +0300
@@ -175,10 +175,15 @@
 		}
 
 	// Need to update size, scan line size, etc.
+	CGenericScreenDevice::SetSize(newSize);
+	
+	// Setting iScanLineWords MUST occur after the call to SetSize because SetSize itself
+	// sets iScanLineBytes to support offscreen bitmaps and may do so incorrectly for hardware devices
+	// as it just uses the width, whereas BytesPerScanline takes into account any extra bytes needed
+	// as defined by the hardware.
 	CGenericScreenDevice::iScanLineWords = CGenericScreenDevice::iHelper.BytesPerScanline() / 4;	 //presumption here that BPS is always mod4.
 	CGenericScreenDevice::iBits = (TUint32*)CGenericScreenDevice::iHelper.AddressFirstPixel();
 	__ASSERT_ALWAYS(CGenericScreenDevice::iScanLineWords && CGenericScreenDevice::iBits,Panic(EScreenDriverPanicInvalidHalValue));
-	CGenericScreenDevice::SetSize(newSize);
 
 	return ETrue;
 	}
@@ -216,10 +221,15 @@
 		}
 
 	// Need to update size, scan line size, etc.
+	CGenericScreenDevice::SetSize(newSize);
+	
+	// Setting iScanLineWords MUST occur after the call to SetSize because SetSize itself
+	// sets iScanLineBytes to support offscreen bitmaps and may do so incorrectly for hardware devices
+	// as it just uses the width, whereas BytesPerScanline takes into account any extra bytes needed
+	// as defined by the hardware.
 	CGenericScreenDevice::iScanLineWords = CGenericScreenDevice::iHelper.BytesPerScanline() / 4;	 //presumption here that BPS is always mod4.
 	CGenericScreenDevice::iBits = (TUint32*)CGenericScreenDevice::iHelper.AddressFirstPixel();
 	__ASSERT_ALWAYS(CGenericScreenDevice::iScanLineWords && CGenericScreenDevice::iBits,Panic(EScreenDriverPanicInvalidHalValue));
-	CGenericScreenDevice::SetSize(newSize);
 
 	return ETrue;
 	}