Commit 864b8463 authored by vangelis@chromium.org's avatar vangelis@chromium.org

Limit pixels that get cleared to repaint area.

Since we now keep the canvas around in the ContentLayerUpdater, we often
end up getting small invalidations that paint on a large canvas. In those
cases, instead of clearing the entire canvas to transparent, clear only the
portion that will be repainted.

BUG=313494

Review URL: https://codereview.chromium.org/61403003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233539 0039d316-1c4b-4281-b951-d872f2087c98
parent 5248357e
......@@ -62,12 +62,14 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
SkRect layer_sk_rect = SkRect::MakeXYWH(
layer_rect.x(), layer_rect.y(), layer_rect.width(), layer_rect.height());
canvas->clipRect(layer_sk_rect);
// If the layer has opaque contents then there is no need to
// clear the canvas before painting.
if (!layer_is_opaque_)
canvas->clear(SK_ColorTRANSPARENT);
canvas->clipRect(layer_sk_rect);
if (!layer_is_opaque_) {
TRACE_EVENT0("cc", "Clear");
canvas->drawColor(SK_ColorTRANSPARENT, SkXfermode::kSrc_Mode);
}
gfx::RectF opaque_layer_rect;
painter_->Paint(canvas, layer_rect, &opaque_layer_rect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment