paintBackground()

in packages/core/src/rendering/box-decorator.ts [19:37]


  paintBackground(context: PaintingContext, offset: Point, size: Size) {
    if ('backgroundColor' in this
      || 'boxShadow' in this) {
      const paint: Paint = {
        style: PaintStyle.fill,
        color: this.backgroundColor,
        shader: this.backgroundImage,
      }
      if (this.boxShadow) {
        BoxShadow.applyToPaint(this.boxShadow, paint)
      }

      if (hasOwn(this, 'borderRadius') && this.borderRadius > 0) {
        context.canvas.drawRRect(offset.x, offset.y, size.width, size.height, this.borderRadius!, this.borderRadius!, paint)
      } else {
        context.canvas.drawRect(offset.x, offset.y, size.width, size.height, paint)
      }
    }
  }