Exemple #1
0
/* virtual */
void
Button::Draw()
{
	if (fResource == NULL)
		return;
	try {
		IE::button* button = (IE::button*)fControl;
		const Bitmap* frame;
		// TODO: Seems enabled and selected aren't used
		if (!fEnabled)
			frame = fResource->FrameForCycle(button->cycle, button->frame_disabled);
		else if (fPressed)
			frame = fResource->FrameForCycle(button->cycle, button->frame_pressed);
		/*else if (fSelected)
			frame = fResource->FrameForCycle(button->cycle, button->frame_selected);
		*/
		else
			frame = fResource->FrameForCycle(button->cycle, button->frame_unpressed);

		if (frame != NULL) {
			GFX::rect destRect(sint16(fControl->x), sint16(fControl->y),
					uint16(fControl->w), uint16(fControl->h));
			fWindow->ConvertToScreen(destRect);
			GraphicsEngine::Get()->BlitToScreen(frame, NULL, &destRect);
			//frame->Release();
		}
	} catch (...) {

	}
	Control::Draw();
}
    void CanvasGdiplus::RestoreLayer()
    {
        DCHECK(layers_.size());
        
        CanvasLayer* layer = layers_.top();
        layers_.pop();
        DCHECK(layer);

        Gdiplus::Graphics* current = GetCurrentGraphics();
        Gdiplus::Bitmap* native_bitmap =
            layer->mem_bitmap.GetNativeBitmap();
        Gdiplus::ImageAttributes ia;
        Gdiplus::ColorMatrix cm =
        {
            1.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 1.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 1.0, 0.0, 0.0,
            0.0, 0.0, 0.0, (static_cast<float>(layer->alpha))/255, 0.0,
            0.0, 0.0, 0.0, 0.0, 1.0
        };
        ia.SetColorMatrix(&cm);
        Gdiplus::Rect destRect(layer->bounds.x(), layer->bounds.y(),
            layer->bounds.width(), layer->bounds.height());
        current->DrawImage(native_bitmap, destRect,
            layer->bounds.x(), layer->bounds.y(),
            layer->bounds.width(), layer->bounds.height(),
            Gdiplus::UnitPixel, &ia);

        delete layer;
    }
Exemple #3
0
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
		bool flipped, int overrideColor) {
	Common::Rect drawRect(0, 0, src.w, src.h);
	Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);

	// Clip the display area to on-screen
	if (!clip(drawRect, destRect))
		// It's completely off-screen
		return;

	if (flipped)
		drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
			src.w - drawRect.left, src.h - drawRect.top);

	Common::Point destPt(destRect.left, destRect.top);
	addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
		destPt.y + drawRect.height()));

	// Draw loop
	const int TRANSPARENCY = 0xFF;
	for (int yp = 0; yp < drawRect.height(); ++yp) {
		const byte *srcP = (const byte *)src.getBasePtr(
			flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
		byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);

		for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
			if (*srcP != TRANSPARENCY)
				*destP = overrideColor ? overrideColor : *srcP;

			srcP = flipped ? srcP - 1 : srcP + 1;
		}
	}
}
Exemple #4
0
void Scalpel3DOScreen::SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
	if (!_vm->_isScreenDoubled) {
		ScalpelScreen::SHblitFrom(src, pt, srcBounds);
		return;
	}

	Common::Rect srcRect = srcBounds;
	Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());

	if (!srcRect.isValidRect() || !clip(srcRect, destRect))
		return;

	// Add dirty area remapped to the 640x200 surface
	addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2));

	// Transfer the area, doubling each pixel
	for (int yp = 0; yp < srcRect.height(); ++yp) {
		const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp);
		uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2);

		for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) {
			*destP = *srcP;
			*(destP + 1) = *srcP;
			*(destP + 640) = *srcP;
			*(destP + 640 + 1) = *srcP;
		}
	}
}
Exemple #5
0
/* virtual */
void
Label::Draw()
{
	GFX::rect destRect(fControl->x, fControl->y, fControl->w, fControl->h);
	fWindow->ConvertToScreen(destRect);
	GraphicsEngine::Get()->BlitToScreen(fBitmap, NULL, &destRect);
}
Exemple #6
0
	void Text::display() {
		auto tp = _position;

		auto font = _batcher->getFont();

		auto fontHeight = font->getFontHeight();
		auto start = font->getFontStart();
		auto length = font->getFontLength();

		auto glyphs = font->getFontGlyphs();
		if(!_used) {
			_index = _batcher->addString();
		}

		for(int i = 0; _text[i] != 0; i++) {
			char c = _text[i];
			if(_text[i] == '\n') {
				tp.y += fontHeight * _scaling.y;
				tp.x = _position.x;
			} else {
				// Check for correct glyph
				auto gi = c - start;
				if(gi < 0 || gi >= length)
					gi = length;
				glm::vec4 destRect(tp, glyphs[gi].size * _scaling);
				//Add the character to the font batcher
				_batcher->add(destRect, glyphs[gi].uvRect, _depth, _tint, _index);
				tp.x += glyphs[gi].size.x * _scaling.x;
			}
		}
	}
Exemple #7
0
void BrickParticle::draw(Bengine::SpriteBatch & spriteBatch)
{
	static int textureID = Bengine::ResourceManager::getTexture("Textures/brick.png").id;
	const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
	glm::vec4 destRect(m_position.x, m_position.y, m_width, m_height);
	spriteBatch.draw(destRect, uvRect, textureID, 0.0f, Bengine::ColorRGBA8(2, 29, 39, 255));
}
void FOculusRiftHMD::RenderTexture_RenderThread(class FRHICommandListImmediate& RHICmdList, class FRHITexture2D* BackBuffer, class FRHITexture2D* SrcTexture) const
{
	check(IsInRenderingThread());

	check(pCustomPresent);
	auto RenderContext = pCustomPresent->GetRenderContext();
	if (RenderContext && RenderContext->GetFrameSettings()->Flags.bMirrorToWindow)
	{
		if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Distorted)
		{
			FTexture2DRHIRef MirrorTexture = pCustomPresent->GetMirrorTexture();
			if (MirrorTexture)
			{
				CopyTexture_RenderThread(RHICmdList, BackBuffer, MirrorTexture);
			}
		}
		else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Undistorted)
		{
			auto FrameSettings = RenderContext->GetFrameSettings();
			FIntRect destRect(0, 0, BackBuffer->GetSizeX() / 2, BackBuffer->GetSizeY());
			for (int i = 0; i < 2; ++i)
			{
				CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, destRect, FrameSettings->EyeRenderViewport[i]);
				destRect.Min.X += BackBuffer->GetSizeX() / 2;
				destRect.Max.X += BackBuffer->GetSizeX() / 2;
			}
		}
		else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_SingleEye)
		{
			auto FrameSettings = RenderContext->GetFrameSettings();
			CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, FIntRect(), FrameSettings->EyeRenderViewport[0]);
		}
	}
}
Exemple #9
0
void CrossfadeGeneratedImage::drawCrossfade(
    SkCanvas* canvas,
    const SkPaint& paint,
    ImageClampingMode clampMode,
    const ColorBehavior& colorBehavior) {
  FloatRect fromImageRect(FloatPoint(), FloatSize(m_fromImage->size()));
  FloatRect toImageRect(FloatPoint(), FloatSize(m_toImage->size()));
  FloatRect destRect((FloatPoint()), FloatSize(m_crossfadeSize));

  // TODO(junov): The various effects encoded into paint should probably be
  // applied here instead of inside the layer.  This probably faulty behavior
  // was maintained in order to preserve pre-existing behavior while refactoring
  // this code.  This should be investigated further. crbug.com/472634
  SkPaint layerPaint;
  layerPaint.setBlendMode(paint.getBlendMode());
  SkAutoCanvasRestore ar(canvas, false);
  canvas->saveLayer(nullptr, &layerPaint);

  SkPaint imagePaint(paint);
  imagePaint.setBlendMode(SkBlendMode::kSrcOver);
  int imageAlpha = clampedAlphaForBlending(1 - m_percentage);
  imagePaint.setAlpha(imageAlpha > 255 ? 255 : imageAlpha);
  imagePaint.setAntiAlias(paint.isAntiAlias());
  // TODO(junov): This code should probably be propagating the
  // RespectImageOrientationEnum from CrossfadeGeneratedImage::draw(). Code was
  // written this way during refactoring to avoid modifying existing behavior,
  // but this warrants further investigation. crbug.com/472634
  m_fromImage->draw(canvas, imagePaint, destRect, fromImageRect,
                    DoNotRespectImageOrientation, clampMode, colorBehavior);
  imagePaint.setBlendMode(SkBlendMode::kPlus);
  imageAlpha = clampedAlphaForBlending(m_percentage);
  imagePaint.setAlpha(imageAlpha > 255 ? 255 : imageAlpha);
  m_toImage->draw(canvas, imagePaint, destRect, toImageRect,
                  DoNotRespectImageOrientation, clampMode, colorBehavior);
}
Exemple #10
0
bool
TOSMagnify::CreateImage(BPoint mouseLoc, bool force)
{
	bool created = false;
	if (Window() && Window()->Lock()) {
		int32 width, height;
		fParent->PixelCount(&width, &height);
		int32 pixelSize = fParent->PixelSize();

		BRect srcRect(0, 0, width - 1, height - 1);
		srcRect.OffsetBy(mouseLoc.x - (width / 2),
			mouseLoc.y - (height / 2));

		if (force || CopyScreenRect(srcRect)) {
			srcRect.OffsetTo(BPoint(0, 0));
			BRect destRect(Bounds());

			DrawBitmap(fBitmap, srcRect, destRect);

			DrawGrid(width, height, destRect, pixelSize);
			DrawSelection();

			Sync();
			created = true;
		}
		Window()->Unlock();
	} else
		printf("window problem\n");

	return created;
}
Exemple #11
0
void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) {
	Common::Rect srcRect(0, 0, src.w, src.h);
	Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);

	addDirtyRect(destRect);
	copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
Exemple #12
0
void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 alpha) const
{
	if (!surf)
		return;

	Rect sourceRect(margins.x, margins.y, surf->w, surf->h);
	//TODO: rotation and scaling
	if (src)
	{
		sourceRect = sourceRect & *src;
	}
	Rect destRect(posX, posY, surf->w, surf->h);
	destRect += sourceRect.topLeft();
	sourceRect -= margins;

	if(surf->format->BitsPerPixel == 8)
	{
		CSDL_Ext::blit8bppAlphaTo24bpp(surf, &sourceRect, where, &destRect);
	}
	else if(surf->format->Amask == 0)
	{
		SDL_BlitSurface(surf, &sourceRect, where, &destRect);
	}
	else
	{
		SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND);
		SDL_BlitSurface(surf, &sourceRect, where, &destRect);
		SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
	}
}
 void SpriteFont::draw(SpriteBatch& batch, const char* s, glm::vec2 position, glm::vec2 scaling, 
                       float depth, ColorRGBA8 tint, Justification just /* = Justification::LEFT */) {
     glm::vec2 tp = position;
     // Apply justification
     if (just == Justification::MIDDLE) {
         tp.x -= measure(s).x * scaling.x / 2;
     } else if (just == Justification::RIGHT) {
         tp.x -= measure(s).x * scaling.x;
     }
     for (int si = 0; s[si] != 0; si++) {
         char c = s[si];
         if (s[si] == '\n') {
             tp.y += _fontHeight * scaling.y;
             tp.x = position.x;
         } else {
             // Check for correct glyph
             int gi = c - _regStart;
             if (gi < 0 || gi >= _regLength)
                 gi = _regLength;
             glm::vec4 destRect(tp, _glyphs[gi].size * scaling);
             batch.draw(destRect, _glyphs[gi].uvRect, _texID, depth, tint);
             tp.x += _glyphs[gi].size.x * scaling.x;
         }
     }
 }
Exemple #14
0
/* virtual */
void
Slider::Draw()
{
	GFX::rect destRect(0, 0, fControl->w, fControl->h);
	destRect.x = fWindow->Position().x + fControl->x;
	destRect.y = fWindow->Position().y + fControl->y;
	GraphicsEngine::Get()->BlitToScreen(fBackground, NULL, &destRect);
}
void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
{
    RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
    FloatRect destRect(dstPoint, srcRect.size());
    FloatRect srcRectScaled(srcRect);
    srcRectScaled.scale(scaleFactor);
    context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, context);
}
Exemple #16
0
void Agent::draw(GameEngine::SpriteBatch& spriteBatch){

	glm::vec4 destRect(m_position.x, m_position.y, AGENT_WIDTH, AGENT_WIDTH);

	const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);

	spriteBatch.draw(destRect, uvRect, m_textureID, 0.0f, m_color, m_direction);
}
Exemple #17
0
void TiledLayerChromium::updateCompositorResources(GraphicsContext3D*, CCTextureUpdater& updater)
{
    // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
    if (m_skipsDraw || m_requestedUpdateTilesRect.isEmpty() || m_tiler->isEmpty())
        return;

    int left = m_requestedUpdateTilesRect.x();
    int top = m_requestedUpdateTilesRect.y();
    int right = m_requestedUpdateTilesRect.maxX() - 1;
    int bottom = m_requestedUpdateTilesRect.maxY() - 1;
    for (int j = top; j <= bottom; ++j) {
        for (int i = left; i <= right; ++i) {
            UpdatableTile* tile = tileAt(i, j);

            // Required tiles are created in prepareToUpdate(). A tile should
            // never be removed between the call to prepareToUpdate() and the
            // call to updateCompositorResources().
            if (!tile)
                CRASH();

            IntRect sourceRect = tile->m_updateRect;
            if (tile->m_updateRect.isEmpty())
                continue;

            ASSERT(tile->managedTexture()->isReserved());
            const IntPoint anchor = m_tiler->tileRect(tile).location();

            // Calculate tile-space rectangle to upload into.
            IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
            if (destRect.x() < 0)
                CRASH();
            if (destRect.y() < 0)
                CRASH();

            // Offset from paint rectangle to this tile's dirty rectangle.
            IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
            if (paintOffset.x() < 0)
                CRASH();
            if (paintOffset.y() < 0)
                CRASH();
            if (paintOffset.x() + destRect.width() > m_paintRect.width())
                CRASH();
            if (paintOffset.y() + destRect.height() > m_paintRect.height())
                CRASH();

            if (tile->m_partialUpdate)
                updater.appendPartial(tile->texture(), sourceRect, destRect);
            else
                updater.append(tile->texture(), sourceRect, destRect);
        }
    }

    // The updateRect should be in layer space. So we have to convert the paintRect from content space to layer space.
    m_updateRect = FloatRect(m_paintRect);
    float widthScale = bounds().width() / static_cast<float>(contentBounds().width());
    float heightScale = bounds().height() / static_cast<float>(contentBounds().height());
    m_updateRect.scale(widthScale, heightScale);
}
Exemple #18
0
void BaseSurface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
		bool flipped, int overrideColor, int scaleVal) {
	Common::Rect srcRect(0, 0, src.w, src.h);
	Common::Rect destRect(pt.x, pt.y, pt.x + src.w * SCALE_THRESHOLD / scaleVal,
		pt.y + src.h * SCALE_THRESHOLD / scaleVal);

	Graphics::Screen::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
		flipped, overrideColor);
}
Exemple #19
0
void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context)
{
    // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
    if (m_skipsDraw || m_updateRect.isEmpty() || !m_tiler->numTiles())
        return;

    int left, top, right, bottom;
    m_tiler->contentRectToTileIndices(m_updateRect, left, top, right, bottom);
    for (int j = top; j <= bottom; ++j) {
        for (int i = left; i <= right; ++i) {
            UpdatableTile* tile = tileAt(i, j);
            if (!tile)
                tile = createTile(i, j);
            else if (!tile->dirty())
                continue;

            // Calculate page-space rectangle to copy from.
            IntRect sourceRect = m_tiler->tileContentRect(tile);
            const IntPoint anchor = sourceRect.location();
            sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect));
            // Paint rect not guaranteed to line up on tile boundaries, so
            // make sure that sourceRect doesn't extend outside of it.
            sourceRect.intersect(m_paintRect);
            if (sourceRect.isEmpty())
                continue;

            ASSERT(tile->texture()->isReserved());

            // Calculate tile-space rectangle to upload into.
            IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
            if (destRect.x() < 0)
                CRASH();
            if (destRect.y() < 0)
                CRASH();

            // Offset from paint rectangle to this tile's dirty rectangle.
            IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
            if (paintOffset.x() < 0)
                CRASH();
            if (paintOffset.y() < 0)
                CRASH();
            if (paintOffset.x() + destRect.width() > m_paintRect.width())
                CRASH();
            if (paintOffset.y() + destRect.height() > m_paintRect.height())
                CRASH();

            tile->texture()->bindTexture(context);
            const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST;
            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter));
            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter));
            GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));

            textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect);
            tile->clearDirty();
        }
    }
}
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
    RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(data()),
                                                                                   CAIRO_FORMAT_ARGB32,
                                                                                   m_size.width(), m_size.height(),
                                                                                   m_size.width() * 4));
    FloatRect destRect(dstPoint, srcRect.size());
    context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRect, &context);
}
Exemple #21
0
void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
		bool flipped, int overrideColor) {
	Common::Rect drawRect(0, 0, src.w, src.h);
	Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);

	// Clip the display area to on-screen
	if (!clip(drawRect, destRect))
		// It's completely off-screen
		return;

	if (flipped)
		drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
			src.w - drawRect.left, src.h - drawRect.top);

	Common::Point destPt(destRect.left, destRect.top);
	addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
		destPt.y + drawRect.height()));

	switch (src.format.bytesPerPixel) {
	case 1:
		// 8-bit palettized: Draw loop
		assert(_surface.format.bytesPerPixel == 1); // Security check
		for (int yp = 0; yp < drawRect.height(); ++yp) {
			const byte *srcP = (const byte *)src.getBasePtr(
				flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
			byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);

			for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
				if (*srcP != TRANSPARENCY)
					*destP = overrideColor ? overrideColor : *srcP;

				srcP = flipped ? srcP - 1 : srcP + 1;
			}
		}
		break;
	case 2:
		// 3DO 15-bit RGB565: Draw loop
		assert(_surface.format.bytesPerPixel == 2); // Security check
		for (int yp = 0; yp < drawRect.height(); ++yp) {
			const uint16 *srcP = (const uint16 *)src.getBasePtr(
				flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
			uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp);

			for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
				if (*srcP) // RGB 0, 0, 0 -> transparent on 3DO
					*destP = *srcP; // overrideColor ? overrideColor : *srcP;

				srcP = flipped ? srcP - 1 : srcP + 1;
			}
		}
		break;
	default:
		error("Surface: unsupported bytesperpixel");
		break;
	}
}
Exemple #22
0
void
SlideShowSaver::Draw(BView *view, int32 frame)
{
	fLock.Lock();

	view->SetLowColor(0, 0, 0);
	view->SetHighColor(192, 192, 192);
	view->SetViewColor(192, 192, 192);

	bool bResult = false;
	if (fNewDirectory == true) {
		// Already have a bitmap on the first frame
		bResult = true;
	} else {
		bResult = ShowNextImage(true, false);
		// try rewinding to beginning
		if (bResult == false)
			bResult = ShowNextImage(true, true);
	}
	fNewDirectory = false;

	if (bResult == true && fBitmap != NULL) {
		BRect destRect(0, 0, fBitmap->Bounds().Width(), fBitmap->Bounds().Height()),
			vwBounds = view->Bounds();

		if (destRect.Width() < vwBounds.Width()) {
			destRect.OffsetBy((vwBounds.Width() - destRect.Width()) / 2, 0);
		}
		if (destRect.Height() < vwBounds.Height()) {
			destRect.OffsetBy(0, (vwBounds.Height() - destRect.Height()) / 2);
		}

		BRect border = destRect, bounds = view->Bounds();
		// top
		view->FillRect(BRect(0, 0, bounds.right, border.top-1), B_SOLID_LOW);
		// left
		view->FillRect(BRect(0, border.top, border.left-1, border.bottom), B_SOLID_LOW);
		// right
		view->FillRect(BRect(border.right+1, border.top, bounds.right, border.bottom), B_SOLID_LOW);
		// bottom
		view->FillRect(BRect(0, border.bottom+1, bounds.right, bounds.bottom), B_SOLID_LOW);

		if (fShowBorder == true) {
			BRect strokeRect = destRect;
			strokeRect.InsetBy(-1, -1);
			view->StrokeRect(strokeRect);
		}

		view->DrawBitmap(fBitmap, fBitmap->Bounds(), destRect);

		if (fShowCaption == true)
			DrawCaption(view);
	}

	fLock.Unlock();
}
void MusicWidget::paintEvent(QPaintEvent *e)
{
    QPainter p(this);
    QRect srcRect = m_bkgndLogo.rect();
    QRect destRect(srcRect);
    int xpos = width() - m_bkgndLogo.width() - 30;
    int ypos = m_currentSongLabel->y() - m_bkgndLogo.height() - 10;
    destRect.moveTopLeft(QPoint(xpos, ypos));
    p.drawPixmap(destRect, m_bkgndLogo);
}
Exemple #24
0
void Bullet::Draw(Engine2D::SpriteBatch & spriteBatch) {
	glm::vec4 destRect(_position.x + BULLET_RADIUS, _position.y + BULLET_RADIUS, BULLET_RADIUS * 2, BULLET_RADIUS * 2);
	glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
	Engine2D::ColorRGBA8 c;
	c.r = 64;
	c.b = 64;
	c.g = 64;
	c.a = 255;
	spriteBatch.Draw(destRect, uvRect, Engine2D::ResourceManager::getTexture("Images/Player16x16.png").id, 0.0f, c);
}
Exemple #25
0
	void ParticleBatch2D::draw(SpriteBatch* spriteBatch) {
		glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
		for (int i = 0; i < m_maxParticles; i++) {
			auto& p = m_particles[i];
			if (m_particles[i].lifeTime > 0.0f) {
				glm::vec4 destRect(p.position.x, p.position.y, p.width, p.width);
				spriteBatch->draw(destRect, uvRect, m_texture.id, 0.0f, p.color);
			}
		}
	}
Exemple #26
0
void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
	Common::Rect srcRect = srcBounds;
	Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());

	if (srcRect.isValidRect() && clip(srcRect, destRect)) {
		// Surface is at least partially or completely on-screen
		addDirtyRect(destRect);
		_surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect);
	}
}
Exemple #27
0
	void ParticalBatch2D::draw(SpriteBatch* spriteBatch) {
		glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
		for (int i{ 0 }; i < m_maxParticals; ++i) {
			auto& partical = m_particals[i];
			if (partical.life > 0.0f) {
				glm::vec4 destRect(partical.position.x, partical.position.y, partical.width, partical.width);
				spriteBatch->draw(destRect, uvRect, m_texture.id, partical.color, 0.0f);
			}
		}
	}
Exemple #28
0
/* virtual */
void
Scrollbar::Draw()
{
	GFX::rect destRect(fControl->x, fControl->y, fControl->w, fControl->h);
	fWindow->ConvertToScreen(destRect);

	_DrawTrough(destRect);
	//_DrawSlider(destRect);
	_DrawUpArrow(destRect);
	_DrawDownArrow(destRect);
}
Exemple #29
0
void
Scrollbar::_DrawTrough(const GFX::rect& screenRect)
{
	IE::scrollbar* scrollbar = (IE::scrollbar*)fControl;

	Bitmap* frame = const_cast<Bitmap*>(fResource->FrameForCycle(scrollbar->cycle,
					scrollbar->trough));
	GFX::rect destRect(screenRect.x, screenRect.y + 40,
			frame->Width(), frame->Height());
	GraphicsEngine::Get()->BlitToScreen(frame, NULL, &destRect);
}
 void ParticleBatch2D::draw(SpriteBatch* spriteBatch) {
     glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
     for (int i = 0; i < m_maxParticles; i++) {
         // Check if it is active
         auto& p = m_particles[i];
         if (p.m_life > 0.0f) {
             glm::vec4 destRect(p.m_position.x, p.m_position.y, p.m_width, p.m_width);
             spriteBatch->draw(destRect, uvRect, m_texture.id, 0.0f, p.m_color);
         }
     }
 }