sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "BMDRAW.H"
|
sl@0
|
17 |
#include "BitDrawInterfaceId.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
// CDrawEightBppBitmapCommon
|
sl@0
|
20 |
//EColor256 screen/bitmap device might be scaled.
|
sl@0
|
21 |
//In this case right-bottom coordinate might go outside the drawing rectangle.
|
sl@0
|
22 |
//Then - we need to check that we do not try to draw something outside the drawing rectangle.
|
sl@0
|
23 |
|
sl@0
|
24 |
//Initializes iSize, iDrawRect, iLongWidth, iScanlineWords data members.
|
sl@0
|
25 |
//It should be called every time when iSize is going to be changed - from Construct().
|
sl@0
|
26 |
//@param aSize Physical screen size in pixels.
|
sl@0
|
27 |
//@panic EScreenDriverPanicInvalidSize - Invalid aSize parameter. This might happen if the
|
sl@0
|
28 |
//device is scaled and the scaling origin goes outside physical drawing rectangle.
|
sl@0
|
29 |
void CDrawEightBppBitmapCommon::SetSize(const TSize& aSize)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
CDrawBitmap::SetSize(aSize);
|
sl@0
|
32 |
__ASSERT_DEBUG(iSize == aSize, User::Invariant());
|
sl@0
|
33 |
iLongWidth = (iSize.iWidth + 3) & ~3;
|
sl@0
|
34 |
iScanLineWords = iLongWidth / 4;
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
TInt CDrawEightBppBitmapCommon::Construct(TSize aSize, TInt aStride)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
iBits = NULL;
|
sl@0
|
40 |
CDrawBitmap::SetSize(aSize);
|
sl@0
|
41 |
__ASSERT_DEBUG(iSize == aSize, User::Invariant());
|
sl@0
|
42 |
if (aStride & 3)
|
sl@0
|
43 |
return KErrArgument;
|
sl@0
|
44 |
iLongWidth = aStride;
|
sl@0
|
45 |
if (iLongWidth < aSize.iWidth)
|
sl@0
|
46 |
return KErrArgument;
|
sl@0
|
47 |
iScanLineWords = aStride >> 2;
|
sl@0
|
48 |
TInt size = Max(aSize.iWidth,aSize.iHeight);
|
sl@0
|
49 |
if(size < 0)
|
sl@0
|
50 |
return KErrArgument;
|
sl@0
|
51 |
iScanLineBuffer = (TUint32*)(User::Heap().Alloc(size));
|
sl@0
|
52 |
if(iScanLineBuffer == NULL)
|
sl@0
|
53 |
return KErrNoMemory;
|
sl@0
|
54 |
return KErrNone;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
//aX, aY - physical coordinates
|
sl@0
|
58 |
TUint8* CDrawEightBppBitmapCommon::PixelAddress(TInt aX,TInt aY) const
|
sl@0
|
59 |
{
|
sl@0
|
60 |
return (TUint8*)iBits + aY * iLongWidth + aX;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
void CDrawEightBppBitmapCommon::InvertBuffer(TInt aLength,TUint32* aBuffer)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
const TUint32* limit = aBuffer + (aLength + 3) / 4;
|
sl@0
|
66 |
|
sl@0
|
67 |
while (aBuffer < limit)
|
sl@0
|
68 |
*aBuffer++ ^= 0xffffffff;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
//CDrawEightBppBitmapCommon::ReadLine() called from CDrawBitmap::ReadLine()
|
sl@0
|
72 |
//aX and aY - physical coordinates.
|
sl@0
|
73 |
//Reads aLength pixel values and places them in aBuffer.
|
sl@0
|
74 |
//aBuffer size should be at least aLength.
|
sl@0
|
75 |
void CDrawEightBppBitmapCommon::ReadLine(TInt aX,TInt aY,TInt aLength,TAny* aBuffer) const
|
sl@0
|
76 |
{
|
sl@0
|
77 |
const TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
78 |
|
sl@0
|
79 |
if (iOrientation == EOrientationNormal && iScalingOff)
|
sl@0
|
80 |
Mem::Copy(aBuffer,pixelPtr,aLength);
|
sl@0
|
81 |
else
|
sl@0
|
82 |
{
|
sl@0
|
83 |
register TInt pixelPtrInc = LogicalPixelAddressIncrement();
|
sl@0
|
84 |
|
sl@0
|
85 |
TUint8* bufferPtr = static_cast <TUint8*> (aBuffer);
|
sl@0
|
86 |
const TUint8* bufferPtrLimit = bufferPtr + aLength;
|
sl@0
|
87 |
|
sl@0
|
88 |
while (bufferPtr < bufferPtrLimit)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
*bufferPtr++ = *pixelPtr;
|
sl@0
|
91 |
pixelPtr += pixelPtrInc;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
}
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
//CDrawEightBppBitmapCommon::WriteRgb() called from exported CDrawBitmap::WriteRgb()
|
sl@0
|
97 |
//aX, aY - physical coordinates
|
sl@0
|
98 |
void CDrawEightBppBitmapCommon::WriteRgb(TInt aX,TInt aY,TUint8 aPixel)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
register TUint8* pixelAddr = PixelAddress(aX, aY);
|
sl@0
|
101 |
if(iScalingOff)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
*pixelAddr = aPixel;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
else
|
sl@0
|
106 |
{
|
sl@0
|
107 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
108 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
109 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
110 |
SetPixels(pixelAddr, aPixel, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
111 |
}
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
//CDrawEightBppBitmapCommon::WriteBinary() called from exported CDrawBitmap::WriteBinary()
|
sl@0
|
115 |
//aX, aY - logical coordinates
|
sl@0
|
116 |
//"aData" parameter has "aHeight" 32 bits words
|
sl@0
|
117 |
//"aLength" parameter tells how many bits (up to 32) has to be used from each 32 bit word
|
sl@0
|
118 |
//This method is used for bitmap font symbols drawing
|
sl@0
|
119 |
//One possible optimization: If "no scaling" And "pixelPtrInc == 1" Then
|
sl@0
|
120 |
//writing could be made on 32 bits words (they has to be aligned before the operation)
|
sl@0
|
121 |
void CDrawEightBppBitmapCommon::WriteBinary(TInt aX,TInt aY,TUint32* aData,TInt aLength,
|
sl@0
|
122 |
TInt aHeight,TUint8 aPixel)
|
sl@0
|
123 |
{
|
sl@0
|
124 |
DeOrientate(aX,aY);//aX, aY - physical coordinates
|
sl@0
|
125 |
TInt pixelInc;
|
sl@0
|
126 |
TInt rowInc;
|
sl@0
|
127 |
SetPixelInc(pixelInc, rowInc);
|
sl@0
|
128 |
const TUint32* dataLimit = aData + aHeight;
|
sl@0
|
129 |
register TUint32 dataMaskLimit = (aLength < 32) ? 1 << aLength : 0;
|
sl@0
|
130 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
131 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
132 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
133 |
TInt orgY = aY;
|
sl@0
|
134 |
while (aData < dataLimit)
|
sl@0
|
135 |
{
|
sl@0
|
136 |
register TUint32 dataWord = *aData++;
|
sl@0
|
137 |
register TUint32 dataMask = 1;
|
sl@0
|
138 |
register TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
139 |
if(iScalingOff)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
while (dataMask != dataMaskLimit)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
if(dataWord & dataMask)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
*tempPixelPtr = aPixel;
|
sl@0
|
146 |
}
|
sl@0
|
147 |
tempPixelPtr += pixelInc;
|
sl@0
|
148 |
dataMask <<= 1;
|
sl@0
|
149 |
}
|
sl@0
|
150 |
}
|
sl@0
|
151 |
else
|
sl@0
|
152 |
{
|
sl@0
|
153 |
while (dataMask != dataMaskLimit)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
if(dataWord & dataMask)
|
sl@0
|
156 |
{
|
sl@0
|
157 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
158 |
SetPixels(tempPixelPtr, aPixel, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
159 |
}
|
sl@0
|
160 |
tempPixelPtr += pixelInc;
|
sl@0
|
161 |
dataMask <<= 1;
|
sl@0
|
162 |
IncScaledY(aY);
|
sl@0
|
163 |
}
|
sl@0
|
164 |
}
|
sl@0
|
165 |
pixelPtr += rowInc;
|
sl@0
|
166 |
IncScaledY(aY, orgY);
|
sl@0
|
167 |
}
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
//CDrawEightBppBitmapCommon::WriteBinaryOp() called from exported CDrawBitmap::WriteBinary()
|
sl@0
|
171 |
//aX, aY - logical coordinates
|
sl@0
|
172 |
//"aData" parameter has "aHeight" 32 bits words
|
sl@0
|
173 |
//"aLength" parameter tells how many bits (up to 32) has to be used from each 32 bit word
|
sl@0
|
174 |
//This method is used for bitmap font symbols drawing
|
sl@0
|
175 |
//One possible optimization: If "no scaling" And "pixelPtrInc == 1" Then
|
sl@0
|
176 |
//writing could be made on 32 bits words (they has to be aligned before the operation)
|
sl@0
|
177 |
void CDrawEightBppBitmapCommon::WriteBinaryOp(TInt aX,TInt aY,TUint32* aData,TInt aLength,
|
sl@0
|
178 |
TInt aHeight,TUint8 aPixel,
|
sl@0
|
179 |
CGraphicsContext::TDrawMode aDrawMode)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
if(aLength <= 0)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
return;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
DeOrientate(aX,aY);//aX, aY - physical coordinates
|
sl@0
|
186 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
187 |
const TUint32* dataPtrLimit = aData + aHeight;
|
sl@0
|
188 |
register TUint32 dataMaskLimit = (aLength < 32) ? 1 << aLength : 0;
|
sl@0
|
189 |
TInt pixelInc;
|
sl@0
|
190 |
TInt rowInc;
|
sl@0
|
191 |
SetPixelInc(pixelInc, rowInc);
|
sl@0
|
192 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
193 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
194 |
TInt orgY = aY;
|
sl@0
|
195 |
if(aPixel)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
while(aData < dataPtrLimit)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
register TUint32 dataWord = *aData++;
|
sl@0
|
200 |
register TUint32 dataMask = 1;
|
sl@0
|
201 |
register TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
202 |
if(iScalingOff)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
while(dataMask != dataMaskLimit)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
if(dataWord & dataMask)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
if(aDrawMode==CGraphicsContext::EDrawModeXOR)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
*tempPixelPtr ^= aPixel;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
else if(aDrawMode==CGraphicsContext::EDrawModeAND)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
*tempPixelPtr &= aPixel;
|
sl@0
|
215 |
}
|
sl@0
|
216 |
else if(aDrawMode==CGraphicsContext::EDrawModeOR)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
*tempPixelPtr |= aPixel;
|
sl@0
|
219 |
}
|
sl@0
|
220 |
}
|
sl@0
|
221 |
tempPixelPtr += pixelInc;
|
sl@0
|
222 |
dataMask <<= 1;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
}
|
sl@0
|
225 |
else
|
sl@0
|
226 |
{
|
sl@0
|
227 |
while(dataMask != dataMaskLimit)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
if(dataWord & dataMask)
|
sl@0
|
230 |
{
|
sl@0
|
231 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
232 |
if(aDrawMode==CGraphicsContext::EDrawModeXOR)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
XORPixels(tempPixelPtr, aPixel, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
else if(aDrawMode==CGraphicsContext::EDrawModeAND)
|
sl@0
|
237 |
{
|
sl@0
|
238 |
ANDPixels(tempPixelPtr, aPixel, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
239 |
}
|
sl@0
|
240 |
else if(aDrawMode==CGraphicsContext::EDrawModeOR)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
ORPixels(tempPixelPtr, aPixel, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
}
|
sl@0
|
245 |
tempPixelPtr += pixelInc;
|
sl@0
|
246 |
dataMask <<= 1;
|
sl@0
|
247 |
IncScaledY(aY);
|
sl@0
|
248 |
}
|
sl@0
|
249 |
}
|
sl@0
|
250 |
pixelPtr += rowInc;
|
sl@0
|
251 |
IncScaledY(aY, orgY);
|
sl@0
|
252 |
}
|
sl@0
|
253 |
}
|
sl@0
|
254 |
else if(aDrawMode==CGraphicsContext::EDrawModeAND)
|
sl@0
|
255 |
{
|
sl@0
|
256 |
while(aData < dataPtrLimit)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
register TUint32 dataWord = *aData++;
|
sl@0
|
259 |
register TUint32 dataMask = 1;
|
sl@0
|
260 |
register TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
261 |
if(iScalingOff)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
while(dataMask != dataMaskLimit)
|
sl@0
|
264 |
{
|
sl@0
|
265 |
if(dataWord & dataMask)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
*tempPixelPtr = 0;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
tempPixelPtr += pixelInc;
|
sl@0
|
270 |
dataMask <<= 1;
|
sl@0
|
271 |
}
|
sl@0
|
272 |
}
|
sl@0
|
273 |
else
|
sl@0
|
274 |
{
|
sl@0
|
275 |
while(dataMask != dataMaskLimit)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
if(dataWord & dataMask)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
280 |
SetPixels(tempPixelPtr, TUint8(0), pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
281 |
}
|
sl@0
|
282 |
tempPixelPtr += pixelInc;
|
sl@0
|
283 |
dataMask <<= 1;
|
sl@0
|
284 |
}
|
sl@0
|
285 |
}
|
sl@0
|
286 |
pixelPtr += rowInc;
|
sl@0
|
287 |
IncScaledY(aY, orgY);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
}
|
sl@0
|
290 |
}
|
sl@0
|
291 |
|
sl@0
|
292 |
//aX, aY - logical coordinates
|
sl@0
|
293 |
//"aData" parameter has 32 bits words
|
sl@0
|
294 |
//"aLength" parameter tells how many pixels have to be written
|
sl@0
|
295 |
//This method is used for bitmap font symbols vertical drawing
|
sl@0
|
296 |
//The method should not be called if the scaling is ON!
|
sl@0
|
297 |
void CDrawEightBppBitmapCommon::WriteBinaryLineVertical(TInt aX,TInt aY,TUint32* aData,
|
sl@0
|
298 |
TInt aLength,TUint8 aPixel,TBool aUp)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
__ASSERT_DEBUG(iScalingOff, User::Invariant());
|
sl@0
|
301 |
|
sl@0
|
302 |
DeOrientate(aX,aY);//aX, aY - physical coordinates
|
sl@0
|
303 |
|
sl@0
|
304 |
TInt scanlineByteLength;
|
sl@0
|
305 |
switch(iOrientation)
|
sl@0
|
306 |
{
|
sl@0
|
307 |
case EOrientationNormal:
|
sl@0
|
308 |
scanlineByteLength = iLongWidth;
|
sl@0
|
309 |
break;
|
sl@0
|
310 |
case EOrientationRotated90:
|
sl@0
|
311 |
scanlineByteLength = -1;
|
sl@0
|
312 |
break;
|
sl@0
|
313 |
case EOrientationRotated180:
|
sl@0
|
314 |
scanlineByteLength = -iLongWidth;
|
sl@0
|
315 |
break;
|
sl@0
|
316 |
default: // EOrientationRotated270
|
sl@0
|
317 |
scanlineByteLength = 1;
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
if (aUp)
|
sl@0
|
321 |
scanlineByteLength = -scanlineByteLength;
|
sl@0
|
322 |
|
sl@0
|
323 |
register TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
324 |
const TUint8* pixelPtrLimit = pixelPtr + aLength * scanlineByteLength;
|
sl@0
|
325 |
register TUint32 dataWord = *aData;
|
sl@0
|
326 |
register TUint32 dataMask = 1;
|
sl@0
|
327 |
|
sl@0
|
328 |
while(pixelPtr != pixelPtrLimit)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
if(!dataMask)
|
sl@0
|
331 |
{
|
sl@0
|
332 |
dataMask = 1;
|
sl@0
|
333 |
aData++;
|
sl@0
|
334 |
dataWord = *aData;
|
sl@0
|
335 |
}
|
sl@0
|
336 |
if(dataWord & dataMask)
|
sl@0
|
337 |
{
|
sl@0
|
338 |
*pixelPtr = aPixel;
|
sl@0
|
339 |
}
|
sl@0
|
340 |
dataMask <<= 1;
|
sl@0
|
341 |
pixelPtr += scanlineByteLength;
|
sl@0
|
342 |
}
|
sl@0
|
343 |
}
|
sl@0
|
344 |
|
sl@0
|
345 |
//CDrawEightBppBitmapCommon::WriteLine() called from CDrawBitmap::WriteLine()
|
sl@0
|
346 |
//aX and aY - physical coordinates
|
sl@0
|
347 |
void CDrawEightBppBitmapCommon::WriteLine(TInt aX,TInt aY,TInt aLength,TUint32* aBuffer)
|
sl@0
|
348 |
{
|
sl@0
|
349 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
350 |
if (iOrientation == EOrientationNormal && iScalingOff)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
Mem::Copy(pixelPtr,aBuffer,aLength);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
else
|
sl@0
|
355 |
{
|
sl@0
|
356 |
register TInt pixelPtrInc = LogicalPixelAddressIncrement();
|
sl@0
|
357 |
TUint8* bufferPtr = reinterpret_cast <TUint8*> (aBuffer);
|
sl@0
|
358 |
const TUint8* bufferPtrLimit = bufferPtr + aLength;
|
sl@0
|
359 |
if(iScalingOff)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
*pixelPtr = *bufferPtr++;
|
sl@0
|
364 |
pixelPtr += pixelPtrInc;
|
sl@0
|
365 |
}
|
sl@0
|
366 |
}
|
sl@0
|
367 |
else
|
sl@0
|
368 |
{
|
sl@0
|
369 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
370 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
371 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
374 |
SetPixels(pixelPtr, *bufferPtr++, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
375 |
pixelPtr += pixelPtrInc;
|
sl@0
|
376 |
IncScaledY(aY);
|
sl@0
|
377 |
}
|
sl@0
|
378 |
}
|
sl@0
|
379 |
}
|
sl@0
|
380 |
}
|
sl@0
|
381 |
|
sl@0
|
382 |
//CDrawEightBppBitmapCommon::WriteLineXOR() called from CDrawBitmap::WriteLine()
|
sl@0
|
383 |
//aX and aY - physical coordinates
|
sl@0
|
384 |
//One possible optimization: If "no scaling" And "pixelPtrInc == 1" Then
|
sl@0
|
385 |
//XOR could be made on 32 bits words (they has to be aligned before the operation)
|
sl@0
|
386 |
void CDrawEightBppBitmapCommon::WriteLineXOR(TInt aX,TInt aY,TInt aLength,TUint32* aBuffer)
|
sl@0
|
387 |
{
|
sl@0
|
388 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
389 |
register TInt pixelPtrInc = LogicalPixelAddressIncrement();
|
sl@0
|
390 |
TUint8* bufferPtr = reinterpret_cast <TUint8*> (aBuffer);
|
sl@0
|
391 |
const TUint8* bufferPtrLimit = bufferPtr + aLength;
|
sl@0
|
392 |
if(iScalingOff)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
*pixelPtr ^= *bufferPtr++;
|
sl@0
|
397 |
pixelPtr += pixelPtrInc;
|
sl@0
|
398 |
}
|
sl@0
|
399 |
}
|
sl@0
|
400 |
else
|
sl@0
|
401 |
{
|
sl@0
|
402 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
403 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
404 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
405 |
{
|
sl@0
|
406 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
407 |
XORPixels(pixelPtr, *bufferPtr++, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
408 |
pixelPtr += pixelPtrInc;
|
sl@0
|
409 |
IncScaledY(aY);
|
sl@0
|
410 |
}
|
sl@0
|
411 |
}
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
//CDrawEightBppBitmapCommon::WriteLineAND() called from CDrawBitmap::WriteLine()
|
sl@0
|
415 |
//aX and aY - deorientated and scaled
|
sl@0
|
416 |
//aLength - not scaled
|
sl@0
|
417 |
//One possible optimization: If "no scaling" And "pixelPtrInc == 1" Then
|
sl@0
|
418 |
//AND could be made on 32 bits words (they has to be aligned before the operation)
|
sl@0
|
419 |
void CDrawEightBppBitmapCommon::WriteLineAND(TInt aX,TInt aY,TInt aLength,TUint32* aBuffer)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
422 |
register TInt pixelPtrInc = LogicalPixelAddressIncrement();
|
sl@0
|
423 |
TUint8* bufferPtr = reinterpret_cast <TUint8*> (aBuffer);
|
sl@0
|
424 |
const TUint8* bufferPtrLimit = bufferPtr + aLength;
|
sl@0
|
425 |
if(iScalingOff)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
428 |
{
|
sl@0
|
429 |
*pixelPtr &= *bufferPtr++;
|
sl@0
|
430 |
pixelPtr += pixelPtrInc;
|
sl@0
|
431 |
}
|
sl@0
|
432 |
}
|
sl@0
|
433 |
else
|
sl@0
|
434 |
{
|
sl@0
|
435 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
436 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
437 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
440 |
ANDPixels(pixelPtr, *bufferPtr++, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
441 |
pixelPtr += pixelPtrInc;
|
sl@0
|
442 |
IncScaledY(aY);
|
sl@0
|
443 |
}
|
sl@0
|
444 |
}
|
sl@0
|
445 |
}
|
sl@0
|
446 |
|
sl@0
|
447 |
//CDrawEightBppBitmapCommon::WriteLineOR() called from CDrawBitmap::WriteLine()
|
sl@0
|
448 |
//aX and aY - physical coordinates
|
sl@0
|
449 |
//One possible optimization: If "no scaling" And "pixelPtrInc == 1" Then
|
sl@0
|
450 |
//OR could be made on 32 bits words (they has to be aligned before the operation)
|
sl@0
|
451 |
void CDrawEightBppBitmapCommon::WriteLineOR(TInt aX,TInt aY,TInt aLength,TUint32* aBuffer)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
454 |
register TInt pixelPtrInc = LogicalPixelAddressIncrement();
|
sl@0
|
455 |
TUint8* bufferPtr = reinterpret_cast <TUint8*> (aBuffer);
|
sl@0
|
456 |
const TUint8* bufferPtrLimit = bufferPtr + aLength;
|
sl@0
|
457 |
if(iScalingOff)
|
sl@0
|
458 |
{
|
sl@0
|
459 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
460 |
{
|
sl@0
|
461 |
*pixelPtr |= *bufferPtr++;
|
sl@0
|
462 |
pixelPtr += pixelPtrInc;
|
sl@0
|
463 |
}
|
sl@0
|
464 |
}
|
sl@0
|
465 |
else
|
sl@0
|
466 |
{
|
sl@0
|
467 |
const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
|
sl@0
|
468 |
const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
|
sl@0
|
469 |
while(bufferPtr < bufferPtrLimit)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
|
sl@0
|
472 |
ORPixels(pixelPtr, *bufferPtr++, pixelRowPtrLimit, bitsStart, bitsEnd);
|
sl@0
|
473 |
pixelPtr += pixelPtrInc;
|
sl@0
|
474 |
IncScaledY(aY);
|
sl@0
|
475 |
}
|
sl@0
|
476 |
}
|
sl@0
|
477 |
}
|
sl@0
|
478 |
|
sl@0
|
479 |
//CDrawEightBppBitmapCommon::WriteRgbMulti() called from CDrawBitmap::WriteRgbMulti()
|
sl@0
|
480 |
//aX and aY - physical coordinates
|
sl@0
|
481 |
//aLength and aRows - physical length and rows
|
sl@0
|
482 |
void CDrawEightBppBitmapCommon::WriteRgbMulti(TInt aX,TInt aY,TInt aLength,TInt aRows,
|
sl@0
|
483 |
TUint8 aPixel)
|
sl@0
|
484 |
{
|
sl@0
|
485 |
register TInt longWidth = iLongWidth;
|
sl@0
|
486 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
487 |
const TUint8* pixelRowPtrLimit = pixelPtr + aRows * longWidth;
|
sl@0
|
488 |
register const TUint8* bitsEnd = reinterpret_cast <const TUint8*> (iBits) + iLongWidth * iSize.iHeight;
|
sl@0
|
489 |
if(pixelRowPtrLimit >= bitsEnd)
|
sl@0
|
490 |
{
|
sl@0
|
491 |
pixelRowPtrLimit = bitsEnd;
|
sl@0
|
492 |
}
|
sl@0
|
493 |
|
sl@0
|
494 |
while (pixelPtr < pixelRowPtrLimit)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
Mem::Fill(pixelPtr,aLength,aPixel);
|
sl@0
|
497 |
pixelPtr += longWidth;
|
sl@0
|
498 |
}
|
sl@0
|
499 |
}
|
sl@0
|
500 |
|
sl@0
|
501 |
//CDrawEightBppBitmapCommon::WriteRgbMultiXOR() called from CDrawBitmap::WriteRgbMulti()
|
sl@0
|
502 |
//aX and aY - physical coordinates
|
sl@0
|
503 |
//aLength and aRows - physical length and rows
|
sl@0
|
504 |
void CDrawEightBppBitmapCommon::WriteRgbMultiXOR(TInt aX,TInt aY,TInt aLength,TInt aRows,
|
sl@0
|
505 |
TUint8 aPixel)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
register TInt longWidth = iLongWidth;
|
sl@0
|
508 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
509 |
TUint8* pixelPtrLimit = pixelPtr + aLength;
|
sl@0
|
510 |
const TUint8* pixelRowPtrLimit = pixelPtr + aRows * longWidth;
|
sl@0
|
511 |
register const TUint8* bitsEnd = reinterpret_cast <const TUint8*> (iBits) + iLongWidth * iSize.iHeight;
|
sl@0
|
512 |
if(pixelRowPtrLimit >= bitsEnd)
|
sl@0
|
513 |
{
|
sl@0
|
514 |
pixelRowPtrLimit = bitsEnd;
|
sl@0
|
515 |
}
|
sl@0
|
516 |
|
sl@0
|
517 |
while (pixelPtr < pixelRowPtrLimit)
|
sl@0
|
518 |
{
|
sl@0
|
519 |
TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
520 |
|
sl@0
|
521 |
while (tempPixelPtr < pixelPtrLimit)
|
sl@0
|
522 |
*tempPixelPtr++ ^= aPixel;
|
sl@0
|
523 |
|
sl@0
|
524 |
pixelPtr += longWidth;
|
sl@0
|
525 |
pixelPtrLimit += longWidth;
|
sl@0
|
526 |
}
|
sl@0
|
527 |
}
|
sl@0
|
528 |
|
sl@0
|
529 |
//CDrawEightBppBitmapCommon::WriteRgbMultiAND() called from CDrawBitmap::WriteRgbMulti()
|
sl@0
|
530 |
//aX and aY - physical coordinates
|
sl@0
|
531 |
//aLength and aRows - physical length and rows
|
sl@0
|
532 |
void CDrawEightBppBitmapCommon::WriteRgbMultiAND(TInt aX,TInt aY,TInt aLength,TInt aRows,
|
sl@0
|
533 |
TUint8 aPixel)
|
sl@0
|
534 |
{
|
sl@0
|
535 |
register TInt longWidth = iLongWidth;
|
sl@0
|
536 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
537 |
const TUint8* pixelPtrLimit = pixelPtr + aLength;
|
sl@0
|
538 |
const TUint8* pixelRowPtrLimit = pixelPtr + aRows * longWidth;
|
sl@0
|
539 |
register const TUint8* bitsEnd = reinterpret_cast <const TUint8*> (iBits) + iLongWidth * iSize.iHeight;
|
sl@0
|
540 |
if(pixelRowPtrLimit >= bitsEnd)
|
sl@0
|
541 |
{
|
sl@0
|
542 |
pixelRowPtrLimit = bitsEnd;
|
sl@0
|
543 |
}
|
sl@0
|
544 |
|
sl@0
|
545 |
while (pixelPtr < pixelRowPtrLimit)
|
sl@0
|
546 |
{
|
sl@0
|
547 |
TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
548 |
|
sl@0
|
549 |
while (tempPixelPtr < pixelPtrLimit)
|
sl@0
|
550 |
*tempPixelPtr++ &= aPixel;
|
sl@0
|
551 |
|
sl@0
|
552 |
pixelPtr += longWidth;
|
sl@0
|
553 |
pixelPtrLimit += longWidth;
|
sl@0
|
554 |
}
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
//CDrawEightBppBitmapCommon::WriteRgbMultiOR() called from CDrawBitmap::WriteRgbMulti()
|
sl@0
|
558 |
//aX and aY - physical coordinates
|
sl@0
|
559 |
//aLength and aRows - physical length and rows
|
sl@0
|
560 |
void CDrawEightBppBitmapCommon::WriteRgbMultiOR(TInt aX,TInt aY,TInt aLength,TInt aRows,TUint8 aPixel)
|
sl@0
|
561 |
{
|
sl@0
|
562 |
register TInt longWidth = iLongWidth;
|
sl@0
|
563 |
TUint8* pixelPtr = PixelAddress(aX,aY);
|
sl@0
|
564 |
TUint8* pixelPtrLimit = pixelPtr + aLength;
|
sl@0
|
565 |
const TUint8* pixelRowPtrLimit = pixelPtr + aRows * longWidth;
|
sl@0
|
566 |
register const TUint8* bitsEnd = reinterpret_cast <const TUint8*> (iBits) + iLongWidth * iSize.iHeight;
|
sl@0
|
567 |
if(pixelRowPtrLimit >= bitsEnd)
|
sl@0
|
568 |
{
|
sl@0
|
569 |
pixelRowPtrLimit = bitsEnd;
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
while (pixelPtr < pixelRowPtrLimit)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
TUint8* tempPixelPtr = pixelPtr;
|
sl@0
|
575 |
|
sl@0
|
576 |
while (tempPixelPtr < pixelPtrLimit)
|
sl@0
|
577 |
*tempPixelPtr++ |= aPixel;
|
sl@0
|
578 |
|
sl@0
|
579 |
pixelPtr += longWidth;
|
sl@0
|
580 |
pixelPtrLimit += longWidth;
|
sl@0
|
581 |
}
|
sl@0
|
582 |
}
|
sl@0
|
583 |
|
sl@0
|
584 |
/**
|
sl@0
|
585 |
Implementation for CFbsDrawDevice::GetInterface().
|
sl@0
|
586 |
Retrieves a pointer to a specified interface of CFbsDrawDevice implementation.
|
sl@0
|
587 |
@param aInterfaceId Interface identifier of the interface to be retrieved.
|
sl@0
|
588 |
@param aInterface Address of variable that retrieves the specified interface.
|
sl@0
|
589 |
@return KErrNone If the interface is supported, KErrNotSupported otherwise.
|
sl@0
|
590 |
*/
|
sl@0
|
591 |
|
sl@0
|
592 |
TInt CDrawEightBppBitmapCommon::GetInterface(TInt aInterfaceId, TAny*& aInterface)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
aInterface = NULL;
|
sl@0
|
595 |
TInt ret = KErrNotSupported;
|
sl@0
|
596 |
|
sl@0
|
597 |
if (aInterfaceId == KFastBlit2InterfaceID)
|
sl@0
|
598 |
{
|
sl@0
|
599 |
aInterface = static_cast<MFastBlit2*>(this);
|
sl@0
|
600 |
ret = KErrNone;
|
sl@0
|
601 |
}
|
sl@0
|
602 |
else
|
sl@0
|
603 |
return CDrawBitmap::GetInterface(aInterfaceId, aInterface);
|
sl@0
|
604 |
|
sl@0
|
605 |
return ret;
|
sl@0
|
606 |
}
|
sl@0
|
607 |
|
sl@0
|
608 |
/**
|
sl@0
|
609 |
CDrawEightBppBitmapCommon::WriteBitmapBlock() implementation.
|
sl@0
|
610 |
@internalTechnology
|
sl@0
|
611 |
@see MFastBlit2::WriteBitmapBlock()
|
sl@0
|
612 |
*/
|
sl@0
|
613 |
TInt CDrawEightBppBitmapCommon::WriteBitmapBlock(const TPoint& aDest,
|
sl@0
|
614 |
CFbsDrawDevice* aSrcDrawDevice,
|
sl@0
|
615 |
const TRect& aSrcRect)
|
sl@0
|
616 |
{
|
sl@0
|
617 |
__ASSERT_DEBUG(aSrcDrawDevice && ((aSrcDrawDevice->DisplayMode()==EColor256) || (aSrcDrawDevice->DisplayMode()==EGray256)), Panic(EScreenDriverPanicInvalidParameter));
|
sl@0
|
618 |
|
sl@0
|
619 |
TAny* interface=NULL;
|
sl@0
|
620 |
TInt ret = aSrcDrawDevice->GetInterface(KFastBlit2InterfaceID, interface);
|
sl@0
|
621 |
if (ret != KErrNone)
|
sl@0
|
622 |
{
|
sl@0
|
623 |
return KErrNotSupported;
|
sl@0
|
624 |
}
|
sl@0
|
625 |
|
sl@0
|
626 |
TAny* interface1=NULL;
|
sl@0
|
627 |
ret = aSrcDrawDevice->GetInterface(KScalingSettingsInterfaceID, interface1);
|
sl@0
|
628 |
if(ret != KErrNone || (interface1 && !reinterpret_cast<MScalingSettings*>(interface1)->IsScalingOff()))
|
sl@0
|
629 |
{
|
sl@0
|
630 |
return KErrNotSupported;
|
sl@0
|
631 |
}
|
sl@0
|
632 |
|
sl@0
|
633 |
ret = aSrcDrawDevice->GetInterface(KOrientationInterfaceID, interface1);
|
sl@0
|
634 |
if(ret != KErrNone || (interface1 && reinterpret_cast<MDrawDeviceOrientation*>(interface1)->Orientation() != 0))
|
sl@0
|
635 |
{
|
sl@0
|
636 |
return KErrNotSupported;
|
sl@0
|
637 |
}
|
sl@0
|
638 |
|
sl@0
|
639 |
ret = aSrcDrawDevice->GetInterface(KDrawDeviceOriginInterfaceID, interface1);
|
sl@0
|
640 |
if(ret != KErrNone)
|
sl@0
|
641 |
{
|
sl@0
|
642 |
return KErrNotSupported;
|
sl@0
|
643 |
}
|
sl@0
|
644 |
|
sl@0
|
645 |
if(interface1)
|
sl@0
|
646 |
{
|
sl@0
|
647 |
TPoint pt;
|
sl@0
|
648 |
reinterpret_cast<MDrawDeviceOrigin*>(interface1)->Get(pt);
|
sl@0
|
649 |
if(pt.iX != 0 || pt.iY != 0)
|
sl@0
|
650 |
{
|
sl@0
|
651 |
return KErrNotSupported;
|
sl@0
|
652 |
}
|
sl@0
|
653 |
}
|
sl@0
|
654 |
|
sl@0
|
655 |
const TUint32* srcBase = reinterpret_cast<MFastBlit2*>(interface)->Bits();
|
sl@0
|
656 |
__ASSERT_DEBUG(srcBase!=NULL, Panic(EScreenDriverPanicInvalidParameter));
|
sl@0
|
657 |
TInt srcStride = aSrcDrawDevice->ScanLineBytes();
|
sl@0
|
658 |
__ASSERT_DEBUG((srcStride&3)==0, Panic(EScreenDriverPanicInvalidParameter)); // stride is assumed to be a multiple of 4
|
sl@0
|
659 |
TSize srcSize = aSrcDrawDevice->SizeInPixels();
|
sl@0
|
660 |
|
sl@0
|
661 |
return WriteBitmapBlock(aDest, srcBase, srcStride, srcSize, aSrcRect);
|
sl@0
|
662 |
}
|
sl@0
|
663 |
|
sl@0
|
664 |
|
sl@0
|
665 |
/**
|
sl@0
|
666 |
CDrawEightBppBitmapCommon::WriteBitmapBlock() implementation.
|
sl@0
|
667 |
@internalTechnology
|
sl@0
|
668 |
@see MFastBlit2::WriteBitmapBlock()
|
sl@0
|
669 |
*/
|
sl@0
|
670 |
TInt CDrawEightBppBitmapCommon::WriteBitmapBlock(const TPoint& aDest,
|
sl@0
|
671 |
const TUint32* aSrcBase,
|
sl@0
|
672 |
TInt aSrcStride,
|
sl@0
|
673 |
const TSize& aSrcSize,
|
sl@0
|
674 |
const TRect& aSrcRect)
|
sl@0
|
675 |
{
|
sl@0
|
676 |
__ASSERT_DEBUG(aSrcBase, Panic(EScreenDriverPanicInvalidParameter));
|
sl@0
|
677 |
__ASSERT_DEBUG((aSrcStride&3)==0, Panic(EScreenDriverPanicInvalidParameter));
|
sl@0
|
678 |
__ASSERT_DEBUG(iBits, Panic(EScreenDriverPanicInvalidPointer));
|
sl@0
|
679 |
|
sl@0
|
680 |
if (iShadowMode!=NULL ||
|
sl@0
|
681 |
(iUserDispMode!=NULL && iUserDispMode!=iDispMode) ||
|
sl@0
|
682 |
iOrientation!=EOrientationNormal ||
|
sl@0
|
683 |
!IsScalingOff() ||
|
sl@0
|
684 |
!iOriginIsZero)
|
sl@0
|
685 |
{
|
sl@0
|
686 |
return KErrNotSupported;
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
__ASSERT_DEBUG(aSrcRect.iTl.iX >= 0, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
690 |
__ASSERT_DEBUG(aSrcRect.iTl.iY >= 0, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
691 |
__ASSERT_DEBUG(aSrcRect.iBr.iX <= aSrcSize.iWidth, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
692 |
__ASSERT_DEBUG(aSrcRect.iBr.iY <= aSrcSize.iHeight, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
693 |
__ASSERT_DEBUG(aDest.iX >= 0, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
694 |
__ASSERT_DEBUG(aDest.iY >= 0, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
695 |
__ASSERT_DEBUG((aDest.iX + aSrcRect.Width()) <= SizeInPixels().iWidth, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
696 |
__ASSERT_DEBUG((aDest.iY + aSrcRect.Height()) <= SizeInPixels().iHeight, Panic(EScreenDriverPanicOutOfBounds));
|
sl@0
|
697 |
|
sl@0
|
698 |
const TInt srcStride8 = aSrcStride;
|
sl@0
|
699 |
const TInt dstStride8 = iScanLineWords << 2;
|
sl@0
|
700 |
|
sl@0
|
701 |
if (aSrcSize.iWidth == aSrcRect.Width() &&
|
sl@0
|
702 |
aSrcSize.iWidth == SizeInPixels().iWidth &&
|
sl@0
|
703 |
srcStride8 == dstStride8)
|
sl@0
|
704 |
{
|
sl@0
|
705 |
// Optimum case - one memcpy
|
sl@0
|
706 |
__ASSERT_DEBUG(aSrcRect.iTl.iX==0 && aDest.iX==0, Panic(EScreenDriverPanicInvalidParameter)); // this is implied by the above conditions
|
sl@0
|
707 |
const TUint32* srcPtr = aSrcBase + (iScanLineWords * aSrcRect.iTl.iY);
|
sl@0
|
708 |
TUint32* dstPtr = iBits + (iScanLineWords * aDest.iY);
|
sl@0
|
709 |
const TInt length = aSrcStride * aSrcRect.Height();
|
sl@0
|
710 |
Mem::Move(dstPtr, srcPtr, length);
|
sl@0
|
711 |
return KErrNone;
|
sl@0
|
712 |
}
|
sl@0
|
713 |
|
sl@0
|
714 |
// Sub-optimal case - one memcpy per line
|
sl@0
|
715 |
const TUint8* srcPtr = (TUint8*)aSrcBase + (srcStride8 * aSrcRect.iTl.iY) + aSrcRect.iTl.iX;
|
sl@0
|
716 |
TUint8* dstPtr = (TUint8*)iBits + (dstStride8 * aDest.iY ) + aDest.iX;
|
sl@0
|
717 |
const TInt length = aSrcRect.Width();
|
sl@0
|
718 |
TInt lines = aSrcRect.Height();
|
sl@0
|
719 |
while (lines--)
|
sl@0
|
720 |
{
|
sl@0
|
721 |
Mem::Copy(dstPtr, srcPtr, length);
|
sl@0
|
722 |
srcPtr += srcStride8;
|
sl@0
|
723 |
dstPtr += dstStride8;
|
sl@0
|
724 |
}
|
sl@0
|
725 |
return KErrNone;
|
sl@0
|
726 |
}
|
sl@0
|
727 |
|
sl@0
|
728 |
|
sl@0
|
729 |
/**
|
sl@0
|
730 |
CDrawEightBppBitmapCommon::Bits() implementation.
|
sl@0
|
731 |
@internalTechnology
|
sl@0
|
732 |
@see MFastBlit2::Bits()
|
sl@0
|
733 |
*/
|
sl@0
|
734 |
const TUint32* CDrawEightBppBitmapCommon::Bits() const
|
sl@0
|
735 |
{
|
sl@0
|
736 |
return iBits;
|
sl@0
|
737 |
}
|