This commit is contained in:
Splendide Imaginarius 2025-03-16 00:39:02 -07:00 committed by GitHub
commit d1a1140c21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 5 deletions

View file

@ -67,9 +67,9 @@ void vaoUnbind(VAO &vao);
/* EXT_framebuffer_blit */
int blitScaleIsSpecial(TEXFBO &target, bool targetPreferHires, const IntRect &targetRect, TEXFBO &source, const IntRect &sourceRect);
int smoothScalingMethod(int scaleIsSpecial);
void blitBegin(TEXFBO &target, bool preferHires = false, int scaleIsOne = 0);
void blitBeginScreen(const Vec2i &size, int scaleIsOne = 0);
void blitSource(TEXFBO &source, int scaleIsOne = 0);
void blitBegin(TEXFBO &target, bool preferHires = false, int scaleIsSpecial = 0);
void blitBeginScreen(const Vec2i &size, int scaleIsSpecial = 0);
void blitSource(TEXFBO &source, int scaleIsSpecial = 0);
void blitRectangle(const IntRect &src, const Vec2i &dstPos);
void blitRectangle(const IntRect &src, const IntRect &dst,
bool smooth = false);

View file

@ -274,7 +274,37 @@ void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT])
{
assert(tf.width == ATLASVX_W && tf.height == ATLASVX_H);
GLMeta::blitBegin(tf, true);
int scaleIsSpecial = SameScale;
if (shState->config().enableHires)
{
double bitmapScaleX = 0.0;
double bitmapScaleY = 0.0;
double atlasScale = shState->config().atlasScalingFactor;
for (int i = 0; i < BM_COUNT; i++)
{
bitmapScaleX = 1.0;
bitmapScaleY = 1.0;
if (bitmaps[i]->hasHires())
{
bitmapScaleX = (double)(bitmaps[i]->getHires()->width()) / (double)(bitmaps[i]->width());
bitmapScaleY = (double)(bitmaps[i]->getHires()->height()) / (double)(bitmaps[i]->height());
}
if (atlasScale < bitmapScaleX || atlasScale < bitmapScaleY)
{
scaleIsSpecial = DownScale;
}
if (atlasScale > bitmapScaleX || atlasScale > bitmapScaleY)
{
scaleIsSpecial = UpScale;
break;
}
}
}
GLMeta::blitBegin(tf, true, scaleIsSpecial);
glState.clearColor.pushSet(Vec4());
FBO::clear();
@ -316,7 +346,7 @@ void build(TEXFBO &tf, Bitmap *bitmaps[BM_COUNT])
#define EXEC_BLITS(part) \
if (!nullOrDisposed(bm = bitmaps[BM_##part])) \
{ \
GLMeta::blitSource(bm->getGLTypes()); \
GLMeta::blitSource(bm->getGLTypes(), scaleIsSpecial); \
for (size_t i = 0; i < blits##part##N; ++i) \
{\
const IntRect &src = blits##part[i].src; \