int BbvsEngine::rectSubtract(const Common::Rect &rect1, const Common::Rect &rect2, Common::Rect *outRects) { int count = 0; Common::Rect workRect = rect1.findIntersectingRect(rect2); if (!workRect.isEmpty()) { count = 0; outRects[count] = Common::Rect(rect2.width(), workRect.top - rect2.top); if (!outRects[count].isEmpty()) { outRects[count].translate(rect2.left, rect2.top); ++count; } outRects[count] = Common::Rect(workRect.left - rect2.left, workRect.height()); if (!outRects[count].isEmpty()) { outRects[count].translate(rect2.left, workRect.top); ++count; } outRects[count] = Common::Rect(rect2.right - workRect.right, workRect.height()); if (!outRects[count].isEmpty()) { outRects[count].translate(workRect.right, workRect.top); ++count; } outRects[count] = Common::Rect(rect2.width(), rect2.bottom - workRect.bottom); if (!outRects[count].isEmpty()) { outRects[count].translate(rect2.left, workRect.bottom); ++count; } } else { outRects[0] = rect2; count = 1; } return count; }
void EnergyMonitor::draw(const Common::Rect &r) { Common::Rect r2 = r.findIntersectingRect(_levelRect); if (!r2.isEmpty()) { Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea(); screen->fillRect(r2, _barColor); } }
void SoundLevel::draw(const Common::Rect &r) { Common::Rect levelRect(_bounds.right + (8 * (_soundLevel - 12)), _bounds.top, _bounds.right, _bounds.bottom); levelRect = r.findIntersectingRect(levelRect); if (!levelRect.isEmpty()) { Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea(); screen->fillRect(levelRect, g_system->getScreenFormat().RGBToColor(0, 0, 0)); } }
void Movie::draw(const Common::Rect &r) { Common::Rect worldBounds = _movieBox; Common::Rect elementBounds; getBounds(elementBounds); worldBounds.moveTo(elementBounds.left, elementBounds.top); Common::Rect r1 = r.findIntersectingRect(worldBounds); Common::Rect r2 = r1; r2.translate(_movieBox.left - elementBounds.left, _movieBox.top - elementBounds.top); drawImage(r2, r1); }
void Director::drawRect(const Common::Rect &rect) { _surface.fillRect(rect, 0); for (uint i = 0; i < _sprites.size(); ++i) { const Common::Rect &spriteRect = _sprites[i]->getBounds(); Common::Rect interRect = rect.findIntersectingRect(spriteRect); if (interRect.isEmpty()) continue; Common::Rect srcRect(interRect); srcRect.translate(-spriteRect.left, -spriteRect.top); _surface.transBlitFrom(*_sprites[i]->getDecoder()->getCurrentFrame(), srcRect, interRect, _sprites[i]->getDecoder()->getTransparentColourIndex()); } }
void Sprite::draw(const Common::Rect &r) { if (_currentFrame) { Common::Rect frameBounds; _currentFrame->frame->getSurfaceBounds(frameBounds); frameBounds.translate(_bounds.left + _currentFrame->frameLeft, _bounds.top + _currentFrame->frameTop); Common::Rect r1 = frameBounds.findIntersectingRect(r); Common::Rect r2 = frameBounds; r2.translate(-_bounds.left - _currentFrame->frameLeft, -_bounds.top - _currentFrame->frameTop); _currentFrame->frame->drawImage(r2, r1); } }
void Slide::drawSlideElement(const Common::Rect &drawRect, const Common::Rect &oldBounds, DisplayElement *picture) { if (picture && drawRect.intersects(oldBounds)) { picture->moveElementTo(oldBounds.left, oldBounds.top); picture->draw(drawRect.findIntersectingRect(oldBounds)); } }