本文整理汇总了C++中Rect::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::IsEmpty方法的具体用法?C++ Rect::IsEmpty怎么用?C++ Rect::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GatherTransparentAreas
void Ctrl::GatherTransparentAreas(Vector<Rect>& area, SystemDraw& w, Rect r, const Rect& clip)
{
GuiLock __;
LTIMING("GatherTransparentAreas");
Point off = r.TopLeft();
Point viewpos = off + GetView().TopLeft();
r.Inflate(overpaint);
Rect notr = GetVoidRect();
if(notr.IsEmpty())
notr = GetOpaqueRect();
notr += viewpos;
if(!IsShown() || r.IsEmpty() || !clip.Intersects(r) || !w.IsPainting(r))
return;
if(notr.IsEmpty())
CombineArea(area, r & clip);
else {
if(notr != r) {
CombineArea(area, clip & Rect(r.left, r.top, notr.left, r.bottom));
CombineArea(area, clip & Rect(notr.right, r.top, r.right, r.bottom));
CombineArea(area, clip & Rect(notr.left, r.top, notr.right, notr.top));
CombineArea(area, clip & Rect(notr.left, notr.bottom, notr.right, r.bottom));
}
for(Ctrl *q = firstchild; q; q = q->next) {
Point qoff = q->InView() ? viewpos : off;
Rect qr = q->GetRect() + qoff;
if(clip.Intersects(qr))
q->GatherTransparentAreas(area, w, qr, clip);
}
}
}
示例2: PaintOpaqueAreas
bool Ctrl::PaintOpaqueAreas(SystemDraw& w, const Rect& r, const Rect& clip, bool nochild)
{
GuiLock __;
LTIMING("PaintOpaqueAreas");
if(!IsShown() || r.IsEmpty() || !r.Intersects(clip) || !w.IsPainting(r))
return true;
Point off = r.TopLeft();
Point viewpos = off + GetView().TopLeft();
if(backpaint == EXCLUDEPAINT)
return w.ExcludeClip(r);
Rect cview = clip & (GetView() + off);
for(Ctrl *q = lastchild; q; q = q->prev)
if(!q->PaintOpaqueAreas(w, q->GetRect() + (q->InView() ? viewpos : off),
q->InView() ? cview : clip))
return false;
if(nochild && (lastchild || GetNext()))
return true;
Rect opaque = (GetOpaqueRect() + viewpos) & clip;
if(opaque.IsEmpty())
return true;
#ifdef SYSTEMDRAW
if(backpaint == FULLBACKPAINT && !dynamic_cast<BackDraw *>(&w))
#else
if(backpaint == FULLBACKPAINT && !w.IsBack())
#endif
{
ShowRepaintRect(w, opaque, LtRed());
BackDraw bw;
bw.Create(w, opaque.GetSize());
bw.Offset(viewpos - opaque.TopLeft());
bw.SetPaintingDraw(w, opaque.TopLeft());
{
LEVELCHECK(bw, this);
Paint(bw);
PaintCaret(bw);
}
bw.Put(w, opaque.TopLeft());
}
else {
w.Clip(opaque);
ShowRepaintRect(w, opaque, Green());
w.Offset(viewpos);
{
LEVELCHECK(w, this);
Paint(w);
PaintCaret(w);
}
w.End();
w.End();
}
LLOG("Exclude " << opaque);
return w.ExcludeClip(opaque);
}
示例3: Init
void RenderWindow::Init(HWND parent, const Rect& bounds)
{
if (window_style_ == 0)
window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle;
int x, y, width, height;
if (bounds.IsEmpty())
{
x = y = width = height = CW_USEDEFAULT;
}
else
{
x = bounds.x();
y = bounds.y();
width = bounds.width();
height = bounds.height();
}
bool destroyed = false;
HWND hwnd = CreateWindowEx(window_ex_style_, kRenderWindowClassName, NULL,
window_style_, x, y, width, height,
parent, NULL, NULL, this);
//assert(hwnd_ && GetLastError() == 0);
DWORD dwStyle = GetWindowLong(GWL_STYLE);
SetWindowLong(GWL_STYLE, (dwStyle & ~WS_CAPTION));
//SetBoundsRect(bounds);
}
示例4: RefreshFrame
void Ctrl::RefreshFrame(const Rect& r) {
GuiLock __;
if(!IsOpen() || !IsVisible() || r.IsEmpty()) return;
LTIMING("RefreshFrame");
LLOG("RefreshRect " << Name() << ' ' << r);
#ifdef PLATFORM_WIN32
if(isdhctrl) {
InvalidateRect(((DHCtrl *)this)->GetHWND(), r, false);
return;
}
#endif
if(!top) {
if(InFrame())
parent->RefreshFrame(r + GetRect().TopLeft());
else
parent->Refresh(r + GetRect().TopLeft());
}
else {
LLOG("WndInvalidateRect: " << r << ' ' << Name());
LTIMING("RefreshFrame InvalidateRect");
WndInvalidateRect(r);
#ifdef PLATFORM_WIN32
LLOG("UpdateRect: " << GetWndUpdateRect() << ' ' << Name());
#endif
}
}
示例5: paint
void
DrawTargetSkia::DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
const Rect &aSource,
const DrawSurfaceOptions &aSurfOptions,
const DrawOptions &aOptions)
{
if (!(aSurface->GetType() == SurfaceType::SKIA || aSurface->GetType() == SurfaceType::DATA)) {
return;
}
if (aSource.IsEmpty()) {
return;
}
MarkChanged();
SkRect destRect = RectToSkRect(aDest);
SkRect sourceRect = RectToSkRect(aSource);
TempBitmap bitmap = GetBitmapForSurface(aSurface);
AutoPaintSetup paint(mCanvas.get(), aOptions);
if (aSurfOptions.mFilter == Filter::POINT) {
paint.mPaint.setFilterBitmap(false);
}
mCanvas->drawBitmapRectToRect(bitmap.mBitmap, &sourceRect, destRect, &paint.mPaint);
}
示例6: paint
void
DrawTargetSkia::DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
const Rect &aSource,
const DrawSurfaceOptions &aSurfOptions,
const DrawOptions &aOptions)
{
if (aSurface->GetType() != SURFACE_SKIA) {
return;
}
if (aSource.IsEmpty()) {
return;
}
MarkChanged();
SkRect destRect = RectToSkRect(aDest);
SkRect sourceRect = RectToSkRect(aSource);
SkMatrix matrix;
matrix.setRectToRect(sourceRect, destRect, SkMatrix::kFill_ScaleToFit);
const SkBitmap& bitmap = static_cast<SourceSurfaceSkia*>(aSurface)->GetBitmap();
AutoPaintSetup paint(mCanvas.get(), aOptions);
SkShader *shader = SkShader::CreateBitmapShader(bitmap, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
shader->setLocalMatrix(matrix);
SkSafeUnref(paint.mPaint.setShader(shader));
if (aSurfOptions.mFilter != FILTER_LINEAR) {
paint.mPaint.setFilterBitmap(false);
}
mCanvas->drawRect(destRect, paint.mPaint);
}
示例7: ScrollCtrl
void Ctrl::ScrollCtrl(Top *top, Ctrl *q, const Rect& r, Rect cr, int dx, int dy)
{
if(top && r.Intersects(cr)) { // Uno: Contains -> Intersetcs
Rect to = cr;
GetTopRect(to, false);
if(r.Intersects(cr.Offseted(-dx, -dy))) { // Uno's suggestion 06/11/26 Contains -> Intersetcs
Rect from = cr.Offseted(-dx, -dy);
GetTopRect(from, false);
MoveCtrl *m = FindMoveCtrlPtr(top->move, q);
if(m && m->from == from && m->to == to) {
LLOG("ScrollView Matched " << from << " -> " << to);
m->ctrl = NULL;
return;
}
}
if(r.Intersects(cr.Offseted(dx, dy))) { // Uno's suggestion 06/11/26 Contains -> Intersetcs
Rect from = to;
to = cr.Offseted(dx, dy);
GetTopRect(to, false);
MoveCtrl& m = top->scroll_move.Add(q);
m.from = from;
m.to = to;
m.ctrl = q;
LLOG("ScrollView Add " << UPP::Name(q) << from << " -> " << to);
return;
}
cr &= r;
if(!cr.IsEmpty()) {
Refresh(cr);
Refresh(cr + Point(dx, dy));
}
}
}
示例8: SnapLineToDevicePixelsForStroking
void
StrokeSnappedEdgesOfRect(const Rect& aRect, DrawTarget& aDrawTarget,
const ColorPattern& aColor,
const StrokeOptions& aStrokeOptions)
{
if (aRect.IsEmpty()) {
return;
}
Point p1 = aRect.TopLeft();
Point p2 = aRect.BottomLeft();
SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget);
aDrawTarget.StrokeLine(p1, p2, aColor, aStrokeOptions);
p1 = aRect.BottomLeft();
p2 = aRect.BottomRight();
SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget);
aDrawTarget.StrokeLine(p1, p2, aColor, aStrokeOptions);
p1 = aRect.TopLeft();
p2 = aRect.TopRight();
SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget);
aDrawTarget.StrokeLine(p1, p2, aColor, aStrokeOptions);
p1 = aRect.TopRight();
p2 = aRect.BottomRight();
SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget);
aDrawTarget.StrokeLine(p1, p2, aColor, aStrokeOptions);
}
示例9: IsPaintingOp
bool SystemDraw::IsPaintingOp(const Rect& r) const
{
Rect cr = r.Offseted(GetOffset());
cr.Intersect(GetClip());
if(cr.IsEmpty())
return false;
return !invalid || gdk_region_rect_in(invalid, GdkRect(cr)) != GDK_OVERLAP_RECTANGLE_OUT;
}
示例10: ScrollRefresh
void Ctrl::ScrollRefresh(const Rect& r, int dx, int dy)
{
GuiLock __;
if(!IsOpen() || !IsVisible() || r.IsEmpty()) return;
int tdx = tabs(dx), tdy = tabs(dy);
if(dx) WndInvalidateRect(RectC(dx >= 0 ? r.left : r.right - tdx, r.top - tdy, tdx, r.Height()));
if(dy) WndInvalidateRect(RectC(r.left - tdx, dy >= 0 ? r.top : r.bottom - tdy, r.Width(), tdy));
}
示例11: surfRect
void
gfxContext::PushGroupAndCopyBackground(gfxContentType content)
{
IntRect clipExtents;
if (mDT->GetFormat() != SurfaceFormat::B8G8R8X8) {
gfxRect clipRect = GetRoundOutDeviceClipExtents(this);
clipExtents = IntRect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
}
if ((mDT->GetFormat() == SurfaceFormat::B8G8R8X8 ||
mDT->GetOpaqueRect().Contains(clipExtents)) &&
!mDT->GetUserData(&sDontUseAsSourceKey)) {
DrawTarget *oldDT = mDT;
RefPtr<SourceSurface> source = mDT->Snapshot();
Point oldDeviceOffset = CurrentState().deviceOffset;
PushNewDT(gfxContentType::COLOR);
if (oldDT == mDT) {
// Creating new DT failed.
return;
}
Point offset = CurrentState().deviceOffset - oldDeviceOffset;
Rect surfRect(0, 0, Float(mDT->GetSize().width), Float(mDT->GetSize().height));
Rect sourceRect = surfRect + offset;
mDT->SetTransform(Matrix());
// XXX: It's really sad that we have to do this (for performance).
// Once DrawTarget gets a PushLayer API we can implement this within
// DrawTargetTiled.
if (source->GetType() == SurfaceType::TILED) {
SnapshotTiled *sourceTiled = static_cast<SnapshotTiled*>(source.get());
for (uint32_t i = 0; i < sourceTiled->mSnapshots.size(); i++) {
Rect tileSourceRect = sourceRect.Intersect(Rect(sourceTiled->mOrigins[i].x,
sourceTiled->mOrigins[i].y,
sourceTiled->mSnapshots[i]->GetSize().width,
sourceTiled->mSnapshots[i]->GetSize().height));
if (tileSourceRect.IsEmpty()) {
continue;
}
Rect tileDestRect = tileSourceRect - offset;
tileSourceRect -= sourceTiled->mOrigins[i];
mDT->DrawSurface(sourceTiled->mSnapshots[i], tileDestRect, tileSourceRect);
}
} else {
mDT->DrawSurface(source, surfRect, sourceRect);
}
mDT->SetOpaqueRect(oldDT->GetOpaqueRect());
PushClipsToDT(mDT);
mDT->SetTransform(GetDTTransform());
return;
}
PushGroup(content);
}
示例12:
bool
Context::IsImmutable ()
{
Rect box;
Top ()->GetClip (&box);
return box.IsEmpty ();
}
示例13: ScrollRefresh
void Ctrl::ScrollRefresh(const Rect& r, int dx, int dy)
{
sCheckGuiLock();
GuiLock __; // Beware: Even if we have ThreadHasGuiLock ASSERT, we still can be the main thread!
LLOG("ScrollRefresh " << r << " " << dx << " " << dy);
if(!IsOpen() || !IsVisible() || r.IsEmpty()) return;
int tdx = tabs(dx), tdy = tabs(dy);
if(dx) WndInvalidateRect(RectC(dx >= 0 ? r.left : r.right - tdx, r.top - tdy, tdx, r.Height()));
if(dy) WndInvalidateRect(RectC(r.left - tdx, dy >= 0 ? r.top : r.bottom - tdy, r.Width(), tdy));
}
示例14: GetClipBound
Rect Ctrl::GetClipBound(const Vector<Rect>& inv, const Rect& r)
{
Rect ri = Null;
for(int j = 0; j < inv.GetCount(); j++) {
Rect rr = inv[j] & r;
if(!rr.IsEmpty())
ri = IsNull(ri) ? rr : rr | ri;
}
return ri;
}
示例15: SetupRect
void TopWindow::SetupRect(Ctrl *owner)
{
Rect r = GetRect();
if(r.IsEmpty())
SetRect(GetDefaultWindowRect());
else
if(r.left == 0 && r.top == 0 && center == 1) {
Rect area = owner ? owner->GetWorkArea() : Ctrl::GetWorkArea();
SetRect(area.CenterRect(min(area.Size(), r.Size())));
}
}