int main() { Build(); while(scanf("%d",&n) &&n) { printf("%d:\n",n); int ans=-1; for(int i=0;i<pcnt && prime[i] < n;++i) if(notp[n-prime[i]] == false) { ans = prime[i]; break; } if(ans == -1) puts("NO WAY!"); else printf("%d+%d\n",ans,n-ans); } return 0; }
void Ide::BuildAndExecute() { if(Build()) { int time = msecs(); One<Host> h = CreateHostRunDir(); h->ChDir(Nvl(rundir, GetFileFolder(target))); String cmdline; if(!runexternal) cmdline << '\"' << h->GetHostPath(target) << "\" "; cmdline << ToSystemCharset(runarg); int exitcode; switch(runmode) { case RUN_WINDOW: HideBottom(); h->Launch(cmdline, FindIndex(SplitFlags(mainconfigparam, true), "GUI") < 0); break; case RUN_CONSOLE: ShowConsole(); PutConsole(String().Cat() << "Executing: " << cmdline); console.Sync(); exitcode = h->ExecuteWithInput(cmdline); PutConsole("Finished in " + GetPrintTime(time) + ", exit code: " + AsString(exitcode)); break; case RUN_FILE: { HideBottom(); String fn; if(IsNull(stdout_file)) fn = ForceExt(target, ".ol"); else fn = stdout_file; FileOut out(fn); if(!out) { PromptOK("Unable to open output file [* " + DeQtf(stdout_file) + "] !"); return; } if(h->Execute(cmdline, out) >= 0) { out.Close(); EditFile(fn); } } } } }
void Path::Build(const Coordinates& coords, //coords to build from Path::Iter iter, //iterator of parent Path::Dots& to_skip, //list of dots to skip const Coordinates& previous){ //previous dot //if dot isn't captured and we don't need to skip it... if( !Skip(coords, to_skip) && (field->GetState(coords) != CAPTURED_BY_BLUE) && (field->GetState(coords) != CAPTURED_BY_RED) && field->InRange(coords) ){ //appending dot as a child for parent dot Path::Iter ch = tr.append_child(iter, coords); to_skip.push_back(coords); //marking this dot as visited Path::SearchResult sr = field->SearchNearby(coords); for(int i = 0; i < sr.amount; i++) if(previous != sr.find_coords[i]) //we won't go to the dot we've visited before Build(sr.find_coords[i], ch, to_skip, coords); } }
//-------------------------------------------------- //-------------------------------------------------- void Texture::Restore() { CS_ASSERT(GetStorageLocation() == CSCore::StorageLocation::k_none, "Cannot restore texture that was loaded from file. This should be handled using RefreshResource()."); Texture::Descriptor desc; desc.m_width = m_width; desc.m_height = m_height; desc.m_format = m_format; desc.m_compression = m_compression; desc.m_dataSize = m_restorationDataSize; WrapMode sWrap = m_sWrapMode; WrapMode tWrap = m_tWrapMode; FilterMode filterMode = m_filterMode; Build(desc, std::move(m_restorationData), m_hasMipMaps, m_restoreTextureDataEnabled); SetWrapMode(sWrap, tWrap); SetFilterMode(filterMode); }
// 4. Construct grid from file void OpenSMOKE_Grid1D::Construct(const std::string fileName) { BzzVector xVector; std::string dummy, units; ifstream inputFile; openInputFileAndControl(inputFile, fileName); inputFile >> dummy; if (dummy != "#X") ErrorMessage("Expected #X keyword"); inputFile >> units; inputFile >> dummy; if (dummy != "#LIST") ErrorMessage("Expected #LIST keyword"); for(;;) { inputFile >> dummy; if (dummy == "#END") break; xVector.Append(OpenSMOKE_Conversions::conversion_length(atof(dummy.c_str()), units)); } inputFile.close(); Np = xVector.Size(); Ni = Np-1; L = xVector[Np]; xA = xVector[1]; xB = xA+L; Allocate(); dxw[1]=0.; for(int i=2;i<=Np;i++) dxw[i]=xVector[i]-xVector[i-1]; Build(); }
void Model::OpenBookTXT(char * file_name, ID3D11Device * device) { std::fstream fin(file_name); if (!fin) { MessageBox(0, L"Erro ao carregar o arquivo de modelo (Arquivo nao existe ou esta corrompido).", L"Model Error", 0); return; } std::string ignore; fin >> ignore >> nModelVert; fin >> ignore >> nModelIndex; fin >> ignore >> ignore >> ignore >> ignore; vertices.resize(nModelVert); for (int i = 0; i < nModelVert; ++i) { fin >> vertices[i].Pos.x >> vertices[i].Pos.y >> vertices[i].Pos.z; //Seria a normal no lugar da cor aqui fin >> vertices[i].Normal.x >> vertices[i].Normal.y >> vertices[i].Normal.z; } fin >> ignore >> ignore >> ignore; UINT mTriangleCount = nModelIndex; nModelIndex *= 3; indices.resize(nModelIndex); for (int i = 0; i < mTriangleCount; ++i) { fin >> indices[i * 3 + 0] >> indices[i * 3 + 1] >> indices[i * 3 + 2]; } fin.close(); Build(device); }
int main(void) { AdjMultipleList *G; G = (AdjMultipleList *)malloc(sizeof(AdjMultipleList)); Build(G); Show(G); Dfsearch(G); while(1){ mstkruskal(G); } // Mstprime(G);} // read_input_file(G); // A->B_DFS(G); // A->B_BFS(G); // A->B->C return 0; }
// 1. Construct equispaced grid void OpenSMOKE_Grid1D::Construct(const int NP, const double LL, const double xAA) { double deltax; Np = NP; Ni = Np-1; L = LL; xA = xAA; xB = xA+L; Allocate(); deltax = L/Ni; dxw = deltax; dxw[1] = 0.; Build(); }
// 5. Construct from a vector of points void OpenSMOKE_Grid1D::Construct(BzzVector &coordinates) { int i; Np = coordinates.Size(); Ni = Np-1; L = coordinates[Np]; xA = coordinates[1]; xB = xA+L; Allocate(); dxw[1]=0.; for(i=2;i<=Np;i++) dxw[i]=coordinates[i]-coordinates[i-1]; Build(); }
void UnitCfg::New () { NewDlg dlg (Name, this); if (dlg.exec ()) { // Comment->setText (tr(NONE_STR)); Name->insertItem (dlg.GetName ()); // add to the list box Enabled->setChecked (0); SetComboItem (Name, dlg.GetName ()); // make it the selected item // Build (); // build the record GetConfigureDb ()->AddToRecord ("NAME", Name->currentText ()); QString cmd = GetConfigureDb ()->Insert ("UNITS"); // generate the update record GetConfigureDb ()->DoExec (this, cmd,tNew); // lock the db and action the request // ButtonState (false); fNew = true; DOAUDIT(tr("New:") + dlg.GetName()); }; }
void OpenSMOKE_Grid1D::RefineDouble() { int i; BzzVector dxwOld = dxw; int NpOld = Np; Np = NpOld+Ni; Ni = Np-1; Allocate(); dxw[1] = 0.; for(i=2;i<=NpOld;i++) { dxw[(i-1)*2] = dxwOld[i]*0.50; dxw[(i-1)*2+1] = dxwOld[i]*0.50; } Build(); }
int main() { int Q; while(scanf("%d",&n) && n) { scanf("%d",&Q); for(int i=1;i<=n;++i) scanf("%d",seq+i); node *root; root = Build(1,n); while(Q--) { int a,b; scanf("%d%d",&a,&b); printf("%d\n",Query(root, a, b)); } Crash(root); } return 0; }
void UserCfgDlg::New () { // Get the new name NewDlg dlg (Name, this); if (dlg.exec ()) { // ReportsPriviledge->setChecked (0); AlarmAckPriv->setChecked (0); ReportsPriv->setChecked (0); ReportsPriviledge->setEnabled (true); AlarmAckPriv->setEnabled (true); ReportsPriv->setEnabled (true); ExitApp->setEnabled(0); // need this priviledge to close the user interface AllPriv->setChecked (0); AgePassword->setChecked(true); // default to needing to change passwords AgeDays->setValue(0); // require password to change on next login FactoryAdministrator->setChecked(false); // default no Factory Administrator // Comment->setText (tr(NONE_STR)); Password->setText (tr(NONE_STR)); // // leave the language - so it defaults to current // Name->insertItem (dlg.GetName ()); // add to the list box SetComboItem (Name, dlg.GetName ()); // make it the selected item // Build (); // build the record GetConfigureDb ()->AddToRecord ("PSSWORD", tr(NONE_STR)); // force user toe choose password on startup // GetConfigureDb ()->AddToRecord ("NAME", Name->currentText ()); QString cmd = GetConfigureDb ()->Insert ("USERS"); // generate the update record GetConfigureDb ()->DoExec (this, cmd,tNew); // lock the db and action the request // ButtonState (false); // DOAUDIT(tr("New:") + dlg.GetName()); // }; }
eOSState cCMDDir::New(eKeys Key) { switch(Key) { case kOk: if(!isempty(Dir)) { char *buffer = NULL; asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir)); MYDEBUG("Verzeichnis: Neu: Anlegen: %s", buffer); cFileInfo *info = new cFileInfo(buffer); if(info->isExists()) { MYDEBUG("Verzeichnis existiert bereits"); OSD_WARNMSG(tr("Directory exists")); FREENULL(buffer); DELETENULL(info); return osContinue; } if(cFileCMD::Mkdir(buffer)) { MYDEBUG("Verzeichnis anlegen erfolgreich"); LastSelDir(buffer); if(!Select) OsdObject->SetState(mmsReInit); } FREENULL(buffer); DELETENULL(info); } case kBack: State = csNone; Build(); return osContinue; break; default: break; } return cOsdMenu::ProcessKey(Key); }
void Model::OpenTXT(char * file_name, ID3D11Device* device) { std::fstream fin(file_name); if (!fin) { MessageBox(0, L"Erro ao carregar o arquivo de modelo (Arquivo nao existe ou esta corrompido).", L"Model Error", 0); return; } std::string ignore; fin >> ignore >> nModelVert; fin >> ignore >> nModelIndex; fin >> ignore; vertices.resize(nModelVert); for (int i = 0; i < nModelVert; ++i) { fin >> vertices[i].Pos.x >> vertices[i].Pos.y >> vertices[i].Pos.z; fin >> vertices[i].Normal.x >> vertices[i].Normal.y >> vertices[i].Normal.z; //vertices[i].Cor.w = 1.0f; } fin >> ignore >> ignore; indices.resize(nModelIndex); UINT tNumber = nModelIndex; for (int i = 0; i < tNumber / 3; ++i) { fin >> indices[i * 3 + 0] >> indices[i * 3 + 1] >> indices[i * 3 + 2]; } fin.close(); Build(device); }
HSTARSHIP CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE crew_level) { HSTARSHIP hStarShip, hBuiltShip; SHIP_FRAGMENTPTR TemplatePtr; if ((hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), index)) == 0) return (0); TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip ( &GLOBAL (avail_race_q), hStarShip ); hBuiltShip = Build (pDstQueue, TemplatePtr->RaceResIndex, TemplatePtr->ShipInfo.ship_flags & (GOOD_GUY | BAD_GUY), (BYTE)(index == SAMATRA_SHIP ? 0 : NameCaptain (pDstQueue, (STARSHIPPTR)TemplatePtr))); if (hBuiltShip) { SHIP_FRAGMENTPTR ShipFragPtr; ShipFragPtr = (SHIP_FRAGMENTPTR)LockStarShip (pDstQueue, hBuiltShip); ShipFragPtr->ShipInfo = TemplatePtr->ShipInfo; if (crew_level) ShipFragPtr->ShipInfo.crew_level = crew_level; ShipFragPtr->ShipInfo.energy_level = 0; ShipFragPtr->ShipInfo.ship_flags = 0; ShipFragPtr->ShipInfo.var1 = ShipFragPtr->ShipInfo.var2 = 0; ShipFragPtr->ShipInfo.loc.x = ShipFragPtr->ShipInfo.loc.y = 0; SET_RACE_ID (ShipFragPtr, (BYTE)index); UnlockStarShip (pDstQueue, hBuiltShip); } UnlockStarShip ( &GLOBAL (avail_race_q), hStarShip ); return (hBuiltShip); }
// TestParallelBuild //------------------------------------------------------------------------------ void TestCLR::TestParallelBuild() const { FBuildOptions options; options.m_ForceCleanBuild = true; options.m_ShowSummary = true; // required to generate stats for node count checks EnsureFileDoesNotExist( "../../../../ftmp/Test/CLR/clrmulti.lib" ); FBuildStats stats = Build( options, false, "CLR-Parallel-Target" ); // dont' use DB EnsureFileExists( "../../../../ftmp/Test/CLR/clrmulti.lib" ); // Check stats // Seen, Built, Type CheckStatsNode ( stats, 1, 1, Node::DIRECTORY_LIST_NODE ); CheckStatsNode ( stats, 5, 3, Node::FILE_NODE ); // 3xcpp + .h CheckStatsNode ( stats, 1, 1, Node::COMPILER_NODE ); CheckStatsNode ( stats, 3, 3, Node::OBJECT_NODE ); CheckStatsNode ( stats, 1, 1, Node::LIBRARY_NODE ); CheckStatsNode ( stats, 1, 1, Node::ALIAS_NODE ); CheckStatsTotal( stats, 12, 10 ); }
eOSState cCMDDir::Edit(eKeys Key) { switch(Key) { case kOk: if(!isempty(Dir)) { char *buffer = NULL; asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir)); MYDEBUG("Verzeichnis: Edit: OK: %s", buffer); cFileInfo *info = new cFileInfo(buffer); if(info->isExists()) { MYDEBUG("Verzeichnis: Edit: Existiert schon"); OSD_WARNMSG(tr("Directory exists")); FREENULL(buffer); DELETENULL(info); return osUnknown; } if(cFileCMD::Rn(LastSelDir(), buffer)) { MYDEBUG("Verzeichnis: Edit: Rename OK"); LastSelDir(buffer); OsdObject->SetState(mmsReInit); } FREENULL(buffer); DELETENULL(info); } case kBack: State = csNone; Build(); return osContinue; break; default: break; } return cOsdMenu::ProcessKey(Key); }
STDMETHODIMP CLXSLTemplate::putref_stylesheet(ILDOMNode *newVal) { m_stylesheet = newVal; #if 0 MSXML2::IXMLDOMDocument2Ptr msdocument(L"Msxml2.FreeThreadedDOMDocument.4.0"); m_msstylesheet = Build(msdocument, m_stylesheet); MSXML2::IXMLDOMElementPtr msoutput = msdocument->createNode(_variant_t((long)1), _bstr_t(L"output"), _bstr_t(L"http://www.w3.org/1999/XSL/Transform")); msoutput->setAttribute(_bstr_t(L"method"), _bstr_t(L"xml")); if (msdocument->documentElement->firstChild != NULL) msdocument->documentElement->insertBefore(msoutput, _variant_t((IDispatch*)msdocument->documentElement->firstChild)); else msdocument->documentElement->appendChild(msoutput); // MessageBox(NULL, m_msstylesheet->xml, "", MB_OK); m_mstemplate->stylesheet = m_msstylesheet; #endif return S_OK; }
/* ======================== idZipBuilder::Update updates a zip file with the files in the specified folder ======================== */ bool idZipBuilder::Update( const char* zipPath, const char* folder, bool cleanFolder ) { // if this file doesn't exist, just build it if( fileSystem->GetTimestamp( zipPath ) == FILE_NOT_FOUND_TIMESTAMP ) { return Build( zipPath, folder, cleanFolder ); } zipFileName = zipPath; sourceFolderName = folder; if( !CreateZipFile( true ) ) { // don't clean the folder if the zip fails return false; } if( cleanFolder ) { CleanSourceFolder(); } return true; }
OptionExp* DefaultOptionExpBuilder::Build(const OptionParam* pParam, OptionContext* pContext) { if(!IsParamValid(pParam)) { return NULL; } DefaultOptionExp* pExp = new DefaultOptionExp(); pExp->SetOptionID(pParam->szID).SetOptionName(pParam->szName).SetOptionValue(pParam->szValue); pExp->SetNameValueSep(pParam->szNameValueSep).SetSubOptionSep(pParam->szSubOptionSep); pExp->SetEvaluateMode(pParam->nEvaluateMode).SetEvaluateFlag(pParam->nEvaluateFlag); if(pParam->ptr) { if(pParam->nEvaluateFlag & OPTEF_CHILDREN) { OptionParamList subOptions; bool bRet = ParseOptionParamArray(pParam->ptr,pContext, &subOptions); if(bRet && subOptions.nCount > 0) { OptionExp* pChildExp; for(int i = 0; i < subOptions.nCount; i++) { pChildExp = Build(&subOptions.pOptions[i], pContext); if(pChildExp) { pExp->AddChild(pChildExp); } } } } else if(pParam->nEvaluateFlag & OPTEF_HAS_FUNC) { //pExp->SetFuncSet((FuncSet*)(&(pParam->ptr))); pExp->SetFuncSet((FuncSet)(pParam->ptr)); } } return pExp; }
void SampleCfg::New () { IT_IT("SampleCfg::New"); // // Save any existing configuration for any existing point // // NewDlg dlg (List, this); dlg.setCaption (tr ("New Sample Points")); if (dlg.exec ()) { // delete the config widget RemoveConfig(); // SetComboItem (Unit, tr(NONE_STR)); InputIndex->clear (); InputIndex->insertItem(tr(NONE_STR)); InputIndex->setCurrentItem (0); // Comment->setText (tr(NONE_STR)); (void) new QListViewItem(List,dlg.GetName (),tr(NONE_STR)); // add to the list box Enabled->setChecked (0); Fileable->setChecked (0); Retrigger->setChecked(0); AlarmThreshold->setValue(0); // SetListViewItem (List, dlg.GetName ()); // make it the selected item Name->setText (dlg.GetName ()); // Build (); // build the record GetConfigureDb ()->AddToRecord ("NAME", Name->text ()); QString cmd = GetConfigureDb ()->Insert ("SAMPLE"); // generate the update record GetConfigureDb ()->DoExec (this, cmd, tNew); // lock the db and action the request // ButtonState (false); DOAUDIT(tr("New:") + dlg.GetName()); } }
// TestPCH //------------------------------------------------------------------------------ void TestPrecompiledHeaders::TestPCH() const { FBuildOptions options; options.m_ForceCleanBuild = true; options.m_UseCacheWrite = true; options.m_ShowSummary = true; // required to generate stats for node count checks #if defined( __WINDOWS__ ) AStackString<> obj( "../../../../ftmp/Test/PrecompiledHeaders/PCHUser.obj" ); #else AStackString<> obj( "../../../../ftmp/Test/PrecompiledHeaders/PCHUser.o" ); #endif AStackString<> pch( "../../../../ftmp/Test/PrecompiledHeaders/PrecompiledHeader.pch" ); AStackString<> lib( "../../../../ftmp/Test/PrecompiledHeaders/TestPCH.lib" ); EnsureFileDoesNotExist( obj ); EnsureFileDoesNotExist( pch ); EnsureFileDoesNotExist( lib ); FBuildStats stats = Build( options, false ); // don't use DB EnsureFileExists( obj ); EnsureFileExists( pch ); EnsureFileExists( lib ); // Check stats // Seen, Built, Type CheckStatsNode ( stats, 3, 2, Node::FILE_NODE ); // cpp + pch CheckStatsNode ( stats, 1, 1, Node::COMPILER_NODE ); CheckStatsNode ( stats, 2, 2, Node::OBJECT_NODE );// obj + pch obj CheckStatsNode ( stats, 1, 1, Node::LIBRARY_NODE ); CheckStatsNode ( stats, 1, 1, Node::DIRECTORY_LIST_NODE ); CheckStatsNode ( stats, 1, 1, Node::ALIAS_NODE ); CheckStatsNode ( stats, 1, 1, Node::DLL_NODE ); CheckStatsTotal( stats, 10, 9 ); // check we wrote all objects to the cache TEST_ASSERT( stats.GetStatsFor( Node::OBJECT_NODE ).m_NumCacheStores == 1 ); // only the main obj can be cached }
bool BuilderHelper::cbBuilder::ParseCommandArgumentsAndBuild(char** i_arguments, const unsigned int i_argumentCount) { const unsigned int commandCount = 1; const unsigned int actualArgumentCount = i_argumentCount - commandCount; const unsigned int requiredArgumentCount = 2; if ( actualArgumentCount >= requiredArgumentCount ) { m_path_source = i_arguments[commandCount + 0]; m_path_target = i_arguments[commandCount+ 1]; std::vector<const std::string> optionalArguments; for ( unsigned int i = ( commandCount + requiredArgumentCount ); i < i_argumentCount; ++i ) { optionalArguments.push_back( i_arguments[i] ); } return Build( optionalArguments ); } else { std::stringstream errorMessage; errorMessage << "An asset builder must be called with at least " << requiredArgumentCount << " command line arguments " "(the source path and the target path), but "; if ( actualArgumentCount == 0 ) { errorMessage << "none were provided\n"; } else if ( actualArgumentCount == 1 ) { errorMessage << "only 1 was provided\n"; } else { errorMessage << "only " << actualArgumentCount << " were provided\n"; } BuilderHelper::OutputErrorMessage( errorMessage.str().c_str() ); return false; } }
void uType::Init() { switch (State) { case uTypeStateInitialized: return; case uTypeStateInitializing: { Xli::MutexLock lock(_Mutex); // TODO: throw TypeInitializationException instead if (State != uTypeStateInitialized && uSwapThreadType(this) != this) U_THROW(::g::Uno::Exception::New2(uString::Const(FullName))); break; } default: { Xli::MutexLock lock(_Mutex); if (Base && Base->State < uTypeStateInitializing) { Base->Init(); if (State == uTypeStateInitialized) return; } Build(); State = uTypeStateInitializing; uType* last = uSwapThreadType(this); if (fp_cctor_) (*fp_cctor_)(this); State = uTypeStateInitialized; uSwapThreadType(last); break; } } }
globle int BuildFunction() { DATA_OBJECT theArg; /*==============================================*/ /* Function build expects exactly one argument. */ /*==============================================*/ if (ArgCountCheck("build",EXACTLY,1) == -1) return(FALSE); /*==================================================*/ /* The argument should be of type SYMBOL or STRING. */ /*==================================================*/ if (ArgTypeCheck("build",1,SYMBOL_OR_STRING,&theArg) == FALSE) { return(FALSE); } /*======================*/ /* Build the construct. */ /*======================*/ return(Build(DOToString(theArg))); }
int main() { int m,n; scanf("%d%d",&n,&m); Build(1,n,1); while(m--) { char s[5]; int a,b,c; scanf("%s",s); if(s[0]=='Q') { scanf("%d%d",&a,&b); printf("%I64d\n",Query(a,b,1,n,1)); } else { scanf("%d%d%d",&a,&b,&c); Update(a,b,c,1,n,1); } } return 0; }
int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); b[i] = a[i]; } sort(b + 1, b + n + 1); m = unique(b + 1, b + n + 1) - (b + 1); for (int i = 1; i <= n; i++) a[i] = lower_bound(b + 1, b + m + 1, a[i]) - (b + 1) + 1; root[0] = tot = 1; Build(1, 1, m); //------------------ for (int i = 1; i <= n; i++) { root[i] = ++tot; build(tot, root[i - 1], a[i]); } for(int i = 1; i <= q; i++) { int l, r, k; scanf("%d%d%d", &l, &r, &k); printf("%d\n", b[find(root[l - 1], root[r], k)]); } return 0; }
//-------------------------------------------------------------------------------------------------- void MakeComponent ( int argc, ///< Count of the number of command line parameters. const char** argv ///< Pointer to an array of pointers to command line argument strings. ) //-------------------------------------------------------------------------------------------------- { GetCommandLineArgs(argc, argv); // Set the target-specific environment variables (e.g., LEGATO_TARGET). mk::SetTargetSpecificEnvVars(BuildParams.Target()); ConstructObjectModel(); if (IsStandAlone) { BuildStandAlone(); } else { Build(); } }
Rect Geometry::ComputePathBounds() { if (!IsBuilt ()) Build (); if (!path || (path->cairo.num_data == 0)) return Rect (); cairo_t *cr = measuring_context_create (); cairo_append_path (cr, &path->cairo); double x1, y1, x2, y2; cairo_path_extents (cr, &x1, &y1, &x2, &y2); Rect bounds = Rect (MIN (x1, x2), MIN (y1, y2), fabs (x2 - x1), fabs (y2 - y1)); measuring_context_destroy (cr); return bounds; }