Jassert in edgetable

Hi Jules,

When calling drawImageTransformed (with an image that has non-zero dimensions), I’m getting on some occasions an assertion failed at the line jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight()); in EdgeTable::iterate. This happens when the ‘bound’ rect is zero width. Adding a if (bounds.getWidth()==0) return; at the top avoids that jassert failed.

Hmm, that’s odd. It should really never reach that point if the width is 0. Thanks, I’ll take a look!

Ok… since I can’t reproduce this, could you do me a favour and see whether this fixes it? I’d rather prevent the condition happening before it gets as far as the iteration stage.

[code]bool EdgeTable::isEmpty() noexcept
if (needToCheckEmptinesss)
if (bounds.getWidth() > 0)
needToCheckEmptinesss = false;
int* t = table;

        for (int i = bounds.getHeight(); --i >= 0;)
            if (t[0] > 1)
                return false;

            t += lineStrideElements;

    bounds.setHeight (0);

return bounds.getHeight() == 0;


No, it does not work. I think isEmpty() is not called in my case.

I call graphics::drawImageTransformed and then the call stack is:

juce::LowLevelGraphicsSoftwareRenderer::drawImage juce::LowLevelGraphicsSoftwareRenderer::SavedState::renderImage juce::SoftwareRendererClasses::ClipRegion_EdgeTable::renderImageUntransformed juce::SoftwareRendererClasses::ClipRegionBase::renderImageUntransformedInternal<juce::EdgeTable const > juce::EdgeTable::iterate<juce::SoftwareRendererClasses::ImageFillEdgeTableRenderer<juce::PixelRGB,juce::PixelARGB,0>

in SavedState::renderImage , the ClipRegionBase c is contructed as the empty intersection of two rectangles:

SoftwareRendererClasses::ClipRegionBase::Ptr c (new SoftwareRendererClasses::ClipRegion_EdgeTable (Rectangle (tx, ty, sourceImage.getWidth(), sourceImage.getHeight()).getIntersection (image.getBounds())));

These two rectangles do not intersect, they are just adjacent (for example r1 = (x=-10, y=0, w=10, h=10) r2 = (x=0, y=0, w=10, h=10) )

Ok, thanks, that should be enough info for me to sort it out!

Now it works fine, but you probably already knew it :slight_smile: