void ShowBox::reload() { if (!isEditing()) { loadSize(); } loadTopmost(); }
/** Start decoding asychronously */ void CImageRescaler::DecodeL() { // Check for a valid source file if (!iSourceFile.Length() || !BaflUtils::FileExists(iFs, iSourceFile)) { User::Leave(KErrArgument); } delete iImageDecoder; iImageDecoder = NULL; delete iBitmap; iBitmap = NULL; // create the decoder // create the bitmap iBitmap = new( ELeave )CFbsBitmap(); iImageDecoder = CImageDecoder::FileNewL( iFs, iSourceFile, CImageDecoder::EPreferFastDecode ); TSize size = KImageMaxSizePixels; TSize orignialSize( iImageDecoder->FrameInfo().iOverallSizeInPixels ); // size in both x and y dimension must be non-zero, positive value TSize loadSize( orignialSize) ; if( orignialSize.iHeight < size.iHeight || orignialSize.iWidth < size.iWidth ) { loadSize = orignialSize; } else { // size reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all // plug-ins. TInt reductionFactor = 1; while ( reductionFactor < KMaximumReductionFactor && ( size.iWidth < loadSize.iWidth / 2 ) && ( size.iHeight < loadSize.iHeight / 2 )) { // magic: use loadSize that is half of previous size loadSize.iWidth /= 2; loadSize.iHeight /= 2; reductionFactor *= 2; } // if original size is not an exact multiple of reduction factor, // we need to round loadSize up if ( reductionFactor && orignialSize.iWidth % reductionFactor ) { loadSize.iWidth++; } if ( reductionFactor && orignialSize.iHeight % reductionFactor ) { loadSize.iHeight++; } } User::LeaveIfError( iBitmap->Create( loadSize, EColor16M )); iState = EDecoding; iImageDecoder->Convert( &iStatus, *iBitmap ); SetActive(); }
void DownloadTask::newRequest(HttpClientConnection *conn) { if (size_t size = loadSize()) { conn->get("/bigfile.bin?t=" + t() + "&len=" + std::to_string(size)); } else if (soonFinished()) { // Delete the Connection object but let socket go to keep-alive cache. } else { // Keep the connection but don't make a new request at this point. // Perhaps due to a speed limit. conn->pass(); } }
/** * @brief cwRegionLoadTask::loadImage * @param protoImage * @return */ cwImage cwRegionLoadTask::loadImage(const CavewhereProto::Image& protoImage) { cwImage image; image.setOriginal(protoImage.originalid()); image.setIcon(protoImage.iconid()); image.setOriginalDotsPerMeter(protoImage.dotpermeter()); image.setOriginalSize(loadSize(protoImage.size())); QList<int> mipmaps; mipmaps.reserve(protoImage.mipmapids_size()); for(int i = 0; i < protoImage.mipmapids_size(); i++) { mipmaps.append(protoImage.mipmapids(i)); } image.setMipmaps(mipmaps); return image; }
SDL_Surface * Font::renderSurface(const char *text, const Uint16 ptsize, const SDL_Colour &color, const Uint8 style) { SDL_Surface *result = nullptr; if (font_.count(ptsize) == 0) loadSize(ptsize); TTF_SetFontStyle(font_[ptsize], style); result = TTF_RenderText_Blended(font_[ptsize], text, color); if (result == nullptr) { Engine::log << Priority::error << TTF_GetError() << std::endl; return nullptr; } return result; }
Camber::Camber(string name, int num, int scale, LabObject *lab, LabCut *cut ) : currentSelected( 0 ) { // global norm vector norm = new float[3]; NUMOFCAMBERSIZE[0]=0; NUMOFCAMBERSIZE[1]=0; NUMOFCAMBERSIZE[2]=0; // flags _flag = new bool[num]; for( int i = 0; i < num; i++ ) { _flag[ i ] = false; } Num = num; Name = name; Scale = scale; _lab = lab; _cut = cut; init(); // here we need to load m1, m2 and m3 load(); loadSize(); }
// ----------------------------------------------------------------------------- // CThumbnailImageDecoder::DecodeL() // Decode the thumbnail image // ----------------------------------------------------------------------------- // void CThumbnailImageDecoder::DecodeL( const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailFlags aFlags) { TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() start" ); OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - start" ); // Create the bitmap if ( !iBitmap ) { iBitmap = new( ELeave )CFbsBitmap(); } TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight ); OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight ); if( iOriginalSize.iWidth < iOriginalSize.iHeight ) { TInt height = iSize.iHeight; iSize.iHeight = iSize.iWidth; iSize.iWidth = height; iPortrait = ETrue; TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight ); OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight ); } else { iPortrait = EFalse; } TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() iOriginalSize = %d x %d", iOriginalSize.iWidth, iOriginalSize.iHeight ); OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iOriginalSize.iWidth=%d;iOriginalSize.iHeight=%d", iOriginalSize.iWidth, iOriginalSize.iHeight ); //Size in both x and y dimension must be non-zero, positive value TSize loadSize( iOriginalSize) ; if(iOriginalSize.iHeight < iSize.iHeight || iOriginalSize.iWidth < iSize.iWidth ) { loadSize = iOriginalSize; TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() LoadSize is OriginalSize" ); OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - LoadSize is OriginalSize" ); } else if((iFrameInfoFlags& TFrameInfo::EFullyScaleable || IsSvg()) && aFlags == !CThumbnailManager::ECropToAspectRatio) { loadSize = iSize; TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() EFullyScaleable start" ); OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable start" ); const TReal32 srcAspect = static_cast < TReal32 > ( iOriginalSize.iWidth ) / iOriginalSize.iHeight; // set loadsize to maximum size within target size if ( (loadSize.iHeight * srcAspect) <= loadSize.iWidth ) { TReal trg = 0; TReal src( loadSize.iHeight * srcAspect ); Math::Round( trg, src, 0 ); loadSize.SetSize( trg, loadSize.iHeight ); } else { TReal trg; TReal src( loadSize.iWidth / srcAspect ); Math::Round( trg, src, 0 ); loadSize.SetSize( loadSize.iWidth, trg ); } TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() EFullyScaleable loadSize = %d x %d", loadSize.iWidth, loadSize.iHeight ); OstTraceExt2( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable;loadSize.iWidth=%d;loadSize.iHeight=%d", loadSize.iWidth, loadSize.iHeight ); } else { // Size reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all // plug-ins. SVG graphics can be rendered at any size. TInt reductionFactor = 1; while ( reductionFactor < KMaximumReductionFactor && ( iSize.iWidth < loadSize.iWidth / 2 ) && ( iSize.iHeight < loadSize.iHeight / 2 )) { // magic: use loadSize that is half of previous size loadSize.iWidth /= 2; loadSize.iHeight /= 2; reductionFactor *= 2; } // If original size is not an exact multiple of reduction factor, // we need to round loadSize up if ( reductionFactor && iOriginalSize.iWidth % reductionFactor ) { loadSize.iWidth++; } if ( reductionFactor && iOriginalSize.iHeight % reductionFactor ) { loadSize.iHeight++; } TN_DEBUG4( "CThumbnailImageDecoder::DecodeL() - loadSize = (%d,%d) reduction = 1/%d ", loadSize.iWidth, loadSize.iHeight, reductionFactor ); OstTraceExt3( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;loadSize.iWidth=%d;loadSize.iHeight=%d;reductionFactor=%d", loadSize.iWidth, loadSize.iHeight, reductionFactor ); } TInt err = iBitmap->Create( loadSize, aDisplayMode ); if (err != KErrNone) { delete iBitmap; iBitmap = NULL; User::Leave(err); } iDecoder->Convert( &iStatus, * iBitmap ); SetActive(); TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() end" ); OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - end" ); }