| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/resources/bitmap_skpicture_content_layer_updater.h" | 5 #include "cc/resources/bitmap_skpicture_content_layer_updater.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "cc/debug/rendering_stats.h" | 8 #include "cc/debug/rendering_stats.h" |
| 9 #include "cc/resources/layer_painter.h" | 9 #include "cc/resources/layer_painter.h" |
| 10 #include "cc/resources/prioritized_resource.h" | 10 #include "cc/resources/prioritized_resource.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); | 29 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); |
| 30 bitmap_.allocPixels(); | 30 bitmap_.allocPixels(); |
| 31 bitmap_.setIsOpaque(updater_->layer_is_opaque()); | 31 bitmap_.setIsOpaque(updater_->layer_is_opaque()); |
| 32 SkDevice device(bitmap_); | 32 SkDevice device(bitmap_); |
| 33 SkCanvas canvas(&device); | 33 SkCanvas canvas(&device); |
| 34 base::TimeTicks paint_begin_time; | 34 base::TimeTicks paint_begin_time; |
| 35 if (stats) | 35 if (stats) |
| 36 paint_begin_time = base::TimeTicks::Now(); | 36 paint_begin_time = base::TimeTicks::Now(); |
| 37 updater_->PaintContentsRect(&canvas, source_rect, stats); | 37 updater_->PaintContentsRect(&canvas, source_rect, stats); |
| 38 if (stats) | 38 if (stats) |
| 39 stats->totalPaintTime += base::TimeTicks::Now() - paint_begin_time; | 39 stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time; |
| 40 | 40 |
| 41 ResourceUpdate upload = ResourceUpdate::Create( | 41 ResourceUpdate upload = ResourceUpdate::Create( |
| 42 texture(), &bitmap_, source_rect, source_rect, dest_offset); | 42 texture(), &bitmap_, source_rect, source_rect, dest_offset); |
| 43 if (partial_update) | 43 if (partial_update) |
| 44 queue->AppendPartialUpload(upload); | 44 queue->AppendPartialUpload(upload); |
| 45 else | 45 else |
| 46 queue->AppendFullUpload(upload); | 46 queue->AppendFullUpload(upload); |
| 47 } | 47 } |
| 48 | 48 |
| 49 scoped_refptr<BitmapSkPictureContentLayerUpdater> | 49 scoped_refptr<BitmapSkPictureContentLayerUpdater> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 70 gfx::Rect source_rect, | 70 gfx::Rect source_rect, |
| 71 RenderingStats* stats) { | 71 RenderingStats* stats) { |
| 72 // Translate the origin of content_rect to that of source_rect. | 72 // Translate the origin of content_rect to that of source_rect. |
| 73 canvas->translate(content_rect().x() - source_rect.x(), | 73 canvas->translate(content_rect().x() - source_rect.x(), |
| 74 content_rect().y() - source_rect.y()); | 74 content_rect().y() - source_rect.y()); |
| 75 base::TimeTicks rasterize_begin_time; | 75 base::TimeTicks rasterize_begin_time; |
| 76 if (stats) | 76 if (stats) |
| 77 rasterize_begin_time = base::TimeTicks::Now(); | 77 rasterize_begin_time = base::TimeTicks::Now(); |
| 78 DrawPicture(canvas); | 78 DrawPicture(canvas); |
| 79 if (stats) { | 79 if (stats) { |
| 80 stats->totalRasterizeTime += base::TimeTicks::Now() - rasterize_begin_time; | 80 stats->total_rasterize_time += |
| 81 stats->totalPixelsRasterized += source_rect.width() * source_rect.height(); | 81 base::TimeTicks::Now() - rasterize_begin_time; |
| 82 stats->total_pixels_rasterized += |
| 83 source_rect.width() * source_rect.height(); |
| 82 } | 84 } |
| 83 } | 85 } |
| 84 | 86 |
| 85 } // namespace cc | 87 } // namespace cc |
| OLD | NEW |