Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUCE d2d - one drawImage API (partial image draw) results in bad behaviour #3

Open
remaincalm opened this issue Mar 9, 2024 · 1 comment

Comments

@remaincalm
Copy link

Hi there. Thanks for your work on the d2d stuff, seems to be a huge speedup.

There is one API that isn't working properly - drawing from part of another image.
I believe it is this one, when sx and sy are not 0.
void Graphics::drawImage (const Image& imageToDraw,
int dx, int dy, int dw, int dh,
int sx, int sy, int sw, int sh,
const bool fillAlphaChannelWithCurrentBrush) const

I have large filmstrips I use for animating some onscreen elements. I have, say, 100 knob positions on a single wide bitmap, and render a selected one from this large Image based on a control value.

Works fine in the old renderer, breaks on the new renderer.

This code doesn't work anymore:
int xh = 32; // source height
int h = 32; // target height
int selected_frame = /* selected bitmap from filmstrip, maybe 640x32 res*/;
g.drawImage(filmstrip_, 0, 0, (int)h, (int)h, xh * selected_frame, 0, xh, xh); // draw part of an image to part of a target

If I force it to render the first element, the one at (0,0) with
int selected_frame = 0;
.. it works fine. So I think something is going wrong with the offset/translation?

I started tracing into the code and made it as far as Direct2DGraphicsContext::drawImage before I got a bit lost.

If this isn't enough to repro, I'll see if I can put together a minimal test, please let me know.
Thanks again.

@remaincalm
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant