| 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_content_layer_updater.h" | 5 #include "cc/resources/bitmap_content_layer_updater.h" |
| 6 | 6 |
| 7 #include "cc/debug/rendering_stats_instrumentation.h" | 7 #include "cc/debug/rendering_stats_instrumentation.h" |
| 8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
| 9 #include "cc/resources/prioritized_resource.h" | 9 #include "cc/resources/prioritized_resource.h" |
| 10 #include "cc/resources/resource_update.h" | 10 #include "cc/resources/resource_update.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 float contents_width_scale, | 56 float contents_width_scale, |
| 57 float contents_height_scale, | 57 float contents_height_scale, |
| 58 gfx::Rect* resulting_opaque_rect, | 58 gfx::Rect* resulting_opaque_rect, |
| 59 RenderingStats* stats) { | 59 RenderingStats* stats) { |
| 60 if (canvas_size_ != content_rect.size()) { | 60 if (canvas_size_ != content_rect.size()) { |
| 61 canvas_size_ = content_rect.size(); | 61 canvas_size_ = content_rect.size(); |
| 62 canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas( | 62 canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas( |
| 63 canvas_size_.width(), canvas_size_.height(), opaque_)); | 63 canvas_size_.width(), canvas_size_.height(), opaque_)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (stats) { | 66 printf("BitmapContentLayerUpdater::PrepareToUpdate\n"); |
| 67 stats->total_pixels_rasterized += | 67 |
| 68 content_rect.width() * content_rect.height(); | 68 // TODO: Clarify if this needs to be saved here. crbug.com/223693 |
| 69 } | 69 rendering_stats_instrumentation_->AddRaster( |
| 70 base::TimeDelta(), |
| 71 content_rect.width() * content_rect.height(), |
| 72 false); |
| 70 | 73 |
| 71 PaintContents(canvas_.get(), | 74 PaintContents(canvas_.get(), |
| 72 content_rect, | 75 content_rect, |
| 73 contents_width_scale, | 76 contents_width_scale, |
| 74 contents_height_scale, | 77 contents_height_scale, |
| 75 resulting_opaque_rect, | 78 resulting_opaque_rect, |
| 76 stats); | 79 stats); |
| 77 } | 80 } |
| 78 | 81 |
| 79 void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, | 82 void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 95 | 98 |
| 96 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { | 99 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { |
| 97 if (opaque != opaque_) { | 100 if (opaque != opaque_) { |
| 98 canvas_.reset(); | 101 canvas_.reset(); |
| 99 canvas_size_ = gfx::Size(); | 102 canvas_size_ = gfx::Size(); |
| 100 } | 103 } |
| 101 opaque_ = opaque; | 104 opaque_ = opaque; |
| 102 } | 105 } |
| 103 | 106 |
| 104 } // namespace cc | 107 } // namespace cc |
| OLD | NEW |