Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2024)

Side by Side Diff: cc/picture_pile_impl.cc

Issue 11421210: cc: Apply contents scales to impl-side painting rasterization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/test/fake_picture_layer_tiling_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "cc/picture_pile_impl.h" 6 #include "cc/picture_pile_impl.h"
7 #include "cc/rendering_stats.h" 7 #include "cc/rendering_stats.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkSize.h" 9 #include "third_party/skia/include/core/SkSize.h"
10 10
(...skipping 12 matching lines...) Expand all
23 scoped_refptr<PicturePileImpl> PicturePileImpl::CloneForDrawing() const { 23 scoped_refptr<PicturePileImpl> PicturePileImpl::CloneForDrawing() const {
24 TRACE_EVENT0("cc", "PicturePileImpl::CloneForDrawing"); 24 TRACE_EVENT0("cc", "PicturePileImpl::CloneForDrawing");
25 scoped_refptr<PicturePileImpl> clone = Create(); 25 scoped_refptr<PicturePileImpl> clone = Create();
26 for (PicturePile::Pile::const_iterator i = pile_.begin(); 26 for (PicturePile::Pile::const_iterator i = pile_.begin();
27 i != pile_.end(); ++i) 27 i != pile_.end(); ++i)
28 clone->pile_.push_back((*i)->Clone()); 28 clone->pile_.push_back((*i)->Clone());
29 29
30 return clone; 30 return clone;
31 } 31 }
32 32
33 void PicturePileImpl::Raster(SkCanvas* canvas, gfx::Rect rect, 33 void PicturePileImpl::Raster(
34 RenderingStats* stats) { 34 SkCanvas* canvas,
35 gfx::Rect rect,
36 float contents_scale,
37 RenderingStats* stats) {
35 base::TimeTicks rasterizeBeginTime = base::TimeTicks::Now(); 38 base::TimeTicks rasterizeBeginTime = base::TimeTicks::Now();
36 39
37 // TODO(enne): do this more efficiently, i.e. top down with Skia clips 40 // TODO(enne): do this more efficiently, i.e. top down with Skia clips
38 canvas->save(); 41 canvas->save();
39 canvas->translate(-rect.x(), -rect.y()); 42 canvas->translate(-rect.x(), -rect.y());
40 SkRect layer_skrect = SkRect::MakeXYWH(rect.x(), rect.y(), 43 SkRect layer_skrect = SkRect::MakeXYWH(rect.x(), rect.y(),
41 rect.width(), rect.height()); 44 rect.width(), rect.height());
42 canvas->clipRect(layer_skrect); 45 canvas->clipRect(layer_skrect);
46 canvas->scale(contents_scale, contents_scale);
43 for (PicturePile::Pile::const_iterator i = pile_.begin(); 47 for (PicturePile::Pile::const_iterator i = pile_.begin();
44 i != pile_.end(); ++i) { 48 i != pile_.end(); ++i) {
45 if (!(*i)->LayerRect().Intersects(rect)) 49 if (!(*i)->LayerRect().Intersects(rect))
46 continue; 50 continue;
47 (*i)->Raster(canvas); 51 (*i)->Raster(canvas);
48 52
49 SkISize deviceSize = canvas->getDeviceSize(); 53 SkISize deviceSize = canvas->getDeviceSize();
50 stats->totalPixelsRasterized += deviceSize.width() * deviceSize.height(); 54 stats->totalPixelsRasterized += deviceSize.width() * deviceSize.height();
51 } 55 }
52 canvas->restore(); 56 canvas->restore();
53 57
54 stats->totalRasterizeTimeInSeconds += (base::TimeTicks::Now() - 58 stats->totalRasterizeTimeInSeconds += (base::TimeTicks::Now() -
55 rasterizeBeginTime).InSecondsF(); 59 rasterizeBeginTime).InSecondsF();
56 } 60 }
57 61
58 } // namespace cc 62 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/test/fake_picture_layer_tiling_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698