diff options
Diffstat (limited to 'cc/resources/bitmap_skpicture_content_layer_updater.cc')
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.cc | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index 455d7c9..e721891 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -5,7 +5,7 @@ #include "cc/resources/bitmap_skpicture_content_layer_updater.h" #include "base/time.h" -#include "cc/debug/rendering_stats_instrumentation.h" +#include "cc/debug/rendering_stats.h" #include "cc/resources/layer_painter.h" #include "cc/resources/prioritized_resource.h" #include "cc/resources/resource_update_queue.h" @@ -23,15 +23,20 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( ResourceUpdateQueue* queue, gfx::Rect source_rect, gfx::Vector2d dest_offset, - bool partial_update) { + bool partial_update, + RenderingStats* stats) { bitmap_.setConfig( SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); bitmap_.allocPixels(); bitmap_.setIsOpaque(updater_->layer_is_opaque()); SkDevice device(bitmap_); SkCanvas canvas(&device); - - updater_->PaintContentsRect(&canvas, source_rect); + base::TimeTicks paint_begin_time; + if (stats) + paint_begin_time = base::TimeTicks::Now(); + updater_->PaintContentsRect(&canvas, source_rect, stats); + if (stats) + stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time; ResourceUpdate upload = ResourceUpdate::Create( texture(), &bitmap_, source_rect, source_rect, dest_offset); @@ -42,18 +47,14 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( } scoped_refptr<BitmapSkPictureContentLayerUpdater> -BitmapSkPictureContentLayerUpdater::Create( - scoped_ptr<LayerPainter> painter, - RenderingStatsInstrumentation* stats_instrumentation) { +BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { return make_scoped_refptr( - new BitmapSkPictureContentLayerUpdater(painter.Pass(), - stats_instrumentation)); + new BitmapSkPictureContentLayerUpdater(painter.Pass())); } BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( - scoped_ptr<LayerPainter> painter, - RenderingStatsInstrumentation* stats_instrumentation) - : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {} + scoped_ptr<LayerPainter> painter) + : SkPictureContentLayerUpdater(painter.Pass()) {} BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} @@ -66,25 +67,21 @@ BitmapSkPictureContentLayerUpdater::CreateResource( void BitmapSkPictureContentLayerUpdater::PaintContentsRect( SkCanvas* canvas, - gfx::Rect source_rect) { + gfx::Rect source_rect, + RenderingStats* stats) { // Translate the origin of content_rect to that of source_rect. canvas->translate(content_rect().x() - source_rect.x(), content_rect().y() - source_rect.y()); - - base::TimeTicks start_time = - rendering_stats_instrumentation_->StartRecording(); - + base::TimeTicks rasterize_begin_time; + if (stats) + rasterize_begin_time = base::TimeTicks::Now(); DrawPicture(canvas); - - base::TimeDelta duration = - rendering_stats_instrumentation_->EndRecording(start_time); - rendering_stats_instrumentation_->AddRaster( - duration, - source_rect.width() * source_rect.height(), - false); - - // TODO: Clarify if this needs to be saved here. crbug.com/223693 - rendering_stats_instrumentation_->AddPaint(duration, 0); + if (stats) { + stats->total_rasterize_time += + base::TimeTicks::Now() - rasterize_begin_time; + stats->total_pixels_rasterized += + source_rect.width() * source_rect.height(); + } } } // namespace cc |