private static @NotNull Icon wrapHiDPI(@NotNull ScaleContext context, @NotNull JBHiDPIScaledImage image) {
    return new JBImageIcon(image) {
      final double myBase = context.getScale(ScaleType.USR_SCALE);

      private void update() {
        if (context.update()) {
          setImage(image.scale(context.getScale(ScaleType.USR_SCALE) / myBase));
        }
      }

      @Override
      public synchronized void paintIcon(Component c, @NotNull Graphics g, int x, int y) {
        update();
        super.paintIcon(c, g, x, y);
      }

      @Override
      public int getIconWidth() {
        update();
        return super.getIconWidth();
      }

      @Override
      public int getIconHeight() {
        update();
        return super.getIconHeight();
      }
    };
  }
private static @NotNull Icon wrapHiDPI(@NotNull ScaleContext context, @NotNull JBHiDPIScaledImage image)