pawsListBoxRow* pawsComboBox::Select(int optionNum) { pawsListBoxRow * row = listChoice->GetRow(optionNum); listChoice->Select(row); if ( row == NULL ) itemChoice->SetText( initalText ); else itemChoice->SetText( GetSelectedRowString() ); if (!closed) { arrow->SetUpImage("Down Arrow"); arrow->SetDownImage("Down Arrow"); SetSize( oldWidth, oldHeight ); if (fliptotop) { MoveDelta(0,rows*GetActualHeight(rowHeight)+15); itemChoice->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); arrow->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); } listChoice->Hide(); closed = true; } return row; }
void pawsLoadWindow::InitAnim(csVector2 start, csVector2 dest, csTicks delay) { //if we lack the picture for the anim we don't render it if(!dot) { Error1("Couldn't find the picture to be used for the movement anim. Animation Aborted."); return; } float length; renderAnim = true; startFrom = 0; lastPos = start; destination = dest; //adjust the anim to resolution lastPos.x = GetActualWidth((int)lastPos.x); lastPos.y = GetActualHeight((int)lastPos.y); destination.x = GetActualWidth((int)destination.x); destination.y = GetActualHeight((int)destination.y); positions.DeleteAll(); csVector2 direction = destination - lastPos; length = direction.Norm(); numberDot = (int)ceil(length / 40); //we make the dots complete a bit before the end of the delay so it's //possible to see the last dot delayBetDot = ((delay * 1000)*0.9) / numberDot; }
void pawsTree::SetScrollBars(bool horiz, bool vert) { if(horiz && !horizScrollBar) { horizScrollBar = new pawsScrollBar; AddChild(horizScrollBar); horizScrollBar->SetRelativeFrame(0, defaultFrame.Width()-GetActualHeight(SCROLLBAR_WIDTH), defaultFrame.Width(), GetActualHeight(SCROLLBAR_WIDTH)); horizScrollBar->PostSetup(); horizScrollBar->SetTickValue(20); horizScrollBar->Show(); } if(!horiz && horizScrollBar) { pawsWidget::DeleteChild(horizScrollBar); horizScrollBar = NULL; if(layout) layout->SetHorizScroll(0); } if(vert && !vertScrollBar) { csString widgetStr; widgetStr.Format("<widget factory=\"pawsScrollBar\" name=\"scrollbar\" style=\"Standard Scrollbar\" direction=\"vertical\" tick=\"20\" minValue=\"0\" ><frame x=\"%d\" y=\"%d\" width=\"20\" height=\"%d\" /></widget>", defaultFrame.Width()-20,0,defaultFrame.Height()); vertScrollBar = dynamic_cast<pawsScrollBar*>(PawsManager::GetSingleton().LoadWidgetFromString(widgetStr)); AddChild(vertScrollBar); // vertScrollBar = new pawsScrollBar; // if (vertScrollBar == NULL) // { // Error1("Could not created pawsScrollBar"); // return; // } // vertScrollBar->SetRelativeFrame(defaultFrame.Width()-GetActualWidth(SCROLLBAR_WIDTH), 0, // GetActualWidth(SCROLLBAR_WIDTH), defaultFrame.Height()); // vertScrollBar->PostSetup(); // vertScrollBar->SetTickValue(20); // vertScrollBar->SetAttachFlags(ATTACH_TOP | ATTACH_BOTTOM | ATTACH_RIGHT ); vertScrollBar->Show(); } if(!vert && (vertScrollBar != NULL)) { pawsWidget::DeleteChild(vertScrollBar); vertScrollBar = NULL; if(layout) layout->SetVertScroll(0); } SetScrollBarMax(); }
Rect Image::GetCoverageBounds () { // FIXME: SL3 final only supports PixelFormatPbgra32 which makes this optimization // obsolete - unless we keep an "has_alpha" flag with each image ?!? return Rect (); #if FALSE ImageSource *source = GetSource (); if (!source || source->GetPixelFormat () == PixelFormatPbgra32) return Rect (); Stretch stretch = GetStretch (); if (stretch == StretchFill || stretch == StretchUniformToFill) return bounds; cairo_matrix_t matrix; Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ()); Rect paint = Rect (0, 0, GetActualWidth (), GetActualHeight ()); image_brush_compute_pattern_matrix (&matrix, paint.width, paint.height, image.width, image.height, stretch, AlignmentXCenter, AlignmentYCenter, NULL, NULL); cairo_matrix_invert (&matrix); cairo_matrix_multiply (&matrix, &matrix, &absolute_xform); image = image.Transform (&matrix); image = image.Intersection (bounds); return image; #endif }
void Grid::PostRender (Context *ctx, Region *region, bool skip_children) { // render our chidren if we need to if (!skip_children) { VisualTreeWalker walker = VisualTreeWalker (this, ZForward, false); while (UIElement *child = walker.Step ()) child->DoRender (ctx, region); } if (GetShowGridLines () && ctx->IsMutable ()) { double offset = 0; double dash = 4; ColumnDefinitionCollection *cols = GetColumnDefinitionsNoAutoCreate (); RowDefinitionCollection *rows = GetRowDefinitionsNoAutoCreate (); cairo_t *cr = ctx->Cairo (); int col_count = cols ? cols->GetCount () : 0; int row_count = rows ? rows->GetCount () : 0; cairo_save (cr); RenderLayoutClip (cr); cairo_set_line_width(cr, 1.0); // Initially render a blue color cairo_set_dash (cr, &dash, 1, offset); cairo_set_source_rgb (cr, 0.4, 0.4, 1.0); cairo_new_path (cr); // Draw gridlines between each pair of columns/rows for (int count = 0; count < 2; count++) { for (int i = 0, offset = 0; i < col_count - 1; i++) { ColumnDefinition *def = cols->GetValueAt (i)->AsColumnDefinition (); offset += def->GetActualWidth (); cairo_move_to (cr, offset, 0); cairo_line_to (cr, offset, GetActualHeight ()); } for (int i = 0, offset = 0; i < row_count - 1; i++) { RowDefinition *def = rows->GetValueAt (i)->AsRowDefinition (); offset += def->GetActualHeight (); cairo_move_to (cr, 0, offset); cairo_line_to (cr, GetActualWidth (), offset); } cairo_stroke (cr); // For the second pass render a yellow color in the gaps between the previous dashes cairo_set_dash (cr, &dash, 1, dash); cairo_set_source_rgb (cr, 1.0, 1.0, 0.3); } cairo_restore (cr); } // Chain up, but skip children since we've already rendered them here. UIElement::PostRender (ctx, region, true); }
void pawsComboBox::OnListAction( pawsListBox* widget, int status ) { itemChoice->SetText(GetSelectedRowString()); if (!closed) { arrow->SetUpImage(downButton); arrow->SetDownImage(downButtonPressed); SetSize( oldWidth, oldHeight ); if (fliptotop) { MoveDelta(0,rows*GetActualHeight(rowHeight)+15); itemChoice->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); arrow->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); } listChoice->Hide(); closed = true; } parent->OnListAction( widget, status ); }
void Grid::ComputeBounds () { Panel::ComputeBounds (); if (GetShowGridLines ()) { extents = Rect (0,0,GetActualWidth (),GetActualHeight ()); extents_with_children = extents_with_children.Union (extents); bounds = IntersectBoundsWithClipPath (extents.GrowBy (effect_padding), false).Transform (&absolute_xform); bounds_with_children = bounds_with_children.Union (bounds); ComputeGlobalBounds (); ComputeSurfaceBounds (); } }
void TimeTrack::WriteXML(XMLWriter &xmlFile) { xmlFile.StartTag(wxT("timetrack")); xmlFile.WriteAttr(wxT("name"), mName); //xmlFile.WriteAttr(wxT("channel"), mChannel); //xmlFile.WriteAttr(wxT("offset"), mOffset, 8); xmlFile.WriteAttr(wxT("height"), GetActualHeight()); xmlFile.WriteAttr(wxT("minimized"), GetMinimized()); xmlFile.WriteAttr(wxT("rangelower"), mRangeLower, 12); xmlFile.WriteAttr(wxT("rangeupper"), mRangeUpper, 12); xmlFile.WriteAttr(wxT("displaylog"), GetDisplayLog()); xmlFile.WriteAttr(wxT("interpolatelog"), GetInterpolateLog()); mEnvelope->WriteXML(xmlFile); xmlFile.EndTag(wxT("timetrack")); }
void TrackList::UpdatePendingTracks() { auto pUpdater = mUpdaters.begin(); for (const auto &pendingTrack : mPendingUpdates) { // Copy just a part of the track state, according to the update // function const auto &updater = *pUpdater; auto src = FindById( pendingTrack->GetId() ); if (pendingTrack && src) { if (updater) updater( *pendingTrack, *src ); pendingTrack->DoSetY(src->GetY()); pendingTrack->DoSetHeight(src->GetActualHeight()); pendingTrack->DoSetMinimized(src->GetMinimized()); pendingTrack->DoSetLinked(src->GetLinked()); } ++pUpdater; } }
bool pawsComboBox::OnButtonPressed(int /*mouseButton*/, int /*keyModifier*/, pawsWidget* widget) { switch ( widget->GetID() ) { case SHOW_LIST: { if ( closed ) { arrow->SetUpImage(upButton); arrow->SetDownImage(upButtonPressed); oldHeight = GetScreenFrame().Height(); oldWidth = GetScreenFrame().Width(); SetSize( GetScreenFrame().Width(), defaultFrame.Height()+rows*GetActualHeight(rowHeight)+15 ); if (fliptotop) { MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); itemChoice->MoveDelta(0,rows*GetActualHeight(rowHeight)+15); arrow->MoveDelta(0,rows*GetActualHeight(rowHeight)+15); } listChoice->Show(); closed = false; } else { arrow->SetUpImage(downButton); arrow->SetDownImage(downButtonPressed); SetSize( oldWidth, oldHeight ); if (fliptotop) { MoveDelta(0,rows*GetActualHeight(rowHeight)+15); itemChoice->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); arrow->MoveDelta(0,-1*(rows*GetActualHeight(rowHeight)+15)); } listChoice->Hide(); closed = true; } return true; } } return false; }
bool pawsSelectorBox::Setup(iDocumentNode* node) { /////////////////////////////////////////////////////////////////////// // Create the available list box /////////////////////////////////////////////////////////////////////// csRef<iDocumentNode> availableNode = node->GetNode("available"); int width = availableNode->GetAttributeValueAsInt("width"); int rowHeight = availableNode->GetAttributeValueAsInt("rowheight"); available = new pawsListBox; AddChild(available); available->SetRelativeFrame(0 , 0, GetActualWidth(width), defaultFrame.Height()); available->PostSetup(); available->Show(); available->UseTitleRow(false); available->SetID(AVAILABLE_BOX); //available->UseBorder(); csString widgetDef("<widget name=\"Text\" factory=\"pawsTextBox\" ></widget>"); available->SetTotalColumns(1); available->SetColumnDef(0, width-20 , rowHeight, widgetDef); /////////////////////////////////////////////////////////////////////// // Create the selected list box /////////////////////////////////////////////////////////////////////// csRef<iDocumentNode> selectedNode = node->GetNode("selected"); width = selectedNode->GetAttributeValueAsInt("width"); rowHeight = selectedNode->GetAttributeValueAsInt("rowheight"); selected = new pawsListBox; AddChild(selected); selected->SetRelativeFrame(defaultFrame.Width()-width , 0, width, defaultFrame.Height()); selected->PostSetup(); selected->Show(); selected->SetName("Selected"); selected->UseTitleRow(false); selected->SetID(SELECTED_BOX); //selected->UseBorder(); csString selectedDef("<widget name=\"Text\" factory=\"pawsTextBox\" ></widget>"); selected->SetTotalColumns(1); selected->SetColumnDef(0, width-20 , rowHeight, selectedDef); /////////////////////////////////////////////////////////////////////// // Create the addbutton /////////////////////////////////////////////////////////////////////// csRef<iDocumentNode> addNode = node->GetNode("addbutton"); if(addNode.IsValid()) { add = new pawsButton; AddChild(add); // Puts the button at the edge of the text box widget add->SetRelativeFrame(GetActualWidth(addNode->GetAttributeValueAsInt("x")), GetActualHeight(addNode->GetAttributeValueAsInt("y")), 16,16); //get some replacement resources for the addbutton up/down csString upAddImageName = addNode->GetAttributeValue("buttonup"); csString downAddImageName = addNode->GetAttributeValue("buttondown"); if(upAddImageName.IsEmpty()) upAddImageName = "Right Arrow"; if(downAddImageName.IsEmpty()) downAddImageName = "Right Arrow"; add->SetUpImage(upAddImageName); add->SetDownImage(downAddImageName); add->SetID(SELECTOR_ADD_BUTTON); add->PostSetup(); } /////////////////////////////////////////////////////////////////////// // Create the removebutton /////////////////////////////////////////////////////////////////////// csRef<iDocumentNode> removeNode = node->GetNode("removebutton"); if(removeNode.IsValid()) { remove = new pawsButton; AddChild(remove); // Puts the button at the edge of the text box widget remove->SetRelativeFrame(GetActualWidth(removeNode->GetAttributeValueAsInt("x")), GetActualHeight(removeNode->GetAttributeValueAsInt("y")), 16,16); //get some replacement resources for the removebutton up/down csString upRemoveImageName = removeNode->GetAttributeValue("buttonup"); csString downRemoveImageName = removeNode->GetAttributeValue("buttondown"); if(upRemoveImageName.IsEmpty()) upRemoveImageName = "Left Arrow"; if(downRemoveImageName.IsEmpty()) downRemoveImageName = "Left Arrow"; remove->SetUpImage(upRemoveImageName); remove->SetDownImage(downRemoveImageName); remove->SetID(SELECTOR_REMOVE_BUTTON); remove->PostSetup(); } return true; }
void EEditShortcutsToolbox::Show() { SetRelativeFramePos(editApp->GetGraphics2D()->GetWidth()/2 - GetActualWidth(screenFrame.Width())/2, editApp->GetGraphics2D()->GetHeight()/2 - GetActualHeight(screenFrame.Height())/2); pawsWidget::Show(); }
void pawsControlWindow::NextStyle() { // We load it each time to make the user able to change the style without the need to // restart the client //Increase style style++; csString filename; filename = PawsManager::GetSingleton().GetLocalization()->FindLocalizedFile("control_styles.xml"); if (!psengine->GetVFS()->Exists(filename.GetData())) { Error2( "Could not find XML: %s",filename.GetData()); return; } csRef<iDocument> doc = ParseFile(psengine->GetObjectRegistry(),filename.GetData()); if (!doc) { Error2("Error parsing file %s", filename.GetData()); return; } csString topNodestr("style"); topNodestr += style; csRef<iDocumentNode> root = doc->GetRoot(); if (!root) { Error2("No XML root in %s", filename.GetData()); return; } csRef<iDocumentNode> topNode = root->GetNode(topNodestr.GetData()); //If "style"+style doesn't exist, jump to start if (!topNode) { if (style == 1) //No styles at all :( return; style=0; NextStyle(); return; } csRef<iDocumentNodeIterator> iter = topNode->GetNodes(); //Loop through the XML int bwidth=52, bheight=52, mwidth=16, mheight=16; float xscale=1.0f, yscale=1.0f; // get the current width and height of the buttons (should be the same for all) pawsButton* btn = (pawsButton*)FindWidget("QuitButton"); int boldwidth = btn->ClipRect().Width(); int boldheight = btn->ClipRect().Height(); while ( iter->HasNext() ) { csRef<iDocumentNode> node = iter->Next(); if (!strcmp(node->GetValue(),"button")) { int x = GetActualWidth(node->GetAttributeValueAsInt("x")); int y = GetActualHeight(node->GetAttributeValueAsInt("y")); csString name = node->GetAttributeValue("name"); pawsWidget* wdg = FindWidget(name.GetData()); if (!wdg) { Error2("No such widget as %s!",name.GetData()); continue; } wdg->SetSize(bwidth, bheight); wdg->SetRelativeFramePos(x, y); } else if (!strcmp(node->GetValue(),"buttons")) { bwidth = GetActualWidth(node->GetAttributeValueAsInt("width")); bheight = GetActualHeight(node->GetAttributeValueAsInt("height")); mwidth = GetActualWidth(node->GetAttributeValueAsInt("hide_width")); mheight = GetActualHeight(node->GetAttributeValueAsInt("hide_height")); // get the multiplier for the button and the widget size if (boldwidth != 0 && boldheight != 0) { xscale = float(boldwidth) / float(bwidth); yscale = float(boldheight) / float(bheight); } } else if (!strcmp(node->GetValue(), "bar")) { orgw = GetActualWidth(node->GetAttributeValueAsInt("width")); orgh = GetActualWidth(node->GetAttributeValueAsInt("height")); SetRelativeFrameSize(orgw, orgh); min_width = GetActualWidth(node->GetAttributeValueAsInt("min_w")); min_height = GetActualWidth(node->GetAttributeValueAsInt("min_h")); alwaysResize = node->GetAttributeValueAsBool("always_resize", true); SetResizeShow(alwaysResize); } } /* Resize the widget according to the proportions of the previous style. * * When the new styles dimensions exceeds its max it will be downsized to fit. * See: pawsWidget::Resize(int deltaX, int deltaY, int flags) */ Resize( int(xscale*orgw-orgw), int(yscale*orgh-orgh), RESIZE_RIGHT | RESIZE_BOTTOM ); // Set the minimize buttons size pawsButton* minUp = (pawsButton*)FindWidget("ShowButtonUp"); minUp->SetSize(mwidth,mheight); pawsButton* minDown = (pawsButton*)FindWidget("ShowButtonDown"); minDown->SetSize(mwidth,mheight); }
bool pawsComboBox::PostSetup() { bool ok = false; /////////////////////////////////////////////////////////////////////// // Create the drop arrow button that will cause the list box to drop. /////////////////////////////////////////////////////////////////////// arrow = new pawsButton; AddChild( arrow ); // Puts the button at the edge of the text box widget arrow->SetRelativeFrame( defaultFrame.Width()-18, 4, 18, 16 ); arrow->SetUpImage(downButton); arrow->SetDownImage(downButtonPressed); arrow->SetID( SHOW_LIST ); ok = arrow->PostSetup(); /////////////////////////////////////////////////////////////////////// // Create the textbox that has the current selected choice /////////////////////////////////////////////////////////////////////// itemChoice = new pawsTextBox; itemChoice->SetBackground("Scaling Field Background"); AddChild( itemChoice ); // Puts the button at the edge of the text box widget itemChoice->SetRelativeFrame( 0 , 4, defaultFrame.Width()-23, defaultFrame.Height() ); ok = ok && itemChoice->PostSetup(); itemChoice->SetText(text); itemChoice->SetID( SHOW_LIST ); /////////////////////////////////////////////////////////////////////// // Create the drop down list box /////////////////////////////////////////////////////////////////////// listChoice = new pawsListBox; AddChild( listChoice ); if (fliptotop) { listChoice->SetRelativeFrame( 0 , 0, defaultFrame.Width(), rows*GetActualHeight(rowHeight)+15); } else { listChoice->SetRelativeFrame( 0 , defaultFrame.Height(), defaultFrame.Width(), rows*GetActualHeight(rowHeight)+15); } listChoice->Hide(); listChoice->UseTitleRow( false ); listChoice->SetBackground("Scaling Widget Background"); listChoice->SetID( id ); listChoice->SetBackgroundAlpha(listalpha); listChoice->UseBorder("line"); listChoice->SetAlwaysOnTop(true); listChoice->SetName("ComboListBox"); csString widgetDef("<widget name=\"Text\" factory=\"pawsTextBox\" ></widget>"); listChoice->SetTotalColumns( 1 ); if(useScrollBar) { ok = ok && listChoice->PostSetup(); listChoice->SetColumnDef( 0, defaultFrame.Width()-32, rowHeight, widgetDef ); } else { listChoice->SetColumnDef( 0, defaultFrame.Width()-10, rowHeight, widgetDef ); } listChoice->SetSortingFunc(0, &textBoxSortFunc); if(!sorted) listChoice->SetSortedColumn(-1); return ok; }
bool pawsGMSpawnWindow::PostSetup() { psengine->GetMsgHandler()->Subscribe( this, MSGTYPE_GMSPAWNITEMS ); psengine->GetMsgHandler()->Subscribe( this, MSGTYPE_GMSPAWNTYPES ); loaded = true; itemName = (pawsTextBox*)FindWidget("ItemName"); itemCount= (pawsEditTextBox*)FindWidget("Count"); itemQuality = (pawsEditTextBox*)FindWidget("Quality"); objView = (pawsObjectView*)FindWidget("ItemView"); //wait for the view to complete loading while(!objView->ContinueLoad()) { csSleep(100); } itemImage = FindWidget("ItemImage"); cbForce = (pawsCheckBox*)FindWidget("Force"); cbLockable = (pawsCheckBox*)FindWidget("Lockable"); cbLocked = (pawsCheckBox*)FindWidget("Locked"); cbPickupable = (pawsCheckBox*)FindWidget("Pickupable"); cbPickupableWeak = (pawsCheckBox*)FindWidget("PickupableWeak"); cbCollidable = (pawsCheckBox*)FindWidget("Collidable"); cbUnpickable = (pawsCheckBox*)FindWidget("Unpickable"); cbTransient = (pawsCheckBox*)FindWidget("Transient"); cbSettingItem = (pawsCheckBox*)FindWidget("Settingitem"); cbNPCOwned = (pawsCheckBox*)FindWidget("Npcowned"); lockSkill = (pawsEditTextBox*)FindWidget("LockSkill"); lockStr = (pawsEditTextBox*)FindWidget("LockStr"); factname = (pawsTextBox*)FindWidget("meshfactname"); meshname = (pawsTextBox*)FindWidget("meshname"); imagename = (pawsTextBox*)FindWidget("imagename"); modname[psGMSpawnMods::ITEM_PREFIX] = (pawsTextBox*)FindWidget("prefix"); modname[psGMSpawnMods::ITEM_SUFFIX] = (pawsTextBox*)FindWidget("suffix"); modname[psGMSpawnMods::ITEM_ADJECTIVE] = (pawsTextBox*)FindWidget("adjective"); // creates tree: itemTree = new pawsItemTree; if (itemTree == NULL) { Error1("Could not create widget pawsItemTree"); return false; } AddChild(itemTree); itemTree->SetDefaultColor( graphics2D->FindRGB( 0,255,0 ) ); itemTree->SetRelativeFrame(0,0,GetActualWidth(250),GetActualHeight(560)); itemTree->SetNotify(this); itemTree->SetAttachFlags(ATTACH_TOP | ATTACH_BOTTOM | ATTACH_LEFT); itemTree->SetScrollBars(false, true); itemTree->UseBorder("line"); itemTree->Resize(); itemTree->InsertChildL("", "TypesRoot", "", ""); pawsTreeNode * child = itemTree->GetRoot()->GetFirstChild(); while (child != NULL) { child->CollapseAll(); child = child->GetNextSibling(); } itemTree->SetNotify(this); return true; }
void Image::Render (cairo_t *cr, Region *region, bool path_only) { ImageSource *source = GetSource (); cairo_pattern_t *pattern = NULL; cairo_matrix_t matrix; if (!source) return; source->Lock (); cairo_save (cr); Size specified (GetActualWidth (), GetActualHeight ()); Size stretched = ApplySizeConstraints (specified); bool adjust = specified != GetRenderSize (); if (GetStretch () != StretchUniformToFill) specified = specified.Min (stretched); Rect paint = Rect (0, 0, specified.width, specified.height); if (!path_only) { Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ()); if (GetStretch () == StretchNone) paint = paint.Union (image); if (image.width == 0.0 && image.height == 0.0) goto cleanup; pattern = cairo_pattern_create_for_surface (source->GetSurface (cr)); image_brush_compute_pattern_matrix (&matrix, paint.width, paint.height, image.width, image.height, GetStretch (), AlignmentXCenter, AlignmentYCenter, NULL, NULL); cairo_pattern_set_matrix (pattern, &matrix); #if MAKE_EVERYTHING_SLOW_AND_BUGGY cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); #endif if (cairo_pattern_status (pattern) == CAIRO_STATUS_SUCCESS) { cairo_set_source (cr, pattern); } cairo_pattern_destroy (pattern); } if (adjust) { // FIXME: Propagate error properly MoonError error; specified = MeasureOverrideWithError (specified, &error); paint = Rect ((stretched.width - specified.width) * 0.5, (stretched.height - specified.height) * 0.5, specified.width, specified.height); } if (!path_only) RenderLayoutClip (cr); paint = paint.Intersection (Rect (0, 0, stretched.width, stretched.height)); paint.Draw (cr); if (!path_only) cairo_fill (cr); cleanup: cairo_restore (cr); source->Unlock (); }