478 break; |
478 break; |
479 case ESelectArrow: |
479 case ESelectArrow: |
480 image = m_selectArrow; |
480 image = m_selectArrow; |
481 break; |
481 break; |
482 } |
482 } |
483 CMaskedBitmap* maskedBitmap = NULL; |
483 CMaskedBitmap* maskedBitmap = image->getMaskedBitmap(); |
484 if(image) |
|
485 maskedBitmap = image->getMaskedBitmap(); |
|
486 if (!maskedBitmap) User::Leave(KErrGeneral); // should not really happen |
484 if (!maskedBitmap) User::Leave(KErrGeneral); // should not really happen |
487 TSize size = maskedBitmap->SizeInPixels(); |
485 TSize size = maskedBitmap->SizeInPixels(); |
488 size.iWidth = (size.iWidth * scalingFactor) / 100; |
486 size.iWidth = (size.iWidth * scalingFactor) / 100; |
489 size.iHeight = (size.iHeight * scalingFactor) / 100; |
487 size.iHeight = (size.iHeight * scalingFactor) / 100; |
490 |
488 SyncScaler syncScaler; |
491 CMaskedBitmap* resultBitmap = maskedBitmap->ScaleImageToSize(size, false); |
489 TRequestStatus* status = &(syncScaler.iStatus); |
492 BitmapImage* bi = new (ELeave) BitmapImage(resultBitmap); |
490 |
493 |
491 m_bitmapScaler = CBitmapScaler::NewL(); |
|
492 m_bitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); |
|
493 // bitmap; |
|
494 CFbsBitmap* bitmap = const_cast<CFbsBitmap*>(&(maskedBitmap->Bitmap())); |
|
495 CFbsBitmap* resultBitmap = NULL; |
|
496 resultBitmap = new (ELeave) CFbsBitmap; |
|
497 CleanupStack::PushL(resultBitmap); |
|
498 resultBitmap->Create(size, EColor16M); |
|
499 syncScaler.init(); |
|
500 m_bitmapScaler->Scale(status, *bitmap, *resultBitmap, ETrue); |
|
501 if (!m_asw) m_asw = new (ELeave) CActiveSchedulerWait(); |
|
502 m_asw->Start(); |
|
503 // If an error occured during scaling, stop! |
|
504 User::LeaveIfError(syncScaler.m_error); |
|
505 |
|
506 // mask |
|
507 CFbsBitmap* mask = const_cast<CFbsBitmap*>(&(maskedBitmap->Mask())); |
|
508 CFbsBitmap* resultMask = NULL; |
|
509 resultMask = new (ELeave) CFbsBitmap; |
|
510 CleanupStack::PushL(resultMask); |
|
511 resultMask->Create(size, EGray256); |
|
512 syncScaler.init(); |
|
513 m_bitmapScaler->Scale(status, (*mask), *resultMask, ETrue); |
|
514 if (!m_asw) m_asw = new (ELeave) CActiveSchedulerWait(); |
|
515 m_asw->Start(); |
|
516 // If an error occured during scaling, stop! |
|
517 User::LeaveIfError(syncScaler.m_error); |
|
518 |
|
519 CMaskedBitmap* mb = NULL; |
|
520 mb = new(ELeave) CMaskedBitmap(resultBitmap, resultMask); |
|
521 CleanupStack::Pop(2); // resultBitmap, resultMask |
|
522 CleanupStack::PushL(mb); |
|
523 BitmapImage* bi = new (ELeave) BitmapImage(mb); |
|
524 CleanupStack::Pop(); // mb |
494 switch (type) { |
525 switch (type) { |
495 case ECheckBoxOn: |
526 case ECheckBoxOn: |
496 delete m_scaledCheckBoxOn; |
527 delete m_scaledCheckBoxOn; |
497 m_scaledCheckBoxOn = bi; |
528 m_scaledCheckBoxOn = bi; |
498 m_scalingForCheckBoxOn = scalingFactor; |
529 m_scalingForCheckBoxOn = scalingFactor; |