244 #endif |
244 #endif |
245 |
245 |
246 // Initialize canvas |
246 // Initialize canvas |
247 canvasGc.SetDefaults(); |
247 canvasGc.SetDefaults(); |
248 |
248 |
|
249 // Ensure that all regions have been shifted to correct origin (before calculating iFullUpdateRegion). |
|
250 UpdateBufferUpdateRegions(aPos); |
|
251 |
249 // Make sure we got up to date update reagion |
252 // Make sure we got up to date update reagion |
250 iFullUpdateRegion.Clear(); |
253 iFullUpdateRegion.Clear(); |
251 TInt bufferCount = iCommandBuffers.Count(); |
254 TInt bufferCount = iCommandBuffers.Count(); |
252 for (TInt cb = 0; cb < bufferCount; cb++) |
255 for (TInt cb = 0; cb < bufferCount; cb++) |
253 { |
256 { |
311 TBool cachePrepared = !HasCommandBuffersWithoutFlags(EHuiCanvasBufferStatusDrawn) || !iCanvasWsGc->IsRenderBufferEnabled(); |
314 TBool cachePrepared = !HasCommandBuffersWithoutFlags(EHuiCanvasBufferStatusDrawn) || !iCanvasWsGc->IsRenderBufferEnabled(); |
312 |
315 |
313 /* Begin draw. If render buffer is used this sets up the render buffer if needed */ |
316 /* Begin draw. If render buffer is used this sets up the render buffer if needed */ |
314 iCanvasWsGc->BeginActionL(aAction,aDisplayRect,aUser,cachePrepared,iFullUpdateRegion); |
317 iCanvasWsGc->BeginActionL(aAction,aDisplayRect,aUser,cachePrepared,iFullUpdateRegion); |
315 |
318 |
316 TBool isFullUpdateRegionCleared = EFalse; |
|
317 if(iShapeRegionClearingPending) |
319 if(iShapeRegionClearingPending) |
318 { |
320 { |
319 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
321 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
320 RDebug::Print(_L(">> CHuiCanvasWsPainter::HandleBufferL - Clearing fullupdateregion")); |
322 RDebug::Print(_L(">> CHuiCanvasWsPainter::HandleBufferL - Clearing fullupdateregion")); |
321 #endif |
323 #endif |
322 // Clear the window update region area |
324 // Clear the window update region area |
323 TBool doClear = ETrue; |
325 TBool doClear = ETrue; |
324 iCanvasWsGc->EnableUpdateRegion(iFullUpdateRegion, doClear); |
326 iCanvasWsGc->EnableUpdateRegion(iFullUpdateRegion, doClear); |
325 iCanvasWsGc->DisableUpdateRegion(); |
327 iCanvasWsGc->DisableUpdateRegion(); |
326 isFullUpdateRegionCleared = ETrue; |
|
327 iShapeRegionClearingPending = EFalse; |
328 iShapeRegionClearingPending = EFalse; |
328 } |
329 } |
329 |
330 |
330 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
331 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
331 if (iCanvasWsGc->IsRenderBufferEnabled()) |
332 if (iCanvasWsGc->IsRenderBufferEnabled()) |
470 TPoint& aPos, |
471 TPoint& aPos, |
471 TBool aIgnoreUnChangedBuffers, |
472 TBool aIgnoreUnChangedBuffers, |
472 TBool aIgnoreClippedBuffers, |
473 TBool aIgnoreClippedBuffers, |
473 TBool aIgnoreHandledBuffers, |
474 TBool aIgnoreHandledBuffers, |
474 TBool aClearBeforeHandlingBuffers) |
475 TBool aClearBeforeHandlingBuffers) |
475 { |
476 { |
476 UpdateBufferUpdateRegions(aPos); |
|
477 |
|
478 TInt bufferCount = iCommandBuffers.Count(); |
477 TInt bufferCount = iCommandBuffers.Count(); |
479 for (TInt cb = 0; cb < bufferCount; cb++) |
478 for (TInt cb = 0; cb < bufferCount; cb++) |
480 { |
479 { |
481 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
480 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
482 |
481 |
619 { |
618 { |
620 buf->iOrientation = iCanvasVisual->Display()->Orientation(); |
619 buf->iOrientation = iCanvasVisual->Display()->Orientation(); |
621 } |
620 } |
622 DoHandleBufferStringL(-1, aDisplayRect, aAction, aUser, aGc, aPos, cmds, buf); |
621 DoHandleBufferStringL(-1, aDisplayRect, aAction, aUser, aGc, aPos, cmds, buf); |
623 CleanupStack::PopAndDestroy(); |
622 CleanupStack::PopAndDestroy(); |
|
623 } |
|
624 |
|
625 void CHuiCanvasWsPainter::DoPeekBufferAndUpdateShapeRegionL() |
|
626 { |
|
627 TBool hadShapeRegion = iShapeRegionAvailable; |
|
628 iShapeRegionAvailable = EFalse; |
|
629 |
|
630 TInt latest = iCommandBuffers.Count() - 1; |
|
631 DoPeekBufferL(latest); |
|
632 |
|
633 if (hadShapeRegion && !iShapeRegionAvailable) |
|
634 { |
|
635 // Previously we had shape region, but not any more. |
|
636 // So refresh update regions. |
|
637 iShapeRegionClearingPending = ETrue; |
|
638 iShapeRegionClippingPending = ETrue; |
|
639 } |
624 } |
640 } |
625 |
641 |
626 void CHuiCanvasWsPainter::DoPeekBufferL(TInt aIndex) |
642 void CHuiCanvasWsPainter::DoPeekBufferL(TInt aIndex) |
627 { |
643 { |
628 RMemReadStream& readerStream = iWsCommandBufferReader->Stream(); |
644 RMemReadStream& readerStream = iWsCommandBufferReader->Stream(); |
1268 |
1284 |
1269 void CHuiCanvasWsPainter::SetCommandSetL( const TDesC8& aCommands ) |
1285 void CHuiCanvasWsPainter::SetCommandSetL( const TDesC8& aCommands ) |
1270 { |
1286 { |
1271 CHuiCanvasPainter::SetCommandSetL(aCommands); |
1287 CHuiCanvasPainter::SetCommandSetL(aCommands); |
1272 |
1288 |
1273 TInt latest = iCommandBuffers.Count() - 1; |
1289 DoPeekBufferAndUpdateShapeRegionL(); |
1274 DoPeekBufferL(latest); |
|
1275 SelectGcL(); |
1290 SelectGcL(); |
1276 |
1291 |
1277 // If shape region has changed recalculate all update regions and remove redundant buffers |
1292 // If shape region has changed recalculate all update regions and remove redundant buffers |
1278 if (iShapeRegionClippingPending) |
1293 if (iShapeRegionClippingPending) |
1279 { |
1294 { |
1280 TInt bufferCount = iCommandBuffers.Count(); |
1295 ApplyShapeRegion(); |
1281 for (TInt cb = 0; cb < bufferCount; cb++) |
|
1282 { |
|
1283 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
|
1284 cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion); |
|
1285 cmdbuffer->iUpdateRegion.Intersect(iShapeRegion); |
|
1286 cmdbuffer->iUpdateRegion.Tidy(); |
|
1287 } |
|
1288 iShapeRegionClippingPending = EFalse; |
|
1289 RemoveRedundantBuffers(); |
1296 RemoveRedundantBuffers(); |
1290 } |
1297 } |
1291 |
1298 |
1292 // Release currently cached images. |
1299 // Release currently cached images. |
1293 // They may still be taken into use after next HandleBuffferL call. |
1300 // They may still be taken into use after next HandleBuffferL call. |
1305 TTime startTime; |
1312 TTime startTime; |
1306 startTime.UniversalTime(); |
1313 startTime.UniversalTime(); |
1307 #endif |
1314 #endif |
1308 |
1315 |
1309 CHuiCanvasPainter::ClearCommandSet(); |
1316 CHuiCanvasPainter::ClearCommandSet(); |
|
1317 |
|
1318 iShapeRegionAvailable = EFalse; |
|
1319 |
1310 // Release currently cached images. |
1320 // Release currently cached images. |
1311 // They may still be taken into use after next HandleBuffferL call. |
1321 // They may still be taken into use after next HandleBufferL call. |
1312 if (iCanvasVisual) |
1322 if (iCanvasVisual) |
1313 { |
1323 { |
1314 iCanvasVisual->Env().CanvasTextureCache().ReleaseAllCachedEntries(*iCanvasVisual); |
1324 iCanvasVisual->Env().CanvasTextureCache().ReleaseAllCachedEntries(*iCanvasVisual); |
1315 } |
1325 } |
1316 |
1326 |
1336 TTime startTime; |
1346 TTime startTime; |
1337 startTime.UniversalTime(); |
1347 startTime.UniversalTime(); |
1338 #endif |
1348 #endif |
1339 |
1349 |
1340 CHuiCanvasPainter::AddCommandSetL(aMoreCommands); |
1350 CHuiCanvasPainter::AddCommandSetL(aMoreCommands); |
1341 TInt latest = iCommandBuffers.Count() - 1; |
1351 DoPeekBufferAndUpdateShapeRegionL(); |
1342 DoPeekBufferL(latest); |
|
1343 SelectGcL(); |
1352 SelectGcL(); |
1344 |
1353 |
1345 // If shape region has changed recalculate all update regions |
1354 ApplyShapeRegion(); |
1346 if (iShapeRegionClippingPending) |
|
1347 { |
|
1348 TInt bufferCount = iCommandBuffers.Count(); |
|
1349 for (TInt cb = 0; cb < bufferCount; cb++) |
|
1350 { |
|
1351 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
|
1352 cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion); |
|
1353 cmdbuffer->iUpdateRegion.Intersect(iShapeRegion); |
|
1354 cmdbuffer->iUpdateRegion.Tidy(); |
|
1355 } |
|
1356 iShapeRegionClippingPending = EFalse; |
|
1357 } |
|
1358 |
1355 |
1359 RemoveRedundantBuffers(); |
1356 RemoveRedundantBuffers(); |
1360 |
1357 |
1361 // New command set may contain BitBlt commands |
1358 // New command set may contain BitBlt commands |
1362 // and those cached images must be refreshed |
1359 // and those cached images must be refreshed |
2140 TInt count = iTempRegion.Count(); |
2137 TInt count = iTempRegion.Count(); |
2141 TRect displayRect = iCanvasVisual->DisplayRect(); |
2138 TRect displayRect = iCanvasVisual->DisplayRect(); |
2142 for (TInt i=count-1; i>=0; i--) |
2139 for (TInt i=count-1; i>=0; i--) |
2143 { |
2140 { |
2144 TRect rect = iTempRegion[i]; |
2141 TRect rect = iTempRegion[i]; |
2145 TRect screen = iCanvasVisual->Display()->VisibleArea(); |
2142 |
2146 if (rect.Intersects(screen) || rect == screen) |
2143 // - Sometimes updateregion is outiside window (WSERV...why?!) |
2147 { |
2144 // We clip it here to avoid ui probs. |
2148 // - Sometimes updateregion is outiside window (WSERV...why?!) |
2145 // - Lets remove this for now, this seems to break scrollbars again |
2149 // We clip it here to avoid ui probs. |
2146 // when window parent-child relations work.. |
2150 // - Lets remove this for now, this seems to break scrollbars again |
2147 // - Hmm, should we add this anyway because now the idle softkeys are lost again in landscape mode ? |
2151 // when window parent-child relations work.. |
2148 // - Added again after WSERV fix in the window parent-child relations |
2152 // - Hmm, should we add this anyway because now the idle softkeys are lost again in landscape mode ? |
2149 // - Rect may be outside the screen and that's fine (Visual may be moved later). |
2153 // - Added again after WSERV fix in the window parent-child relations |
|
2154 #ifndef HUI_DISABLE_CANVAS_VISUAL_CLIPPING |
2150 #ifndef HUI_DISABLE_CANVAS_VISUAL_CLIPPING |
2155 rect.Intersection(displayRect); |
2151 rect.Intersection(displayRect); |
2156 #endif |
2152 #endif |
2157 iCommandBuffers[aIndex]->iUpdateRegion.AddRect(rect); |
2153 iCommandBuffers[aIndex]->iUpdateRegion.AddRect(rect); |
2158 iCommandBuffers[aIndex]->iOriginalUpdateRegion.AddRect(rect); |
2154 iCommandBuffers[aIndex]->iOriginalUpdateRegion.AddRect(rect); |
2159 } |
|
2160 else |
|
2161 { |
|
2162 #ifdef _DEBUG |
|
2163 RDebug::Print(_L("CHuiCanvasWsPainter::WsSetUpdateRegionL: Incorrect update region removed from buffer, this should not happen !")); |
|
2164 #endif |
|
2165 } |
|
2166 } |
2155 } |
2167 |
2156 |
2168 // Combine areas that are next to each others |
2157 // Combine areas that are next to each others |
2169 iCommandBuffers[aIndex]->iUpdateRegion.Tidy(); |
2158 iCommandBuffers[aIndex]->iUpdateRegion.Tidy(); |
2170 iCommandBuffers[aIndex]->iOriginalUpdateRegion.Tidy(); |
2159 iCommandBuffers[aIndex]->iOriginalUpdateRegion.Tidy(); |
2208 // Note: The "set shape" command looks to be used only if it really is different from |
2197 // Note: The "set shape" command looks to be used only if it really is different from |
2209 // the window rect. So there is no need to check if the shape region is relevant. |
2198 // the window rect. So there is no need to check if the shape region is relevant. |
2210 iShapeRegion.Copy(iTempRegion); |
2199 iShapeRegion.Copy(iTempRegion); |
2211 |
2200 |
2212 // note: iUpdateRegion will be updated later, set flags to indicate pending |
2201 // note: iUpdateRegion will be updated later, set flags to indicate pending |
|
2202 iShapeRegionAvailable = ETrue; |
|
2203 iShapeRegionOrigin = iCanvasVisual->DisplayRect().Round().iTl; |
|
2204 |
2213 iShapeRegionClearingPending = ETrue; |
2205 iShapeRegionClearingPending = ETrue; |
2214 iShapeRegionClippingPending = ETrue; |
2206 iShapeRegionClippingPending = ETrue; |
2215 } |
2207 } |
2216 |
2208 |
2217 |
2209 |
2218 #ifdef _DEBUG |
2210 #ifdef _DEBUG |
2219 if (iShapeRegion.Count() == 0 && iTempRegion.Count() > 0) |
2211 if (iShapeRegion.Count() == 0 && iTempRegion.Count() > 0) |
2220 { |
2212 { |
2221 HUI_DEBUG(_L("CHuiCanvasWsPainter::WsSetShapeRegionL. Error: iShapeRegion not set by any command buffer! However, there exists at least one command buffer that has shape region command.")); |
2213 HUI_DEBUG(_L("CHuiCanvasWsPainter::WsSetShapeRegionL. Error: iShapeRegion not set by any command buffer! However, there exists at least one command buffer that has shape region command.")); |
2222 } |
2214 } |
2223 #endif |
2215 #endif |
2224 } |
2216 } |
2225 |
2217 |
2226 void CHuiCanvasWsPainter::DoDigestPaddingL() |
2218 void CHuiCanvasWsPainter::DoDigestPaddingL() |
2227 { |
2219 { |
2266 TBool didRemoveBuffers = EFalse; |
2258 TBool didRemoveBuffers = EFalse; |
2267 TInt originalBufferCount = iCommandBuffers.Count(); |
2259 TInt originalBufferCount = iCommandBuffers.Count(); |
2268 |
2260 |
2269 RemoveBuffersWithoutRealDrawing(); |
2261 RemoveBuffersWithoutRealDrawing(); |
2270 |
2262 |
2271 // Remove buffers only with moved display rect and modify the clip region |
2263 // Don't remove command buffers with modified display rect. |
2272 // of buffers with changed size instead of completely removing all. |
2264 // Instead, apply clipping. |
2273 RemoveBuffersWithMovedDisplayRect(); |
2265 //RemoveBuffersWithMovedDisplayRect(); |
2274 ModifyBuffersWithChangedDisplayRect(); |
2266 ModifyBuffersWithChangedDisplayRect(); |
2275 //RemoveBuffersWithOldDisplayRect(); |
2267 //RemoveBuffersWithOldDisplayRect(); |
2276 |
2268 |
2277 RemoveBuffersWithEmptyUpdateRegion(); |
2269 RemoveBuffersWithEmptyUpdateRegion(); |
2278 RemoveBuffersWithOverlappingUpdateRegion(); |
2270 RemoveBuffersWithOverlappingUpdateRegion(); |
2302 void CHuiCanvasWsPainter::ModifyBuffersWithChangedDisplayRect() |
2294 void CHuiCanvasWsPainter::ModifyBuffersWithChangedDisplayRect() |
2303 { |
2295 { |
2304 TInt bufferCount = iCommandBuffers.Count(); |
2296 TInt bufferCount = iCommandBuffers.Count(); |
2305 TRect canvasRect = iCanvasVisual->DisplayRect().Round(); |
2297 TRect canvasRect = iCanvasVisual->DisplayRect().Round(); |
2306 TRegionFix<1> region(canvasRect); |
2298 TRegionFix<1> region(canvasRect); |
|
2299 |
|
2300 // We must first offset to canvasRect.iTl, otherwise region clipping doesn't work. |
|
2301 UpdateBufferUpdateRegions(canvasRect.iTl); |
2307 |
2302 |
2308 // If the buffers have different update region than CanvasVisual, clip |
2303 // If the buffers have different update region than CanvasVisual, clip |
2309 // the drawing to canvas visual's & cmdbuffer's updateregions' intersection. |
2304 // the drawing to canvas visual's & cmdbuffer's updateregions' intersection. |
2310 for (TInt cb = 0; cb < bufferCount; cb++) |
2305 for (TInt cb = 0; cb < bufferCount; cb++) |
2311 { |
2306 { |
2312 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
2307 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
2313 if (cmdbuffer->iOriginalDisplayRect.Round() != canvasRect) |
2308 TRect bufRect = cmdbuffer->iOriginalDisplayRect.Round(); |
|
2309 |
|
2310 if (bufRect != canvasRect) |
2314 { |
2311 { |
2315 cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion); |
2312 cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion); |
|
2313 |
|
2314 TPoint deltaPos = cmdbuffer->iPositionForUpdateRegion - cmdbuffer->iOriginalDisplayRect.Round().iTl; |
|
2315 cmdbuffer->iUpdateRegion.Offset(deltaPos); |
|
2316 |
2316 cmdbuffer->iUpdateRegion.Intersect(region); |
2317 cmdbuffer->iUpdateRegion.Intersect(region); |
|
2318 |
|
2319 if ( iShapeRegionAvailable ) |
|
2320 { |
|
2321 TranslateShapeRegion(cmdbuffer->iPositionForUpdateRegion); |
|
2322 cmdbuffer->iUpdateRegion.Intersect(iShapeRegion); |
|
2323 } |
|
2324 |
2317 cmdbuffer->iUpdateRegion.Tidy(); |
2325 cmdbuffer->iUpdateRegion.Tidy(); |
2318 } |
2326 } |
2319 } |
2327 } |
2320 } |
2328 } |
2321 |
2329 |
2381 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
2389 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
2382 for (TInt j=0; j < cmdbuffer->iOriginalUpdateRegion.Count();j++) |
2390 for (TInt j=0; j < cmdbuffer->iOriginalUpdateRegion.Count();j++) |
2383 { |
2391 { |
2384 iTempRegion.AddRect(cmdbuffer->iOriginalUpdateRegion[j]); |
2392 iTempRegion.AddRect(cmdbuffer->iOriginalUpdateRegion[j]); |
2385 } |
2393 } |
2386 |
2394 |
|
2395 // Translate region to be relative to visual top left corner. |
|
2396 TPoint offset = -cmdbuffer->iOriginalDisplayRect.Round().iTl; |
|
2397 iTempRegion.Offset(offset); |
|
2398 |
2387 // Check older buffers for overlapping regions against current buffer |
2399 // Check older buffers for overlapping regions against current buffer |
2388 if (cb > 0) |
2400 if (cb > 0) |
2389 { |
2401 { |
2390 for (TInt i = cb - 1; i >= 0; i--) |
2402 for (TInt i = cb - 1; i >= 0; i--) |
2391 { |
2403 { |
2392 if (arraysChanged) |
2404 if (arraysChanged) |
2393 { |
2405 { |
2394 break; |
2406 break; |
2395 } |
2407 } |
2396 |
2408 |
2397 CHuiCanvasCommandBuffer* previousCommands = iCommandBuffers[i]; |
2409 CHuiCanvasCommandBuffer* previousCommands = iCommandBuffers[i]; |
|
2410 TPoint previousCommandsOffset = previousCommands->iOriginalDisplayRect.Round().iTl; |
|
2411 |
2398 // Keep count how many subregions of the prevous command are contained inside current command buffer region |
2412 // Keep count how many subregions of the prevous command are contained inside current command buffer region |
2399 TInt coveredRegionCount = 0; |
2413 TInt coveredRegionCount = 0; |
2400 for (TInt k=0; k < previousCommands->iOriginalUpdateRegion.Count();k++) |
2414 for (TInt k=0; k < previousCommands->iOriginalUpdateRegion.Count();k++) |
2401 { |
2415 { |
2402 iTempCurrentSubRegion.Clear(); |
2416 iTempCurrentSubRegion.Clear(); |
2403 iTempIntersectingRegion.Clear(); |
2417 iTempIntersectingRegion.Clear(); |
2404 iTempCurrentSubRegion.AddRect(previousCommands->iOriginalUpdateRegion[k]); |
2418 iTempCurrentSubRegion.AddRect(previousCommands->iOriginalUpdateRegion[k]); |
|
2419 |
|
2420 iTempCurrentSubRegion.Offset(-previousCommandsOffset); |
|
2421 |
2405 iTempIntersectingRegion.Intersection(iTempRegion, iTempCurrentSubRegion); |
2422 iTempIntersectingRegion.Intersection(iTempRegion, iTempCurrentSubRegion); |
2406 iTempIntersectingRegion.Tidy(); |
2423 iTempIntersectingRegion.Tidy(); |
2407 |
2424 |
2408 if (iTempIntersectingRegion.Count() == 1) |
2425 if (iTempIntersectingRegion.Count() == 1) |
2409 { |
2426 { |
|
2427 iTempIntersectingRegion.Offset(previousCommandsOffset); |
|
2428 |
2410 if (iTempIntersectingRegion[0] == previousCommands->iOriginalUpdateRegion[k]) |
2429 if (iTempIntersectingRegion[0] == previousCommands->iOriginalUpdateRegion[k]) |
2411 { |
2430 { |
2412 coveredRegionCount++; |
2431 coveredRegionCount++; |
2413 // If all regions were overlapping agains current buffer, we can delete this. |
2432 // If all regions were overlapping agains current buffer, we can delete this. |
2414 if (coveredRegionCount == previousCommands->iOriginalUpdateRegion.Count()) |
2433 if (coveredRegionCount == previousCommands->iOriginalUpdateRegion.Count()) |
2430 } |
2449 } |
2431 } |
2450 } |
2432 } |
2451 } |
2433 } |
2452 } |
2434 |
2453 |
|
2454 void CHuiCanvasWsPainter::ApplyShapeRegion() |
|
2455 { |
|
2456 // If shape region has changed recalculate all update regions |
|
2457 if (iShapeRegionClippingPending) |
|
2458 { |
|
2459 TRect canvasRect = iCanvasVisual->DisplayRect().Round(); |
|
2460 |
|
2461 // We must first offset to canvasRect.iTl, otherwise region clipping doesn't work. |
|
2462 UpdateBufferUpdateRegions(canvasRect.iTl); |
|
2463 |
|
2464 TInt bufferCount = iCommandBuffers.Count(); |
|
2465 for (TInt cb = 0; cb < bufferCount; cb++) |
|
2466 { |
|
2467 CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb]; |
|
2468 cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion); |
|
2469 |
|
2470 TPoint deltaPos = cmdbuffer->iPositionForUpdateRegion - cmdbuffer->iOriginalDisplayRect.Round().iTl; |
|
2471 cmdbuffer->iUpdateRegion.Offset(deltaPos); |
|
2472 |
|
2473 if ( iShapeRegionAvailable ) |
|
2474 { |
|
2475 TranslateShapeRegion(cmdbuffer->iPositionForUpdateRegion); |
|
2476 cmdbuffer->iUpdateRegion.Intersect(iShapeRegion); |
|
2477 } |
|
2478 cmdbuffer->iUpdateRegion.Tidy(); |
|
2479 } |
|
2480 iShapeRegionClippingPending = EFalse; |
|
2481 } |
|
2482 } |
|
2483 |
|
2484 void CHuiCanvasWsPainter::TranslateShapeRegion(const TPoint& aNewOrigin) |
|
2485 { |
|
2486 if (iShapeRegionOrigin != aNewOrigin) |
|
2487 { |
|
2488 iShapeRegion.Offset(aNewOrigin - iShapeRegionOrigin); |
|
2489 iShapeRegionOrigin = aNewOrigin; |
|
2490 } |
|
2491 } |
|
2492 |
2435 CHuiCanvasGc& CHuiCanvasWsPainter::CanvasGc() const |
2493 CHuiCanvasGc& CHuiCanvasWsPainter::CanvasGc() const |
2436 { |
2494 { |
2437 return iCanvasWsGc->CanvasGc(); |
2495 return iCanvasWsGc->CanvasGc(); |
2438 } |
2496 } |
2439 |
2497 |
2702 |
2760 |
2703 void CHuiCanvasWsPainter::UpdateBufferUpdateRegions(TPoint aPos) |
2761 void CHuiCanvasWsPainter::UpdateBufferUpdateRegions(TPoint aPos) |
2704 { |
2762 { |
2705 // iUpdateRegion is in screen coordinates. If visual moves position, iUpdateRegion |
2763 // iUpdateRegion is in screen coordinates. If visual moves position, iUpdateRegion |
2706 // should be updated as well. Otherwise visual will encounter clipping. |
2764 // should be updated as well. Otherwise visual will encounter clipping. |
2707 for (TInt cb = 0; cb < iCommandBuffers.Count(); cb++) |
2765 TBool updated = EFalse; |
|
2766 |
|
2767 for (TInt cb = 0; cb < iCommandBuffers.Count(); cb++) |
2708 { |
2768 { |
2709 if (iCommandBuffers[cb]->iPositionForUpdateRegion != aPos && !iCommandBuffers[cb]->iUpdateRegion.IsEmpty() ) |
2769 if (iCommandBuffers[cb]->iPositionForUpdateRegion != aPos && !iCommandBuffers[cb]->iUpdateRegion.IsEmpty() ) |
2710 { |
2770 { |
|
2771 updated = ETrue; |
|
2772 |
2711 TPoint deltaPos = aPos - iCommandBuffers[cb]->iPositionForUpdateRegion; |
2773 TPoint deltaPos = aPos - iCommandBuffers[cb]->iPositionForUpdateRegion; |
2712 iCommandBuffers[cb]->iUpdateRegion.Offset(deltaPos); |
2774 iCommandBuffers[cb]->iUpdateRegion.Offset(deltaPos); |
2713 iCommandBuffers[cb]->iPositionForUpdateRegion = aPos; |
2775 iCommandBuffers[cb]->iPositionForUpdateRegion = aPos; |
2714 iCommandBuffers[cb]->ClearStatusFlags(EHuiCanvasBufferStatusAll); |
|
2715 iCommandBuffers[cb]->SetStatusFlags(EHuiCanvasBufferStatusNew); |
|
2716 } |
2776 } |
2717 } |
2777 |
2718 } |
2778 if (updated) |
|
2779 { |
|
2780 // If one command buffer is drawn, then all following command |
|
2781 // buffers must be redrawn as well. |
|
2782 iCommandBuffers[cb]->ClearStatusFlags(EHuiCanvasBufferStatusAll); |
|
2783 iCommandBuffers[cb]->SetStatusFlags(EHuiCanvasBufferStatusNew); |
|
2784 } |
|
2785 } |
|
2786 } |
2719 |
2787 |
2720 void CHuiCanvasWsPainter::SetMemoryLevel(THuiMemoryLevel /*aLevel*/) |
2788 void CHuiCanvasWsPainter::SetMemoryLevel(THuiMemoryLevel /*aLevel*/) |
2721 { |
2789 { |
2722 TRAP_IGNORE(SelectGcL()); |
2790 TRAP_IGNORE(SelectGcL()); |
2723 } |
2791 } |