void ButtonRendering::RenderCornerButton(bounds2f viewport, texture* texture, bounds2f bounds, float radius) { vertexbuffer<texture_vertex> shape; shape._mode = GL_TRIANGLES; bounds2f outer = bounds; bounds2f inner = outer.grow(-radius); AddRect(shape, bounds2f(outer.min.x, outer.min.y, inner.min.x, inner.min.y), bounds2f(0.0, 0.0, 0.5, 0.5)); AddRect(shape, bounds2f(inner.min.x, outer.min.y, inner.max.x, inner.min.y), bounds2f(0.5, 0.0, 0.5, 0.5)); AddRect(shape, bounds2f(inner.max.x, outer.min.y, outer.max.x, inner.min.y), bounds2f(0.5, 0.0, 1.0, 0.5)); AddRect(shape, bounds2f(outer.min.x, inner.min.y, inner.min.x, inner.max.y), bounds2f(0.0, 0.5, 0.5, 0.5)); AddRect(shape, bounds2f(inner.min.x, inner.min.y, inner.max.x, inner.max.y), bounds2f(0.5, 0.5, 0.5, 0.5)); AddRect(shape, bounds2f(inner.max.x, inner.min.y, outer.max.x, inner.max.y), bounds2f(0.5, 0.5, 1.0, 0.5)); AddRect(shape, bounds2f(outer.min.x, inner.max.y, inner.min.x, outer.max.y), bounds2f(0.0, 0.5, 0.5, 1.0)); AddRect(shape, bounds2f(inner.min.x, inner.max.y, inner.max.x, outer.max.y), bounds2f(0.5, 0.5, 0.5, 1.0)); AddRect(shape, bounds2f(inner.max.x, inner.max.y, outer.max.x, outer.max.y), bounds2f(0.5, 0.5, 1.0, 1.0)); texture_uniforms uniforms; uniforms._transform = sprite_transform(viewport).transform(); uniforms._texture = texture; _renderers->_texture_renderer->render(shape, uniforms); }
u32 GetDirtyRect_OutSide(TRect Rect,TRect DelRect,TRect **ppRects) { // RectとDelRectのサイズ(w,h)は同じじゃなきゃダメ RectCount=0; *ppRects=&Rects[0]; if((Rect.x==DelRect.x)&&(Rect.y==DelRect.y)) return(RectCount); if(((Rect.x+Rect.w)<DelRect.x)||((DelRect.x+DelRect.w)<Rect.x)|| ((Rect.y+Rect.h)<DelRect.y)||((DelRect.y+DelRect.h)<Rect.y)){ AddRect(Rect); return(RectCount); } if(Rect.y!=DelRect.y){ TRect r=Rect; if(Rect.y<DelRect.y){ r.h=DelRect.y-Rect.y; }else{ r.y=DelRect.y+DelRect.h; r.h=Rect.y-DelRect.y; } AddRect(r); } if(Rect.x!=DelRect.x){ TRect r=Rect; if(Rect.x<DelRect.x){ r.w=DelRect.x-Rect.x; }else{ r.x=DelRect.x+DelRect.w; r.w=Rect.x-DelRect.x; } if(Rect.y!=DelRect.y){ if(Rect.y<DelRect.y){ r.y=DelRect.y; r.h=Rect.h-(DelRect.y-Rect.y); }else{ r.h=Rect.h-(Rect.y-DelRect.y); } } AddRect(r); } return(RectCount); }
status_t Preferences::SetRect (const char *name, BRect r) { if (HasRect (name) == true) return ReplaceRect (name, 0, r); return AddRect (name, r); }
void AnnotWriter::DoAnnotation(Annotation* a) { AddRect(&mAnnot, "Rect", a->GetRect()); if (a->HasColor()) { AddColor(&mAnnot, "C", a->GetColor()); } if (a->GetDate()[0] != 0) { AddString(&mAnnot, "M", (char*)a->GetDate()); } AddInteger(&mAnnot, "F", a->GetFlags()->Flags()); if (a->GetTitle() != NULL) { AddString(&mAnnot, "T", a->GetTitle()); } if (a->GetOpacity() != 1.0) { AddReal(&mAnnot, "CA", a->GetOpacity()); } PopupAnnot* popup = a->GetPopup(); if (popup != NULL) { popup->SetParentRef(a->GetRef()); if (is_empty_ref(popup->GetRef())) { popup->SetRef(mXRefTable.GetNewRef(xrefEntryUncompressed)); } AddRef(&mAnnot, "Popup", popup->GetRef()); } if (HasAppearanceStream(a)) { mASRef = mXRefTable.GetNewRef(xrefEntryUncompressed); Object ap; ap.initDict(mXRef); AddRef(&ap, "N", mASRef); AddDict(&mAnnot, "AP", &ap); } if (dynamic_cast<PopupAnnot*>(a) == NULL) { AddRef(&mAnnot, "P", mPageRef); } }
status_t AttributeMessage::SetAttribute(const char* name, const BRect& value) { if (ReplaceRect(name, value) == B_OK) return B_OK; return AddRect(name, value); }
void PSettings::SetRect(const char *name,BRect rect) { BRect old; status_t s=FindRect(name,&old); if(s==B_OK)ReplaceRect(name,rect); else AddRect(name,rect); }
myinline ArpMessage& ArpMessage::SetRect(const char *name, const BRect& dat) { if( !this ) return *((ArpMessage*)NULL); if( status == B_NO_ERROR ) { status = AddRect(name, dat); } return *this; }
void vncRegion::AddRect(RECT R, int xoffset, int yoffset) { R.left += xoffset; R.top += yoffset; R.right += xoffset; R.bottom += yoffset; AddRect(R); }
void DVDLabelCoverSvc::ProcessDVDThumbnail(int idx, const Rect& lct) { if( idx == dvdIdx ) { DRect drct(lct); drct.lft -= 1; // разделительная черта AddRect(drct); } }
KariudoKen::KariudoKen(int rXPx, int rYPx) { KARIKENSX = GI("KARIKENSX"); KARIKENSY = GI("KARIKENSY"); KARIKENSPX = GF("KARIKENSPX"); KARIKENKGHANI = GF("KARIKENKGHANI"); KARIKENWTM1 = GF("KARIKENWTM1"); KARIKENWTM2 = GF("KARIKENWTM2"); mX = rXPx; mY = rYPx - sMapAtHanteiY[0][0] + SP->CHSZY; mSizeX = KARIKENSX; mSizeY = KARIKENSY; mStatus = ARUKI; mKgTimer = 0.0f; mSeFl = false; // 当たり判定 AddFrame(FR_KAMAE); AddFrame(FR_ZANZOU); AddFrame(FR_DOWN); AddRect(FR_KAMAE, SP->GRID_BOGYO, 43, 33, 81, 119); AddIndexedRect( FR_KAMAE, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120); AddRect(FR_ZANZOU, SP->GRID_BOGYO, 43, 33, 81, 119); AddCircle(FR_ZANZOU, SP->GRID_KOUGEKI, 38, 43, 35); AddCircle(FR_ZANZOU, SP->GRID_KOUGEKI, 33, 69, 35); AddIndexedRect( FR_ZANZOU, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120); AddRect(FR_DOWN, SP->GRID_BOGYO, 43, 33, 81, 119); AddCircle(FR_DOWN, SP->GRID_BOGYO, 20, 62, 11); AddIndexedRect( FR_DOWN, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120); //AddCircle(0, GRID_BOGYO, 60, 60, 30); SetAnim(0); }
void PointerCoverSvc::ProcessPointer(const Point& pos) { PaintPointer(pos, true); DRect rct; cont->get_stroke_extents(rct.lft, rct.top, rct.rgt, rct.btm); AddRect(rct); cont->begin_new_path(); }
void Preferences::SaveRect(BRect& rect, const char* name) { Lock(); if (HasRect(name)) ReplaceRect(name, rect); else AddRect(name, rect); Unlock(); }
CRectKeeper &CRectKeeper::Merge(const CRectKeeper &other) { for (int i=0; i<other.m_iQcRectCount; ++i) { AddRect(other.m_paQcRects[i]); } return (*this); }
AUI_ERRCODE aui_DirtyList::AddRect( RECT *rect ) { Assert( rect != NULL ); if ( !rect ) return AUI_ERRCODE_INVALIDPARAM; return AddRect( rect->left, rect->top, rect->right, rect->bottom ); }
void UIView::ConvertStaticMappings(NIBWriter *writer, XIBObject *obj) { if ( !_ignoreUIObject ) writer->_allUIObjects->AddMember(NULL, this); if ( _subviews->count() > 0 ) { int count = _subviews->count(); for ( int i = 0; i < count; i ++ ) { XIBObject *curObj = _subviews->objectAtIndex(i); if ( !curObj->_ignoreUIObject ) writer->_allUIObjects->AddMember(NULL, curObj); } } AddRect(writer, "UIBounds", _bounds); AddPoint(writer, "UICenter", _center); if ( _contentStretch.x != 0.0f || _contentStretch.y != 0.0f || _contentStretch.width != 0.0f || _contentStretch.height != 0.0f ) { AddRect(writer, "UIContentStretch", _contentStretch); } Map(writer, obj, propertyMappings, numPropertyMappings); if ( _subviews->count() > 0 ) AddOutputMember(writer, "UISubviews", _subviews); if ( _constraints->count() > 0) AddOutputMember(writer, "UIViewAutolayoutConstraints", _constraints); if ( _autoresizeSubviews ) AddBool(writer, "UIAutoresizeSubviews", _autoresizeSubviews); if ( _autoresizingMask ) AddInt(writer, "UIAutoresizingMask", _autoresizingMask); if ( _clipsToBounds ) AddBool(writer, "UIClipsToBounds", _clipsToBounds); if ( _backgroundColor ) AddOutputMember(writer, "UIBackgroundColor", _backgroundColor); if ( _contentMode ) AddInt(writer, "UIContentMode", _contentMode); if ( _userInteractionDisabled ) AddBool(writer, "UIUserInteractionDisabled", _userInteractionDisabled); if ( _hidden ) AddBool(writer, "UIHidden", _hidden); if ( !_enabled ) AddBool(writer, "UIDisabled", true); if ( _multipleTouchEnabled ) AddBool(writer, "UIMultipleTouchEnabled", _multipleTouchEnabled); if ( !_clearsContextBeforeDrawing ) AddBool(writer, "UIClearsContextBeforeDrawing", _clearsContextBeforeDrawing); // Metadata if ( !_translatesAutoresizeToConstraints || !obj->GetBool("IBViewMetadataTranslatesAutoresizingMaskIntoConstraints", true) ) AddBool(writer, "UIViewDoesNotTranslateAutoresizingMaskIntoConstraints", true); if ( _opaque ) obj->AddBool(writer, "UIOpaque", _opaque); ObjectConverterSwapper::ConvertStaticMappings(writer, obj); }
void Preferences::SaveWindowFrame(BWindow* window, const char* name) { Lock(); BRect rect = window->Frame(); if (HasRect(name)) ReplaceRect(name, rect); else AddRect(name, rect); Unlock(); }
void PointerCoverSvc::Process() { FormBigLabel(); FormScale(); if( DrawRedLine(cont, trkLay) ) { DRect rct; cont->get_stroke_extents(rct.lft, rct.top, rct.rgt, rct.btm); AddRect(rct); cont->begin_new_path(); } }
// -------------------------------------------------------------------------------- // Name : AddAtEmptySpot // Description : Add the given rectangle // -------------------------------------------------------------------------------- bool CRectPlacement::AddAtEmptySpot (TRect &r) { // Find a valid spot among available anchors. bool bFound = false; CPosArray::iterator it; for (it = m_vPositions.begin(); !bFound && it != m_vPositions.end(); ++it) { TRect Rect(it->x, it->y, r.w, r.h); if (IsFree(Rect)) { r = Rect; bFound = true; break; // Don't let the loop increase the iterator. } } if (bFound) { // Remove the used anchor point m_vPositions.erase(it); // Sometimes, anchors end up displaced from the optimal position // due to irregular sizes of the subrects. // So, try to adjut it up & left as much as possible. int x,y; for (x = 1; x <= r.x; x++) if (!IsFree(TRect(r.x - x, r.y, r.w, r.h))) break; for (y = 1; y <= r.y; y++) if (!IsFree(TRect(r.x, r.y - y, r.w, r.h))) break; if (y > x) r.y -= y-1; else r.x -= x-1; AddRect(r); } return bFound; }
void ButtonRendering::RenderCornerButton(const glm::mat4& transform, texture* texturex, bounds2f bounds, float radius) { vertexbuffer<texture_vertex> shape; shape._mode = GL_TRIANGLES; bounds2f outer = bounds; bounds2f inner = outer.grow(-radius); AddRect(shape, bounds2f(outer.min.x, outer.min.y, inner.min.x, inner.min.y), bounds2f(0.0, 0.0, 0.5, 0.5)); AddRect(shape, bounds2f(inner.min.x, outer.min.y, inner.max.x, inner.min.y), bounds2f(0.5, 0.0, 0.5, 0.5)); AddRect(shape, bounds2f(inner.max.x, outer.min.y, outer.max.x, inner.min.y), bounds2f(0.5, 0.0, 1.0, 0.5)); AddRect(shape, bounds2f(outer.min.x, inner.min.y, inner.min.x, inner.max.y), bounds2f(0.0, 0.5, 0.5, 0.5)); AddRect(shape, bounds2f(inner.min.x, inner.min.y, inner.max.x, inner.max.y), bounds2f(0.5, 0.5, 0.5, 0.5)); AddRect(shape, bounds2f(inner.max.x, inner.min.y, outer.max.x, inner.max.y), bounds2f(0.5, 0.5, 1.0, 0.5)); AddRect(shape, bounds2f(outer.min.x, inner.max.y, inner.min.x, outer.max.y), bounds2f(0.0, 0.5, 0.5, 1.0)); AddRect(shape, bounds2f(inner.min.x, inner.max.y, inner.max.x, outer.max.y), bounds2f(0.5, 0.5, 0.5, 1.0)); AddRect(shape, bounds2f(inner.max.x, inner.max.y, outer.max.x, outer.max.y), bounds2f(0.5, 0.5, 1.0, 1.0)); _renderers->_texture_renderer->get_uniform<glm::mat4>("transform").set_value(transform); _renderers->_texture_renderer->get_uniform<const texture*>("texture").set_value(texturex); _renderers->_texture_renderer->render(shape); }
MyWindow::MyWindow(QWidget * parent, Qt::WFlags flags) : QMainWindow(parent, flags) { QWidget * centralWidget = new QWidget(this); QGridLayout * mainlayout = new QGridLayout(centralWidget); mainlayout->setMargin(1); mainlayout->setSpacing(1); sa_xy = new QScrollArea(centralWidget); xy = new PixLabel(); xy->setFixedSize(1024, 512); sa_xy->setWidget(xy); mainlayout->addWidget(sa_xy, 0, 0, 1, 4); setCentralWidget(centralWidget); buttAdd = new QPushButton(centralWidget); buttAdd->setText(tr("Add")); mainlayout->addWidget(buttAdd, 1, 0); buttCode = new QPushButton(centralWidget); buttCode->setText(tr("Code")); mainlayout->addWidget(buttCode, 1, 1); buttSave = new QPushButton(centralWidget); buttSave->setText(tr("Save")); mainlayout->addWidget(buttSave, 1, 3); buttLoad = new QPushButton(centralWidget); buttLoad->setText(tr("Load")); mainlayout->addWidget(buttLoad, 1, 2); connect(buttAdd, SIGNAL(clicked()), xy, SLOT(AddRect())); connect(buttCode, SIGNAL(clicked()), this, SLOT(Code())); connect(buttSave, SIGNAL(clicked()), this, SLOT(Save())); connect(buttLoad, SIGNAL(clicked()), this, SLOT(Load())); }
bool AnnotWriter::WriteAS(Ref& ref, Annotation* a) { if (is_empty_ref(ref)) return true; Object xobj; xobj.initDict(mXRef); // setup XObject dictionary AddName(&xobj, "Type", "XObject"); AddName(&xobj, "Subtype", "Form"); AddInteger(&xobj, "FormType", 1); PDFRectangle r = *a->GetRect(); r.x2 -= r.x1; r.y2 -= r.y1; r.x1 = r.y1 = 0; AddRect(&xobj, "BBox", &r); // setup resource dictionary Object resources, array, name; resources.initDict(mXRef); array.initArray(mXRef); name.initName("PDF"); array.arrayAdd(&name); resources.dictAdd(copyString("ProcSet"), &array); xobj.dictAdd(copyString("Resources"), &resources); // create appearance stream AnnotAppearance as; a->Visit(&as); // set length AddInteger(&xobj, "Length", as.GetLength()); ASSERT(as.GetLength() > 0); // write form XObject WriteObject(ref, &xobj, as.GetStream()); xobj.free(); ref = empty_ref; return true; }
void Region::AddRegionRects(const Region ®ion) { for (int i = 0; i < region.fNumRects; i++) AddRect(region.RectAt(i)); }
void DisplayList::UpdateRect(SRECT* clip) { if ( bits->LockBits() ) { raster.Attach(bits, clip, antialias); raster.BeginPaint(); // Add the background edges REdge bkEdges[2]; RColor bkColor; if ( backgroundColor.all != 0 ) { // Set up the color bkColor.SetUp(&raster); bkColor.order = 0; bkColor.rgb.alpha = 255; bkColor.rgb.red = backgroundColor.rgb.red; bkColor.rgb.green = backgroundColor.rgb.green; bkColor.rgb.blue = backgroundColor.rgb.blue; bkColor.BuildCache(); // Set up the edges bkEdges[0].nextObj = &bkEdges[1]; bkEdges[1].nextObj = 0; SPOINT pt1, pt2; CURVE c; pt1.y = raster.edgeClip.ymin; pt2.y = raster.edgeClip.ymax; pt1.x = pt2.x = raster.edgeClip.xmin; CurveSetLine(&pt1, &pt2, &c); bkEdges[0].Set(&c); pt1.x = pt2.x = raster.edgeClip.xmax; CurveSetLine(&pt1, &pt2, &c); bkEdges[1].Set(&c); bkEdges[0].dir = bkEdges[1].dir = 0; bkEdges[0].fillRule = bkEdges[1].fillRule = fillEvenOddRule; bkEdges[0].color1 = bkEdges[1].color1 = &bkColor; bkEdges[0].color2 = bkEdges[1].color2 = 0; raster.AddEdges(bkEdges, &bkColor); } else { // It's transparent... raster.getBackground = true; } { // Add the object edges root.Draw(&raster, camera); } #ifndef DISABLE_TAB_FOCUS // Add button focus rectangle RColor yellow; REdge* edges = NULL; if (useFocusRect && !RectIsEmpty(&tabFocusRect)) { // Set up the color yellow.SetUp(&raster); yellow.order = 0; yellow.rgb.alpha = 255; yellow.rgb.red = 255; yellow.rgb.green = 255; yellow.rgb.blue = 0; yellow.BuildCache(); SRECT bounds = tabFocusRect; MATRIX mat; MatrixIdentity(&mat); int border = 3; if (antialias) { border *= 4; } SRECT rect = bounds; rect.xmax = bounds.xmin + border; AddRect(&rect, &mat, &yellow, this, &edges, NULL); rect.xmin = bounds.xmax - border; rect.xmax = bounds.xmax; AddRect(&rect, &mat, &yellow, this, &edges, NULL); rect.xmin = bounds.xmin; rect.ymax = bounds.ymin + border; AddRect(&rect, &mat, &yellow, this, &edges, NULL); rect.ymin = bounds.ymax - border; rect.ymax = bounds.ymax; AddRect(&rect, &mat, &yellow, this, &edges, NULL); raster.AddEdges(edges, &yellow); } #endif raster.PaintBits(); #ifndef DISABLE_TAB_FOCUS if (!RectIsEmpty(&tabFocusRect)) { // Free the edges REdge* e = edges; while ( e ) { REdge* next = e->nextObj; FreeEdge(e); e = next; } edges = 0; yellow.FreeCache(); } #endif if ( backgroundColor.all != 0 ) bkColor.FreeCache(); bits->UnlockBits(); } }
status_t TPreferences::SetRect(const char *name, BRect r) { if (HasRect(name)) { return ReplaceRect(name, 0, r); } return AddRect(name, r); }
void UIShape::AddRect(qreal Left, qreal Top, qreal Width, qreal Height) { AddRect(QRectF(Left, Top, Width, Height)); }
void DVDLabelCoverSvc::ProcessDVDMark(int idx, const Point& pos) { if( idx == dvdIdx ) AddRect(GetDVDLabelLocation(idx, pos)); }
void PointerCoverSvc::ProcessBigLabel(RefPtr<Pango::Layout> lay, const Point& pos) { DPoint sz(CalcTextSize(lay)); AddRect( RectASz(DPoint(pos), sz) ); }
void GuiProgress::Show(const char *szImgName) { // preventive mGUI->mMessageboxGui.Hide(); // build rect tstring backimg = szImgName; backimg.Replace(".track",".dds"); /* blocking texture loading */ ZTexture *tex = GDD->NewTexture(); ZFile file; if (file.Open(backimg.c_str(), ZOPEN_READ, false)) { unsigned char *tmpTex = new unsigned char [file.GetSize()]; file.Read(tmpTex, file.GetSize()); tex->LoadDDSFromMemory(tmpTex, file.GetSize() ); delete [] tmpTex; } // -- backimg.Replace(".dds","\0"); backimg.ToLower(); trckNfo->setText(backimg.c_str()); mLoadingRect = AddRect(0.f, 0.f, 1.f, 1.f, 0.f, 1.f, 1.f, 0.f); mLoadingRectTransform = mLoadingRect->GetTransform(); ZMaterial *mat = mLoadingRect->GetMaterial(0); mat->setEffect(guifx); mat->addTexture(tex); mat->connectEffect(true, false); FFxSetParam *paramcolor = mat->getNamedParam("col"); if (paramcolor) paramcolor->setVector(vector4(1.f)); mLoadingRect->SetVisible(true); //mLoadingRect->AddRef(); // Show GUI mLoadingfrm->show(); IncStackCount(); // transition /* GDD->ApplyRandomTransition(); // reset post process things GDD->SetPPfocalFactor(0.f); GDD->SetSepiaStrength(0.f); */ }
void C4RectList::ClipByRect(const C4Rect &rClip) { // split up all rectangles for (int32_t i = 0; i < GetCount(); ++i) { C4Rect *pTarget = &Get(i); // any overlap? if (rClip.x + rClip.Wdt <= pTarget->x) continue; if (rClip.y + rClip.Hgt <= pTarget->y) continue; if (rClip.x >= pTarget->x + pTarget->Wdt) continue; if (rClip.y >= pTarget->y + pTarget->Hgt) continue; // okay; split up rectangle // first split will just reduce the target rectangle size // if more splits are done, additional rectangles need to be added int32_t iSplitCount = 0, iOver; C4Rect rcThis(*pTarget); // clipped by right side if ((iOver = rcThis.x + rcThis.Wdt - rClip.x - rClip.Wdt) > 0) { pTarget->x += pTarget->Wdt - iOver; pTarget->Wdt = iOver; rcThis.Wdt -= iOver; ++iSplitCount; } // clipped by obttom side if ((iOver = rcThis.y + rcThis.Hgt - rClip.y - rClip.Hgt) > 0) { if (iSplitCount) { AddRect(rcThis); pTarget = &Get(GetCount() - 1); } pTarget->y += pTarget->Hgt - iOver; pTarget->Hgt = iOver; rcThis.Hgt -= iOver; ++iSplitCount; } // clipped by left side if ((iOver = rClip.x - rcThis.x) > 0) { if (iSplitCount) { AddRect(rcThis); pTarget = &Get(GetCount() - 1); } pTarget->Wdt = iOver; rcThis.Wdt -= iOver; rcThis.x = rClip.x; ++iSplitCount; } // clipped by top side if ((iOver = rClip.y - rcThis.y) > 0) { if (iSplitCount) { AddRect(rcThis); pTarget = &Get(GetCount() - 1); } else ++iSplitCount; pTarget->Hgt = iOver; /* rcThis.Hgt -= iOver; rcThis.y = rClip.y; not needed, since rcThis is no longer used */ } // nothing split? This means this rectnagle is completely contained if (!iSplitCount) { // make it vanish RemoveIndexedRect(i); --i; } } // concat rectangles if possible bool fDone = false; while (!fDone) { fDone = true; for (int32_t i = 0, cnt = GetCount(); i < cnt && fDone; ++i) { C4Rect &rc1 = Get(i); for (int32_t j = i + 1; j < cnt; ++j) { C4Rect &rc2 = Get(j); if (rc1.y == rc2.y && rc1.Hgt == rc2.Hgt) { if (rc1.x + rc1.Wdt == rc2.x) { rc1.Wdt += rc2.Wdt; RemoveIndexedRect(j); fDone = false; break; } else if (rc2.x + rc2.Wdt == rc1.x) { rc2.Wdt += rc1.Wdt; RemoveIndexedRect(i); fDone = false; break; } } else if (rc1.x == rc2.x && rc1.Wdt == rc2.Wdt) { if (rc1.y + rc1.Hgt == rc2.y) { rc1.Hgt += rc2.Hgt; RemoveIndexedRect(j); fDone = false; break; } else if (rc2.y + rc2.Hgt == rc1.y) { rc2.Hgt += rc1.Hgt; RemoveIndexedRect(i); fDone = false; break; } } } } } }
Region& Region::Exclude(const Rect &excludeRect) { BeginOperation(); int index = 0; int rectsToCheck = fNumRects; while (index < rectsToCheck) { Rect &clipRect = fRects[index]; if (!excludeRect.Intersects(clipRect)) { index++; continue; } // This clip rect intersects the excluded rect, and could be divided into // as many as eight pieces. Test for each case. Note that none of these // rectangles overlap!!!! Rect quad1(clipRect.left, clipRect.top, excludeRect.left - 1, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad1)) { quad1.Intersect(clipRect); AddRect(quad1); } Rect quad2(excludeRect.left, clipRect.top, excludeRect.right, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad2)) { quad2.Intersect(clipRect); AddRect(quad2); } Rect quad3(excludeRect.right + 1, clipRect.top, clipRect.right, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad3)) { quad3.Intersect(clipRect); AddRect(quad3); } Rect quad4(clipRect.left, excludeRect.top, excludeRect.left - 1, excludeRect.bottom); if (SPLIT_TEST(clipRect, quad4)) { quad4.Intersect(clipRect); AddRect(quad4); } Rect quad5(excludeRect.right + 1, excludeRect.top, clipRect.right, excludeRect.bottom); if (SPLIT_TEST(clipRect, quad5)) { quad5.Intersect(clipRect); AddRect(quad5); } Rect quad6(clipRect.left, excludeRect.bottom + 1, excludeRect.left - 1, clipRect.bottom); if (SPLIT_TEST(clipRect, quad6)) { quad6.Intersect(clipRect); AddRect(quad6); } Rect quad7(excludeRect.left, excludeRect.bottom + 1, excludeRect.right, clipRect.bottom); if (SPLIT_TEST(clipRect, quad7)) { quad7.Intersect(clipRect); AddRect(quad7); } Rect quad8(excludeRect.right + 1, excludeRect.bottom + 1, clipRect.right, clipRect.bottom); if (SPLIT_TEST(clipRect, quad8)) { quad8.Intersect(clipRect); AddRect(quad8); } // This rect has been split, remove it. Note we don't // change the index RemoveRect(index); rectsToCheck--; } EndOperation(); return *this; }