Ejemplo n.º 1
0
void Element::paint(Canvas* canvas)
{
    if (!renderer() || !renderer()->isBox())
        return;
    RenderBox* box = toRenderBox(renderer());
    GraphicsContext context(canvas->skCanvas());

    // Very simplified painting to allow painting an arbitrary (layer-less) subtree.
    Vector<RenderBox*> layers;
    PaintInfo paintInfo(&context, box->absoluteBoundingBoxRect(), box);
    box->paint(paintInfo, LayoutPoint(), layers);
    // Note we're ignoring any layers encountered.
}
Ejemplo n.º 2
0
void Paragraph::paint(Canvas* canvas, double x, double y) {
  SkCanvas* skCanvas = canvas->canvas();
  if (!skCanvas)
    return;

  FontCachePurgePreventer fontCachePurgePreventer;

  // Very simplified painting to allow painting an arbitrary (layer-less)
  // subtree.
  RenderBox* box = firstChildBox();
  skCanvas->translate(x, y);

  GraphicsContext context(skCanvas);
  Vector<RenderBox*> layers;
  LayoutRect bounds = box->absoluteBoundingBoxRect();
  FTL_DCHECK(bounds.x() == 0 && bounds.y() == 0);
  PaintInfo paintInfo(&context, enclosingIntRect(bounds), box);
  box->paint(paintInfo, LayoutPoint(), layers);
  // Note we're ignoring any layers encountered.
  // TODO(abarth): Remove the concept of RenderLayers.

  skCanvas->translate(-x, -y);
}