DrawOffset seems to influence clipRect / not be cleared

I just can't figure out what's going on here:

I want to make sure my drawing operations are not clipped, and are offset 224 pixels in the Y direction (I want to draw in the bottom 16px of the screen.
My code does seem to influence rectangles, circles and fonts, but not image drawing:

local function drawIcon(x, index)
    hudIcons:draw(x,0,unFlipped,index*16,0,16,16)
end

function RenderHUD()
    printf("cliprect 1", gfx.getClipRect())
    gfx.setClipRect(0,0,400,240)
    printf("cliprect 2", gfx.getClipRect())
    gfx.setDrawOffset(0,hudY)
    printf("cliprect 3", gfx.getClipRect())
    printf("screenCliprect", gfx.getScreenClipRect())
    gfx.setColor(hudBgClr)
    gfx.fillRect(0,0,400,16)
    gfx.setColor(hudFgClr)
    local x = hudPadding

    -- lives
    drawIcon(x, 7)
    x = x+16+hudGutter
    font:drawText(extras[2], x, 0)
    x = x+10+hudPadding

    -- fuel
    if fuel > 1500 or frameCounter % 20 > 10 then
        drawIcon(x, 5)
    end
    x = x+16+hudGutter
    gfx.drawRect(x, 1, 32, 14)
    local fuelW = (fuel/6000)*28
    hudIcons:draw(x+2, 2, gfx.kImageUnflipped,0,16,fuelW,10)
    x = x+32+hudPadding

    -- speed warning
    drawIcon(x, 3)
    x = x+16+hudGutter
    gfx.drawCircleInRect(x+1,1, 14,14)
    local speedPattern = gfx.image.kDitherTypeBayer4x4
    local warnX = 1/(landingTolerance[1] / math.abs(vx))
    local warnY = 1/(landingTolerance[2] / vy) -- only downwards movement is dangerous
    local warnAlpha = math.max(warnX, warnY)
    gfx.setDitherPattern(1-warnAlpha, speedPattern) -- invert alpha due to bug in SDK
    gfx.fillCircleInRect(x+4,4, 8,8)
    gfx.setDitherPattern(1, gfx.image.kDitherTypeNone)
    x = x+16+hudPadding
[..]

Output:

cliprect 1	0	0	400	240
cliprect 2	0	0	400	240
cliprect 3	0	-224	400	240
screenCliprect	0	0	400	240


(notice missing icons in the HUD)

What am I missing here? I would expect the clipRect / screenClipRect to be 0,0,400,240 and drawOffset to be 0, +224

Probably not related, but have you tried drawing directly in the main function instead of calling it via local function. I’m not sure if it makes a difference but it is a glaring difference from how all the other functions are called.

I did try to call the drawIcon line directly in RenderHUD, no difference.

Have you tried dropping the source rect portion? I wonder if when using source rect it isn’t respecting drawOffset or isn’t calculating the images bounds correctly.

You mean clipRect? I thought I should reset the clipRect because I use it elsewhere to gain a performance improvement with partially offscreen images and also to prevent overwriting the HUD portion.

Side question: does setting a clipRect improve performance when drawing partially offscreen, or is the clipRect 0,0,400,240 by default?

I do not use draw Offset elsewhere, though

Marking this as solved because this is a duplicate of Image:draw: drawOffset affects sourceRect instead of location