convert ThumbnailRequest to Vec2

This commit is contained in:
mniip 2023-04-12 19:28:55 +02:00
parent aa2fa9ed8c
commit 8c387a5a00
6 changed files with 5 additions and 11 deletions

View File

@ -9,10 +9,6 @@ namespace http
size(size) size(size)
{} {}
ImageRequest::ImageRequest(ByteString url, int width, int height):
ImageRequest(url, Vec2(width, height))
{}
ImageRequest::~ImageRequest() ImageRequest::~ImageRequest()
{} {}

View File

@ -15,8 +15,6 @@ namespace http
public: public:
ImageRequest(ByteString url, Vec2<int> size); ImageRequest(ByteString url, Vec2<int> size);
[[deprecated("Use ImageRequest(ByteString, Vec<int>)")]]
ImageRequest(ByteString url, int width, int height);
virtual ~ImageRequest(); virtual ~ImageRequest();
std::unique_ptr<VideoBuffer> Finish(); std::unique_ptr<VideoBuffer> Finish();

View File

@ -3,12 +3,12 @@
namespace http namespace http
{ {
ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, int width, int height) : ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, Vec2<int> size) :
ImageRequest(( ImageRequest((
saveDate saveDate
? ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_", saveDate, "_small.png") ? ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_", saveDate, "_small.png")
: ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_small.png") : ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_small.png")
), width, height) ), size)
{ {
} }

View File

@ -6,7 +6,7 @@ namespace http
class ThumbnailRequest : public ImageRequest class ThumbnailRequest : public ImageRequest
{ {
public: public:
ThumbnailRequest(int saveID, int saveDate, int width, int height); ThumbnailRequest(int saveID, int saveDate, Vec2<int> size);
virtual ~ThumbnailRequest(); virtual ~ThumbnailRequest();
}; };
} }

View File

@ -22,7 +22,7 @@ void AvatarButton::Tick(float dt)
if (!avatar && !tried && name.size() > 0) if (!avatar && !tried && name.size() > 0)
{ {
tried = true; tried = true;
imageRequest = std::make_unique<http::ImageRequest>(ByteString::Build(SCHEME, STATICSERVER, "/avatars/", name, ".png"), Size.X, Size.Y); imageRequest = std::make_unique<http::ImageRequest>(ByteString::Build(SCHEME, STATICSERVER, "/avatars/", name, ".png"), Size);
imageRequest->Start(); imageRequest->Start();
} }

View File

@ -137,7 +137,7 @@ void SaveButton::Tick(float dt)
} }
else if (save->GetID()) else if (save->GetID())
{ {
thumbnailRequest = std::make_unique<http::ThumbnailRequest>(save->GetID(), save->GetVersion(), thumbBoxSize.X, thumbBoxSize.Y); thumbnailRequest = std::make_unique<http::ThumbnailRequest>(save->GetID(), save->GetVersion(), thumbBoxSize);
thumbnailRequest->Start(); thumbnailRequest->Start();
triedThumbnail = true; triedThumbnail = true;
} }