equal
deleted
inserted
replaced
21 #include "BitmapTiler.h" |
21 #include "BitmapTiler.h" |
22 #include <fbs.h> |
22 #include <fbs.h> |
23 #include <bitstd.h> |
23 #include <bitstd.h> |
24 #include <bitdev.h> |
24 #include <bitdev.h> |
25 |
25 |
26 // CONSTANTS |
|
27 static const TInt KCompressRatioThreshold = 16; |
|
28 |
26 |
29 // ======================== STATIC FACTORY FUNCTIONS =========================== |
27 // ======================== STATIC FACTORY FUNCTIONS =========================== |
30 #define GET_PIX_GRAY2(buf, x, y, w) (((TUint32*)((TUint8*)buf + y*w))[x>>5] & (1<<(x&0x1f))) |
28 #define GET_PIX_GRAY2(buf, x, y, w) (((TUint32*)((TUint8*)buf + y*w))[x>>5] & (1<<(x&0x1f))) |
31 |
29 |
32 |
30 |
624 |
622 |
625 iMask->UnlockHeap(); |
623 iMask->UnlockHeap(); |
626 return ETrue; |
624 return ETrue; |
627 } |
625 } |
628 |
626 |
629 void CMaskedBitmap::CompressIfNeeded( TInt aRawSize ) |
627 void CMaskedBitmap::CompressInBackground( ) |
630 { |
628 { |
631 // check if the image is highly compressed |
629 |
632 TSize sz = iBitmap->SizeInPixels(); |
630 if ( iBitmap && iBitmap->Handle() ) |
633 if( KCompressRatioThreshold * aRawSize < sz.iWidth * sz.iHeight ) |
631 iBitmap->CompressInBackground(); |
634 { |
632 |
635 iBitmap->Compress(); |
633 if ( iMask && iMask->Handle() ) |
636 if( HasMask() ) |
634 iMask->CompressInBackground(); |
637 iMask->Compress(); |
635 |
638 } |
|
639 } |
636 } |
640 |
637 |
641 CMaskedBitmap* CMaskedBitmap::ScaleImageToSize( TSize newSize ) |
638 CMaskedBitmap* CMaskedBitmap::ScaleImageToSize( TSize newSize ) |
642 { |
639 { |
643 if (iScaledBitmap && iScaledBitmap->SizeInPixels() == newSize) |
640 if (iScaledBitmap && iScaledBitmap->SizeInPixels() == newSize) |