Diagonal flipping with RenderCopyEx

Hi.
As it turns out, it was impossible to render a texture flipped diagonally
(both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_render_d3d.c
Type: text/x-csrc
Size: 65561 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20131112/db275c20/attachment-0002.c
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_render_gl.c
Type: text/x-csrc
Size: 48679 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20131112/db275c20/attachment-0003.c

Thanks for the fix!
https://hg.libsdl.org/SDL/rev/e8f93c2ebda3On Tue, Nov 12, 2013 at 1:54 PM, Ivan Rubinson wrote:

Hi.
As it turns out, it was impossible to render a texture flipped diagonally
(both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

FWIW, I tested flipping here with the 3 GL backend and it appears to work
fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson > Hi.

As it turns out, it was impossible to render a texture flipped diagonally
(both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

That’s interesting. My testing results differ.
How did you flip HOR+VER?On Thu, Nov 14, 2013 at 2:47 PM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to work
fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson <@Ivan_Rubinson>

Hi.
As it turns out, it was impossible to render a texture flipped diagonally
(both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

PS: I did my testing on OpenGL and Direct3D.On Thu, Nov 14, 2013 at 5:07 PM, Ivan Rubinson <@Ivan_Rubinson> wrote:

That’s interesting. My testing results differ.
How did you flip HOR+VER?

On Thu, Nov 14, 2013 at 2:47 PM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to work
fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson <@Ivan_Rubinson>

Hi.
As it turns out, it was impossible to render a texture flipped
diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla for
further investigation?
http://bugzilla.libsdl.org

Thanks!On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to work
fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson

Hi.
As it turns out, it was impossible to render a texture flipped diagonally
(both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That’s weird.
I wrote a test program and it works fine without my patch.

However, in my main project it doesn’t work fine without the patch. I’ll
investigate this further.On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga wrote:

You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla for
further investigation?
http://bugzilla.libsdl.org

Thanks!

On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to work
fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson <@Ivan_Rubinson>

Hi.
As it turns out, it was impossible to render a texture flipped
diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, your proposed addition makes sense from a functionality point of
view, but I am not sure if adding bits to the existing RenderCopy flags
is the best API for this. The reason being that the flipping is handled
by texture coordinate assignment magic (quick), whereas a diagonal flip

  • and there are two different ones since there are two diagonals in a
    rectangle - is a combination of a horizontal flip and a rotation plus
    one needs to consider the implications of rectangular dimensions. So
    RenderCopy is probably not the right “hook” for this operation.On 11/15/2013 8:28 AM, Ivan Rubinson wrote:

I figured out the problem with my main project.

The problem was not flipping diagonally, but flipping diagonally IN
ADDITION to other flips.
So I’d like to propose a new feature to SDL.

At the moment, we have SDL_FLIP_NONE, SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL, and (virtually) SDL_FLIP_VERTICAL |
SDL_FLIP_HORIZONTAL. That’s 4 combinations.
However, there’s a total of 8 possible combinations.

One cannot achieve all 8 possible combinations using the current API
with one SDL_RenderCopyEx call.
The (very rough and not optimal) work-around is to do a copy with a
diagonal flip to a temporary texture, and then do a copy with another
flip to the actual renderer. This is obviously too rough for comfort.

I’d like to propose a new flip flag: “SDL_FLIP_DIAGONAL”, which can
then be used with SDL_FLIP_HORIZONTAL or SDL_FLIP_VERTICAL (or both
for some reason). SDL_RenderCopyEx will first do a diagonal flip (if
present) and then other flips (if present).

I’ve attached a bitmap file to describe what I mean

On Fri, Nov 15, 2013 at 5:34 PM, Ivan Rubinson <soryy708 at gmail.com <mailto:soryy708 at gmail.com>> wrote:

Hmm...
No I'm not (knowingly) using a viewport.
I am using a SDL_RenderSetLogicalSize though.


On Fri, Nov 15, 2013 at 5:21 PM, Andreas Schiffler <@Andreas_Schiffler <mailto:@Andreas_Schiffler>> wrote:

    Are you using a Viewport?

    If so, this could be related to this bug:
    https://bugzilla.libsdl.org/show_bug.cgi?id=2207


    On 11/15/2013 4:27 AM, Ivan Rubinson wrote:
    That's weird.
    I wrote a test program and it works fine without my patch.

    However, in my main project it doesn't work fine without the
    patch. I'll investigate this further.


    On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga <slouken at libsdl.org <mailto:slouken at libsdl.org>> wrote:

        You're right.  Okay, I backed out the patch.

        Ivan, can you submit a bug with a test program and data
        to bugzilla for further investigation?
        http://bugzilla.libsdl.org

        Thanks!


        On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo <gabomdq at gmail.com <mailto:gabomdq at gmail.com>> wrote:

            FWIW, I tested flipping here with the 3 GL backend
            and it appears to work fine when flipping HOR, VER
            and HOR+VER without your patch.


            2013/11/12 Ivan Rubinson <soryy708 at gmail.com
            <mailto:soryy708 at gmail.com>>

                Hi.
                As it turns out, it was impossible to render a
                texture flipped diagonally (both vertically and
                horizontally) with one RenderCopyEx call.
                With help from #SDL @ freenode, we came up with a
                fix.
                It is in the attached files (sorry, I don't like
                mercurial).

                _______________________________________________
                SDL mailing list
                SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
                http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




            -- 
            Gabriel.

            _______________________________________________
            SDL mailing list
            SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
            http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



        _______________________________________________
        SDL mailing list
        SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
        http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




    _______________________________________________
    SDL mailing list
    SDL at lists.libsdl.org  <mailto:SDL at lists.libsdl.org>
    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Also, RenderCopyEx already supports rotation, is it not possible to achieve
what you want by combining rotation and flipping?

2013/11/16 Andreas Schiffler > Yes, your proposed addition makes sense from a functionality point of

view, but I am not sure if adding bits to the existing RenderCopy flags is
the best API for this. The reason being that the flipping is handled by
texture coordinate assignment magic (quick), whereas a diagonal flip - and
there are two different ones since there are two diagonals in a rectangle -
is a combination of a horizontal flip and a rotation plus one needs to
consider the implications of rectangular dimensions. So RenderCopy is
probably not the right “hook” for this operation.

On 11/15/2013 8:28 AM, Ivan Rubinson wrote:

I figured out the problem with my main project.

The problem was not flipping diagonally, but flipping diagonally IN
ADDITION to other flips.
So I’d like to propose a new feature to SDL.

At the moment, we have SDL_FLIP_NONE, SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL, and (virtually) SDL_FLIP_VERTICAL |
SDL_FLIP_HORIZONTAL. That’s 4 combinations.
However, there’s a total of 8 possible combinations.

One cannot achieve all 8 possible combinations using the current API with
one SDL_RenderCopyEx call.
The (very rough and not optimal) work-around is to do a copy with a
diagonal flip to a temporary texture, and then do a copy with another flip
to the actual renderer. This is obviously too rough for comfort.

I’d like to propose a new flip flag: “SDL_FLIP_DIAGONAL”, which can then
be used with SDL_FLIP_HORIZONTAL or SDL_FLIP_VERTICAL (or both for some
reason). SDL_RenderCopyEx will first do a diagonal flip (if present) and
then other flips (if present).

I’ve attached a bitmap file to describe what I mean

On Fri, Nov 15, 2013 at 5:34 PM, Ivan Rubinson wrote:

Hmm…
No I’m not (knowingly) using a viewport.
I am using a SDL_RenderSetLogicalSize though.

On Fri, Nov 15, 2013 at 5:21 PM, Andreas Schiffler < aschiffler at ferzkopp.net> wrote:

Are you using a Viewport?

If so, this could be related to this bug:
https://bugzilla.libsdl.org/show_bug.cgi?id=2207

On 11/15/2013 4:27 AM, Ivan Rubinson wrote:

That’s weird.
I wrote a test program and it works fine without my patch.

However, in my main project it doesn’t work fine without the patch.
I’ll investigate this further.

On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga wrote:

You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla for
further investigation?
http://bugzilla.libsdl.org

Thanks!

On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo <@Gabriel_Jacobo>wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to
work fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson

Hi.
As it turns out, it was impossible to render a texture flipped
diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

It is possible, but it seems like a work-around. Why use rotation if
semantically what I do is flipping? Plus, if I want to flip a texture this
way AND add a rotation, is complicates the code a bit when it shouldn’t.

Well, I see your point (two diagonals!). What sort of “hook” do You propose?On Sat, Nov 16, 2013 at 1:58 PM, Gabriel Jacobo wrote:

Also, RenderCopyEx already supports rotation, is it not possible to
achieve what you want by combining rotation and flipping?

2013/11/16 Andreas Schiffler

Yes, your proposed addition makes sense from a functionality point of
view, but I am not sure if adding bits to the existing RenderCopy flags is
the best API for this. The reason being that the flipping is handled by
texture coordinate assignment magic (quick), whereas a diagonal flip - and
there are two different ones since there are two diagonals in a rectangle -
is a combination of a horizontal flip and a rotation plus one needs to
consider the implications of rectangular dimensions. So RenderCopy is
probably not the right “hook” for this operation.

On 11/15/2013 8:28 AM, Ivan Rubinson wrote:

I figured out the problem with my main project.

The problem was not flipping diagonally, but flipping diagonally IN
ADDITION to other flips.
So I’d like to propose a new feature to SDL.

At the moment, we have SDL_FLIP_NONE, SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL, and (virtually) SDL_FLIP_VERTICAL |
SDL_FLIP_HORIZONTAL. That’s 4 combinations.
However, there’s a total of 8 possible combinations.

One cannot achieve all 8 possible combinations using the current API
with one SDL_RenderCopyEx call.
The (very rough and not optimal) work-around is to do a copy with a
diagonal flip to a temporary texture, and then do a copy with another flip
to the actual renderer. This is obviously too rough for comfort.

I’d like to propose a new flip flag: “SDL_FLIP_DIAGONAL”, which can
then be used with SDL_FLIP_HORIZONTAL or SDL_FLIP_VERTICAL (or both for
some reason). SDL_RenderCopyEx will first do a diagonal flip (if present)
and then other flips (if present).

I’ve attached a bitmap file to describe what I mean

On Fri, Nov 15, 2013 at 5:34 PM, Ivan Rubinson <@Ivan_Rubinson>wrote:

Hmm…
No I’m not (knowingly) using a viewport.
I am using a SDL_RenderSetLogicalSize though.

On Fri, Nov 15, 2013 at 5:21 PM, Andreas Schiffler < aschiffler at ferzkopp.net> wrote:

Are you using a Viewport?

If so, this could be related to this bug:
https://bugzilla.libsdl.org/show_bug.cgi?id=2207

On 11/15/2013 4:27 AM, Ivan Rubinson wrote:

That’s weird.
I wrote a test program and it works fine without my patch.

However, in my main project it doesn’t work fine without the patch.
I’ll investigate this further.

On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga wrote:

You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla
for further investigation?
http://bugzilla.libsdl.org

Thanks!

On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to
work fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson <@Ivan_Rubinson>

Hi.
As it turns out, it was impossible to render a texture flipped
diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Isn’t mixing diagonal flipping with rotation as simple as adding 180 degrees to the rotation?

– Aggelos KolaitisOn 16 ??? 2013, at 2:36 ?.?., Ivan Rubinson wrote:

It is possible, but it seems like a work-around. Why use rotation if semantically what I do is flipping? Plus, if I want to flip a texture this way AND add a rotation, is complicates the code a bit when it shouldn’t.

Well, I see your point (two diagonals!). What sort of “hook” do You propose?

On Sat, Nov 16, 2013 at 1:58 PM, Gabriel Jacobo wrote:
Also, RenderCopyEx already supports rotation, is it not possible to achieve what you want by combining rotation and flipping?

2013/11/16 Andreas Schiffler
Yes, your proposed addition makes sense from a functionality point of view, but I am not sure if adding bits to the existing RenderCopy flags is the best API for this. The reason being that the flipping is handled by texture coordinate assignment magic (quick), whereas a diagonal flip - and there are two different ones since there are two diagonals in a rectangle - is a combination of a horizontal flip and a rotation plus one needs to consider the implications of rectangular dimensions. So RenderCopy is probably not the right “hook” for this operation.

On 11/15/2013 8:28 AM, Ivan Rubinson wrote:

I figured out the problem with my main project.

The problem was not flipping diagonally, but flipping diagonally IN ADDITION to other flips.
So I’d like to propose a new feature to SDL.

At the moment, we have SDL_FLIP_NONE, SDL_FLIP_VERTICAL, SDL_FLIP_HORIZONTAL, and (virtually) SDL_FLIP_VERTICAL | SDL_FLIP_HORIZONTAL. That’s 4 combinations.
However, there’s a total of 8 possible combinations.

One cannot achieve all 8 possible combinations using the current API with one SDL_RenderCopyEx call.
The (very rough and not optimal) work-around is to do a copy with a diagonal flip to a temporary texture, and then do a copy with another flip to the actual renderer. This is obviously too rough for comfort.

I’d like to propose a new flip flag: “SDL_FLIP_DIAGONAL”, which can then be used with SDL_FLIP_HORIZONTAL or SDL_FLIP_VERTICAL (or both for some reason). SDL_RenderCopyEx will first do a diagonal flip (if present) and then other flips (if present).

I’ve attached a bitmap file to describe what I mean

On Fri, Nov 15, 2013 at 5:34 PM, Ivan Rubinson wrote:
Hmm…
No I’m not (knowingly) using a viewport.
I am using a SDL_RenderSetLogicalSize though.

On Fri, Nov 15, 2013 at 5:21 PM, Andreas Schiffler wrote:
Are you using a Viewport?

If so, this could be related to this bug:
https://bugzilla.libsdl.org/show_bug.cgi?id=2207

On 11/15/2013 4:27 AM, Ivan Rubinson wrote:

That’s weird.
I wrote a test program and it works fine without my patch.

However, in my main project it doesn’t work fine without the patch. I’ll investigate this further.

On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga wrote:
You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla for further investigation?
http://bugzilla.libsdl.org

Thanks!

On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo wrote:
FWIW, I tested flipping here with the 3 GL backend and it appears to work fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson
Hi.
As it turns out, it was impossible to render a texture flipped diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, it is simple. But think: Diagonal flipping (VERTICAL | HORIZONTAL) +
90 degrees rotation (for one of the other shapes in the diagram I sent) +
yet an other angle for an other rotation (think a rotating rectangle?).
It’s not very hard, but it’s unnecessarily complex.On Sat, Nov 16, 2013 at 3:55 PM, wrote:

Isn’t mixing diagonal flipping with rotation as simple as adding 180
degrees to the rotation?

– Aggelos Kolaitis

On 16 ??? 2013, at 2:36 ?.?., Ivan Rubinson <@Ivan_Rubinson> wrote:

It is possible, but it seems like a work-around. Why use rotation if
semantically what I do is flipping? Plus, if I want to flip a texture this
way AND add a rotation, is complicates the code a bit when it shouldn’t.

Well, I see your point (two diagonals!). What sort of “hook” do You
propose?

On Sat, Nov 16, 2013 at 1:58 PM, Gabriel Jacobo wrote:

Also, RenderCopyEx already supports rotation, is it not possible to
achieve what you want by combining rotation and flipping?

2013/11/16 Andreas Schiffler

Yes, your proposed addition makes sense from a functionality point of
view, but I am not sure if adding bits to the existing RenderCopy flags is
the best API for this. The reason being that the flipping is handled by
texture coordinate assignment magic (quick), whereas a diagonal flip - and
there are two different ones since there are two diagonals in a rectangle -
is a combination of a horizontal flip and a rotation plus one needs to
consider the implications of rectangular dimensions. So RenderCopy is
probably not the right “hook” for this operation.

On 11/15/2013 8:28 AM, Ivan Rubinson wrote:

I figured out the problem with my main project.

The problem was not flipping diagonally, but flipping diagonally IN
ADDITION to other flips.
So I’d like to propose a new feature to SDL.

At the moment, we have SDL_FLIP_NONE, SDL_FLIP_VERTICAL,
SDL_FLIP_HORIZONTAL, and (virtually) SDL_FLIP_VERTICAL |
SDL_FLIP_HORIZONTAL. That’s 4 combinations.
However, there’s a total of 8 possible combinations.

One cannot achieve all 8 possible combinations using the current API
with one SDL_RenderCopyEx call.
The (very rough and not optimal) work-around is to do a copy with a
diagonal flip to a temporary texture, and then do a copy with another flip
to the actual renderer. This is obviously too rough for comfort.

I’d like to propose a new flip flag: “SDL_FLIP_DIAGONAL”, which can
then be used with SDL_FLIP_HORIZONTAL or SDL_FLIP_VERTICAL (or both for
some reason). SDL_RenderCopyEx will first do a diagonal flip (if present)
and then other flips (if present).

I’ve attached a bitmap file to describe what I mean

On Fri, Nov 15, 2013 at 5:34 PM, Ivan Rubinson <@Ivan_Rubinson>wrote:

Hmm…
No I’m not (knowingly) using a viewport.
I am using a SDL_RenderSetLogicalSize though.

On Fri, Nov 15, 2013 at 5:21 PM, Andreas Schiffler < aschiffler at ferzkopp.net> wrote:

Are you using a Viewport?

If so, this could be related to this bug:
https://bugzilla.libsdl.org/show_bug.cgi?id=2207

On 11/15/2013 4:27 AM, Ivan Rubinson wrote:

That’s weird.
I wrote a test program and it works fine without my patch.

However, in my main project it doesn’t work fine without the patch.
I’ll investigate this further.

On Fri, Nov 15, 2013 at 7:41 AM, Sam Lantinga wrote:

You’re right. Okay, I backed out the patch.

Ivan, can you submit a bug with a test program and data to bugzilla
for further investigation?
http://bugzilla.libsdl.org

Thanks!

On Thu, Nov 14, 2013 at 4:47 AM, Gabriel Jacobo wrote:

FWIW, I tested flipping here with the 3 GL backend and it appears to
work fine when flipping HOR, VER and HOR+VER without your patch.

2013/11/12 Ivan Rubinson <@Ivan_Rubinson>

Hi.
As it turns out, it was impossible to render a texture flipped
diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
It is in the attached files (sorry, I don’t like mercurial).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org