code: public final void paint(Graphics2D g, JComponent c, int w, int h) {
          // don't render if the width/height are too small
          if (w <= 0 || h <= 0)
              return;
  
          Object[] extendedCacheKeys = getExtendedCacheKeys(c);
  
          ctx = getPaintContext();
          CacheMode cacheMode = ctx == null ? CacheMode.NO_CACHING : ctx.getCacheMode();
  
          if (cacheMode == CacheMode.NO_CACHING || !ImageCache.getInstance().isImageCachable(w, h) || g instanceof PrinterGraphics) {
              paintDirectly(g, c, w, h, extendedCacheKeys);
          } else {
              paintWithCaching(g, c, w, h, extendedCacheKeys);
          }
      }
docs: {@inheritDoc}