コード例 #1
0
ファイル: riven_graphics.cpp プロジェクト: hchen1014/scummvm
void RivenGraphics::drawRect(Common::Rect rect, bool active) {
	// Useful with debugging. Shows where hotspots are on the screen and whether or not they're active.
	Graphics::Surface *screen = _vm->_system->lockScreen();

	if (active)
		screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0));
	else
		screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0));

	_vm->_system->unlockScreen();
}
コード例 #2
0
ファイル: elements.cpp プロジェクト: AlbanBedel/scummvm
void DropHighlight::draw(const Common::Rect &) {
	Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();

	// Since this is only used in two different ways, I'm only
	// going to implement it in those two ways. Deal with it.

	Common::Rect rect = _bounds;
	rect.grow(-_thickness);
	screen->frameRect(rect, _highlightColor);
	rect.grow(1);
	screen->frameRect(rect, _highlightColor);

	if (_cornerDiameter == 8 && _thickness == 4) {
		rect.grow(1);
		screen->frameRect(rect, _highlightColor);
		screen->hLine(rect.left + 1, rect.top - 1, rect.right - 2, _highlightColor);
		screen->hLine(rect.left + 1, rect.bottom, rect.right - 2, _highlightColor);
		screen->vLine(rect.left - 1, rect.top + 1, rect.bottom - 2, _highlightColor);
		screen->vLine(rect.right, rect.top + 1, rect.bottom - 2, _highlightColor);
	}
}
コード例 #3
0
ファイル: window.cpp プロジェクト: murgo/scummvm
void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllipse) {
	// Get a pointer to the bytes of the source buffer
	byte *lpBuf = bigBuf;

	if (rcBoundEllipse != NULL) {
		// Circular wipe effect
		getNewFrameWipe(lpBuf, *rcBoundEllipse);
		_wiping = true;
	} else if (_wiping) {
		// Just finished a wiping effect, so copy the full screen
		copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
		_wiping = false;

	} else {
		// Standard screen copy - iterate through the dirty rects
		Common::List<Common::Rect> dirtyRects = bigBuf.getDirtyRects();
		Common::List<Common::Rect>::iterator i;

		// If showing dirty rects, copy the entire screen background and set up a surface pointer
		Graphics::Surface *s = NULL;
		if (_showDirtyRects) {
			copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
			s = g_system->lockScreen();
		}

		for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
			Common::Rect &r = *i;
			const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2);
			copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height());
		}

		if (_showDirtyRects) {
			for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
				// Frame the copied area with a rectangle
				s->frameRect(*i, 0xffffff);
			}

			g_system->unlockScreen();
		}
	}

	if (_bGrabThumbnail) {
		// Need to generate a thumbnail
		RMSnapshot s;

		s.grabScreenshot(lpBuf, 4, _wThumbBuf);
		_bGrabThumbnail = false;
	}

	// Clear the dirty rect list
	bigBuf.clearDirtyRects();
}
コード例 #4
0
void CSTimeGraphics::drawRect(Common::Rect rect, byte color) {
	rect.clip(Common::Rect(640, 480));

	// Useful with debugging. Shows where hotspots are on the screen and whether or not they're active.
	if (!rect.isValidRect() || rect.width() == 0 || rect.height() == 0)
		return;

	Graphics::Surface *screen = _vm->_system->lockScreen();

	screen->frameRect(rect, color);

	_vm->_system->unlockScreen();
}
コード例 #5
0
static void drawProgress(float progress) {
	const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont));
	Graphics::Surface surf;
	uint32 borderColor = 0x2;
	uint32 fillColor = 0x4;
	surf.w = g_system->getWidth() / 7 * 5;
	surf.h = font.getFontHeight();
	int x = g_system->getWidth() / 7;
	int y = g_system->getHeight() / 2 - surf.h / 2;
	surf.pitch = surf.w;
	surf.bytesPerPixel = 1;
	surf.pixels = calloc(surf.w, surf.h);
	Common::Rect r(surf.w, surf.h);
	surf.frameRect(r, borderColor);
	r.grow(-1);
	r.right = r.left + (uint16)(r.width() * progress);
	surf.fillRect(r, fillColor);
	g_system->copyRectToScreen((byte *)surf.pixels, surf.pitch, x, y, surf.w, surf.h);
	g_system->updateScreen();
	free(surf.pixels);
}
コード例 #6
0
ファイル: mt32.cpp プロジェクト: agharbi/residual
static void drawProgress(float progress) {
	const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont));
	Graphics::Surface *screen = g_system->lockScreen();

	assert(screen);
	assert(screen->pixels);

	Graphics::PixelFormat screenFormat = g_system->getScreenFormat();

	int16 w = g_system->getWidth() / 7 * 5;
	int16 h = font.getFontHeight();
	int16 x = g_system->getWidth() / 7;
	int16 y = g_system->getHeight() / 2 - h / 2;

	Common::Rect r(x, y, x + w, y + h);

	uint32 col;

	if (screenFormat.bytesPerPixel > 1)
		col = screenFormat.RGBToColor(0, 171, 0);
	else
		col = 1;

	screen->frameRect(r, col);

	r.grow(-1);
	r.setWidth(uint16(progress * w));

	if (screenFormat.bytesPerPixel > 1)
		col = screenFormat.RGBToColor(171, 0, 0);
	else
		col = 2;

	screen->fillRect(r, col);

	g_system->unlockScreen();
	g_system->updateScreen();
}