mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Remove access to internal surface of Canvas
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include "Canvas.h"
|
||||
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../media/IVideoPlayer.h"
|
||||
#include "../render/IRenderHandler.h"
|
||||
#include "../render/IScreenHandler.h"
|
||||
#include "../renderSDL/SDL_Extensions.h"
|
||||
@ -102,6 +103,16 @@ Canvas::~Canvas()
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
||||
void Canvas::draw(IVideoInstance & video, const Point & pos)
|
||||
{
|
||||
video.show(pos, surface);
|
||||
}
|
||||
|
||||
void Canvas::draw(const IImage& image, const Point & pos)
|
||||
{
|
||||
image.draw(surface, transformPos(pos), nullptr, getScalingFactor());
|
||||
}
|
||||
|
||||
void Canvas::draw(const std::shared_ptr<IImage>& image, const Point & pos)
|
||||
{
|
||||
assert(image);
|
||||
@ -222,12 +233,18 @@ void Canvas::fillTexture(const std::shared_ptr<IImage>& image)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Surface * Canvas::getInternalSurface() const
|
||||
{
|
||||
return surface;
|
||||
}
|
||||
|
||||
Rect Canvas::getRenderArea() const
|
||||
{
|
||||
return renderArea;
|
||||
}
|
||||
|
||||
CanvasClipRectGuard::CanvasClipRectGuard(Canvas & canvas, const Rect & rect): surf(canvas.surface)
|
||||
{
|
||||
CSDL_Ext::getClipRect(surf, oldRect);
|
||||
CSDL_Ext::setClipRect(surf, rect * GH.screenHandler().getScalingFactor());
|
||||
}
|
||||
|
||||
CanvasClipRectGuard::~CanvasClipRectGuard()
|
||||
{
|
||||
CSDL_Ext::setClipRect(surf, oldRect);
|
||||
}
|
||||
|
Reference in New Issue
Block a user