void GiCanvasIos::clearCachedBitmap(bool clearAll) { giInterlockedIncrement(&m_draw->_cacheserr[0]); if (clearAll) { giInterlockedIncrement(&m_draw->_cacheserr[1]); } }
bool GiGraphics::beginPaint(GiCanvas* canvas, const RECT_2D& clipBox) { if (!canvas || m_impl->canvas || m_impl->drawRefcnt > 0) { return false; } m_impl->canvas = canvas; m_impl->ctxused = 0; m_impl->stopping = 0; giInterlockedIncrement(&m_impl->drawRefcnt); if (m_impl->lastZoomTimes != xf().getZoomTimes()) { m_impl->zoomChanged(); m_impl->lastZoomTimes = xf().getZoomTimes(); } m_impl->clipBox0 = clipBox; if (Box2d(clipBox).isEmpty()) { (xf().getWndRectW() * xf().worldToDisplay()).get(m_impl->clipBox0); } m_impl->clipBox = m_impl->clipBox0; m_impl->rectDraw = m_impl->clipBox0; m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = Box2d(m_impl->rectDraw) * xf().displayToModel(); m_impl->rectDrawMaxM = xf().getWndRectM(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); m_impl->rectDrawMaxW = m_impl->rectDrawMaxM * xf().modelToWorld(); return true; }
void MgShapeDoc::afterChanged() { giInterlockedIncrement(&im->changeCount); for (std::vector<Impl::Observer>::iterator it = im->observers.begin(); it != im->observers.end(); ++it) { (it->first)(this, it->second, false); } }
bool MgLockRW::lock(bool forWrite, int timeout) { bool ret = false; if (1 == giInterlockedIncrement(_counts)) { // first locked giInterlockedIncrement(_counts + (forWrite ? 2 : 1)); ret = true; } else { ret = !forWrite && 0 == _counts[2]; // for read and not locked for write for (int i = 0; i < timeout && !ret; i += 25) { giSleep(25); ret = forWrite ? (!_counts[1] && !_counts[2]) : !_counts[2]; } if (ret) { giInterlockedIncrement(_counts + (forWrite ? 2 : 1)); } else { giInterlockedDecrement(_counts); } } return ret; }
void GiGraphics::_beginPaint(const RECT2D& clipBox) { if (m_impl->lastZoomTimes != xf().getZoomTimes()) { m_impl->zoomChanged(); m_impl->lastZoomTimes = xf().getZoomTimes(); } giInterlockedIncrement(&m_impl->drawRefcnt); if (!Box2d(clipBox).isEmpty()) { m_impl->clipBox0 = clipBox; m_impl->clipBox = clipBox; m_impl->rectDraw = Box2d(clipBox); m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = m_impl->rectDraw * xf().displayToModel(); m_impl->rectDrawMaxM = Box2d(0, 0, xf().getWidth(), xf().getHeight()) * xf().displayToModel(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); m_impl->rectDrawMaxW = m_impl->rectDrawMaxM * xf().modelToWorld(); } }
void zoomChanged() { giInterlockedIncrement(&zoomTimes); }
void GiGraphics::stopDrawing() { giInterlockedIncrement(&m_impl->stopping); }
void MgShapeDoc::addRef() { giInterlockedIncrement(&im->refcount); }