summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authorvangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-07 08:02:03 +0000
committervangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-07 08:02:03 +0000
commit864b846301f7e59f964a988a14c0eb11ee856adb (patch)
treee2a09b17b484b3f7bafc5e997a24409bf453110f /cc/resources
parent5248357eff4759ec3f905b9fa271ba9496259f92 (diff)
downloadchromium_src-864b846301f7e59f964a988a14c0eb11ee856adb.zip
chromium_src-864b846301f7e59f964a988a14c0eb11ee856adb.tar.gz
chromium_src-864b846301f7e59f964a988a14c0eb11ee856adb.tar.bz2
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
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/content_layer_updater.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/cc/resources/content_layer_updater.cc b/cc/resources/content_layer_updater.cc
index 92cabf2..e3f87a4 100644
--- a/cc/resources/content_layer_updater.cc
+++ b/cc/resources/content_layer_updater.cc
@@ -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);