diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index a3710db9391e030824ca6d1f6b594f3a0261702c..f6760be9634d37b91f30cc7988abafc28a078590 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -253,7 +253,8 @@ void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4
 #define EXPAND(compn) \
         if (desc->comp[compn].depth > 8) \
             color->comp[desc->comp[compn].plane].u16[desc->comp[compn].offset] = \
-            color->comp[desc->comp[compn].plane].u8[desc->comp[compn].offset] << (draw->desc->comp[compn].depth - 8)
+            color->comp[desc->comp[compn].plane].u8[desc->comp[compn].offset] << \
+                (draw->desc->comp[compn].depth + draw->desc->comp[compn].shift - 8)
         EXPAND(3);
         EXPAND(2);
         EXPAND(1);