Chromium Code Reviews| Index: cc/tile_manager.cc |
| diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc |
| index 2f95204abb10d66a3e687ff9baf1a97f2f65ba8b..c2645522594a5317702c182562fe1a5e4b30a6e4 100644 |
| --- a/cc/tile_manager.cc |
| +++ b/cc/tile_manager.cc |
| @@ -15,6 +15,7 @@ |
| #include "cc/raster_worker_pool.h" |
| #include "cc/resource_pool.h" |
| #include "cc/tile.h" |
| +#include "skia/ext/paint_simplifier.h" |
| #include "third_party/skia/include/core/SkDevice.h" |
| namespace cc { |
| @@ -72,6 +73,7 @@ std::string ValueToString(scoped_ptr<base::Value> value) |
| return str; |
| } |
| + |
| } // namespace |
| scoped_ptr<base::Value> TileManagerBinAsValue(TileManagerBin bin) { |
| @@ -664,7 +666,8 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { |
| resource_id), |
| tile->content_rect_, |
| tile->contents_scale(), |
| - use_cheapness_estimator_), |
| + use_cheapness_estimator_, |
| + ShouldSimplifyPaint(tile.get())), |
| base::Bind(&TileManager::OnRasterTaskCompleted, |
| base::Unretained(this), |
| tile, |
| @@ -681,6 +684,7 @@ void TileManager::PerformOneRaster(Tile* tile) { |
| tile->content_rect_, |
| tile->contents_scale(), |
| use_cheapness_estimator_, |
| + ShouldSimplifyPaint(tile), |
| tile->picture_pile(), |
| &rendering_stats_); |
| @@ -786,6 +790,7 @@ void TileManager::PerformRaster(uint8* buffer, |
| const gfx::Rect& rect, |
| float contents_scale, |
| bool use_cheapness_estimator, |
| + bool simplify_paint, |
| PicturePileImpl* picture_pile, |
| RenderingStats* stats) { |
| TRACE_EVENT0("cc", "TileManager::PerformRaster"); |
| @@ -801,6 +806,13 @@ void TileManager::PerformRaster(uint8* buffer, |
| if (stats) |
| begin_time = base::TimeTicks::Now(); |
| + // FIXME: PerformRaster is a static function, so we can't just create |
| + // one in the constructor and reuse it. But the object is refcounted |
| + // so may not be happy living on the stack. How do we get rid of this |
| + // new? |
|
Sami
2013/02/08 13:44:01
You could create the simplifier as a member of Til
|
| + if (simplify_paint) |
| + canvas.setDrawFilter(new skia::PaintSimplifier); |
| + |
| int64 total_pixels_rasterized = 0; |
| picture_pile->Raster(&canvas, rect, contents_scale, |
| &total_pixels_rasterized); |
| @@ -852,4 +864,15 @@ void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
| } |
| } |
| +// Needs to be a member of TileManager to access Tile::managed_state() |
| +bool TileManager::ShouldSimplifyPaint(Tile* tile) { |
| + // FIXME: tree_priority can remain SMOOTHNESS_TAKES_PRIORITY an arbitrary |
| + // length of time after a fling ends. resolution can be LOW_RESOLUTION |
| + // at times other than mid-fling. The two only seem to be true |
| + // together during flings & pinch-zooms. |
| + return |
| + GlobalState().tree_priority == SMOOTHNESS_TAKES_PRIORITY && |
| + tile->managed_state().resolution == LOW_RESOLUTION; |
| +} |
| + |
| } // namespace cc |