Revert adding Bitmap#v_flip/h_flip

This commit is contained in:
Snowdream 2022-07-20 02:55:04 -04:00
parent 689911510a
commit 4e6e291624
3 changed files with 0 additions and 76 deletions

View file

@ -225,26 +225,6 @@ RB_METHOD(bitmapSetPixel) {
return self;
}
RB_METHOD(bitmapHFlip) {
RB_UNUSED_PARAM;
Bitmap *b = getPrivateData<Bitmap>(self);
b->hFlip();
return Qnil;
}
RB_METHOD(bitmapVFlip) {
RB_UNUSED_PARAM;
Bitmap *b = getPrivateData<Bitmap>(self);
b->vFlip();
return Qnil;
}
RB_METHOD(bitmapHueChange) {
Bitmap *b = getPrivateData<Bitmap>(self);
@ -760,8 +740,6 @@ void bitmapBindingInit() {
_rb_define_method(klass, "clear", bitmapClear);
_rb_define_method(klass, "get_pixel", bitmapGetPixel);
_rb_define_method(klass, "set_pixel", bitmapSetPixel);
_rb_define_method(klass, "h_flip", bitmapHFlip);
_rb_define_method(klass, "v_flip", bitmapVFlip);
_rb_define_method(klass, "hue_change", bitmapHueChange);
_rb_define_method(klass, "draw_text", bitmapDrawText);
_rb_define_method(klass, "text_size", bitmapTextSize);

View file

@ -398,41 +398,6 @@ struct BitmapPrivate
self->modified();
}
void flip(const IntRect &srcRect)
{
TEXFBO &current = getGLTypes();
TEXFBO newTex = shState->texPool().request(current.width, current.height);
SimpleShader &shader = shState->shaders().simple;
shader.bind();
shader.setTexOffsetX(0);
bindTexture(shader);
Quad &quad = shState->gpQuad();
quad.setTexPosRect(srcRect, IntRect(0, 0, current.width, current.height));
quad.setColor(Vec4(1, 1, 1, 1));
glState.blend.pushSet(false);
pushSetViewport(shader);
FBO::bind(newTex.fbo);
blitQuad(quad);
popViewport();
glState.blend.pop();
if (!animation.enabled) {
shState->texPool().release(gl);
gl = newTex;
}
else {
shState->texPool().release(animation.frames[animation.currentFrameI()]);
animation.frames[animation.currentFrameI()] = newTex;
}
onModified();
}
};
struct BitmapOpenHandler : FileSystem::OpenHandler
@ -1313,22 +1278,6 @@ void Bitmap::setPixel(int x, int y, const Color &color)
p->onModified(false);
}
void Bitmap::vFlip() {
guardDisposed();
GUARD_MEGA;
TEXFBO &current = getGLTypes();
p->flip(IntRect(0, current.height, current.width, -current.height));
}
void Bitmap::hFlip() {
guardDisposed();
GUARD_MEGA;
TEXFBO &current = getGLTypes();
p->flip(IntRect(current.width, 0, -current.width, current.height));
}
bool Bitmap::getRaw(void *output, int output_size)
{
if (output_size != width()*height()*4) return false;

View file

@ -87,9 +87,6 @@ public:
Color getPixel(int x, int y) const;
void setPixel(int x, int y, const Color &color);
void vFlip();
void hFlip();
bool getRaw(void *output, int output_size);
void replaceRaw(void *pixel_data, int size);
void saveToFile(const char *filename);