示例#1
0
void OSScreenManager::blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSurface *src, int v) {
	// Get the dest surface
	CVideoSurface *destSurface = _frontRenderSurface;
	if (surfaceNum < -1)
		return;
	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size())
		destSurface = _backSurfaces[surfaceNum]._surface;
	if (!destSurface->hasSurface())
		return;

	if (!rect->isEmpty())
		destSurface->blitFrom(Point(rect->left, rect->top), src, rect);
}
示例#2
0
int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, 
		int yOffset, const CString &str, CTextCursor *textCursor) {
	CVideoSurface *surface;
	Rect bounds;

	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) {
		surface = _backSurfaces[surfaceNum]._surface;
		bounds = _backSurfaces[surfaceNum]._bounds;
	} else if (surfaceNum == -1) {
		surface = _frontRenderSurface;
		bounds = Rect(0, 0, surface->getWidth(), surface->getHeight());
	} else {
		return -1;
	}

	return _fonts[_fontNumber].writeString(surface, destRect, bounds,
		yOffset, str, textCursor);
}
示例#3
0
void OSScreenManager::writeString(int surfaceNum, const Point &destPos,
		const Rect &clipRect, const CString &str, int lineWidth) {
	CVideoSurface *surface;
	Rect bounds;

	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) {
		surface = _backSurfaces[surfaceNum]._surface;
		bounds = _backSurfaces[surfaceNum]._bounds;
	} else if (surfaceNum == -1) {
		surface = _frontRenderSurface;
		bounds = Rect(0, 0, surface->getWidth(), surface->getHeight());
	} else {
		return;
	}

	Rect destRect = clipRect;
	destRect.constrain(bounds);

	_fonts[_fontNumber].writeString(surface, destPos, destRect, str, lineWidth);
}
示例#4
0
void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src,
		const Point *destPos, const Rect *srcRect) {
	// Get the dest surface
	CVideoSurface *destSurface = _frontRenderSurface;
	if (surfaceNum < -1)
		return;
	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size())
		destSurface = _backSurfaces[surfaceNum]._surface;
	if (!destSurface->hasSurface())
		return;

	Point destPoint = destPos ? *destPos : Point(0, 0);
	Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight());
	Rect *bounds = &srcBounds;
	Rect rect2;

	Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds :
		_backSurfaces[surfaceNum]._bounds;

	if (!surfaceBounds.isEmpty()) {
		// Perform clipping to the bounds of the back surface
		rect2 = srcBounds;
		rect2.translate(-srcBounds.left, -srcBounds.top);
		rect2.translate(destPoint.x, destPoint.y);
		rect2.constrain(surfaceBounds);

		rect2.translate(-destPoint.x, -destPoint.y);
		rect2.translate(srcBounds.left, srcBounds.top);

		if (rect2.isEmpty())
			return;

		destPoint.x += rect2.left - srcBounds.left;
		destPoint.y += rect2.top - srcBounds.top;
		bounds = &rect2;
	}

	if (!bounds->isEmpty())
		destSurface->blitFrom(destPoint, src, bounds);
}
示例#5
0
void CMouseCursor::loadCursorImages() {
	const CResourceKey key("ycursors.avi");

	// Iterate through getting each cursor
	for (int idx = 0; idx < NUM_CURSORS; ++idx) {
		assert(CURSOR_DATA[idx][0] == (idx + 1));
		_cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2],
			CURSOR_DATA[idx][3]);

		// Create the surface
		CVideoSurface *surface = _screenManager->createSurface(CURSOR_SIZE, CURSOR_SIZE);
		_cursors[idx]._videoSurface = surface;

		// Open the cursors video and move to the given frame
		OSMovie movie(key, surface);
		movie.setFrame(idx);
		
		Graphics::ManagedSurface *transSurface = movie.duplicateTransparency();
		_cursors[idx]._transSurface = transSurface;
		surface->setTransparencySurface(transSurface);
	}
}
示例#6
0
void CMouseCursor::loadCursorImages() {
	const CResourceKey key("ycursors.avi");
	g_vm->_filesManager->fn4(key.getString());

	// Iterate through getting each cursor
	for (int idx = 0; idx < NUM_CURSORS; ++idx) {
		assert(CURSOR_DATA[idx][0] == (idx + 1));
		_cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2],
			CURSOR_DATA[idx][3]);

		// Create the surface
		CVideoSurface *surface = _screenManager->createSurface(64, 64);
		_cursors[idx]._videoSurface = surface;

		// Open the cursors video and move to the given frame
		OSMovie movie(key, surface);
		movie.setFrame(idx);
		
		Graphics::ManagedSurface *frameSurface = movie.duplicateFrame();
		_cursors[idx]._frameSurface = frameSurface;
		surface->setMovieFrameSurface(frameSurface);
	}
}
示例#7
0
CVideoSurface *OSScreenManager::lockSurface(SurfaceNum surfaceNum) {
	CVideoSurface *surface = getSurface(surfaceNum);
	surface->lock();
	return surface;
}