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/devtools_instrumentation.h" | 7 #include "cc/debug/devtools_instrumentation.h" |
8 #include "cc/debug/rendering_stats_instrumentation.h" | 8 #include "cc/debug/rendering_stats_instrumentation.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 float contents_width_scale, | 60 float contents_width_scale, |
61 float contents_height_scale, | 61 float contents_height_scale, |
62 gfx::Rect* resulting_opaque_rect) { | 62 gfx::Rect* resulting_opaque_rect) { |
63 if (canvas_size_ != content_rect.size()) { | 63 if (canvas_size_ != content_rect.size()) { |
64 devtools_instrumentation::ScopedLayerTask paint_setup( | 64 devtools_instrumentation::ScopedLayerTask paint_setup( |
65 devtools_instrumentation::kPaintSetup, layer_id_); | 65 devtools_instrumentation::kPaintSetup, layer_id_); |
66 canvas_size_ = content_rect.size(); | 66 canvas_size_ = content_rect.size(); |
67 bitmap_backing_.allocN32Pixels( | 67 bitmap_backing_.allocN32Pixels( |
68 canvas_size_.width(), canvas_size_.height(), layer_is_opaque_); | 68 canvas_size_.width(), canvas_size_.height(), layer_is_opaque_); |
69 canvas_ = skia::AdoptRef(new SkCanvas(bitmap_backing_)); | 69 canvas_ = skia::AdoptRef(new SkCanvas(bitmap_backing_)); |
| 70 SkISize size = canvas_->getBaseLayerSize(); |
| 71 CHECK_EQ(content_rect.width(), size.width()); |
| 72 CHECK_EQ(content_rect.height(), size.height()); |
70 } | 73 } |
71 | 74 |
72 base::TimeTicks start_time = | 75 base::TimeTicks start_time = |
73 rendering_stats_instrumentation_->StartRecording(); | 76 rendering_stats_instrumentation_->StartRecording(); |
74 PaintContents(canvas_.get(), | 77 PaintContents(canvas_.get(), |
75 content_rect.origin(), | 78 content_rect, |
76 contents_width_scale, | 79 contents_width_scale, |
77 contents_height_scale, | 80 contents_height_scale, |
78 resulting_opaque_rect); | 81 resulting_opaque_rect); |
79 base::TimeDelta duration = | 82 base::TimeDelta duration = |
80 rendering_stats_instrumentation_->EndRecording(start_time); | 83 rendering_stats_instrumentation_->EndRecording(start_time); |
81 rendering_stats_instrumentation_->AddPaint( | 84 rendering_stats_instrumentation_->AddPaint( |
82 duration, | 85 duration, |
83 content_rect.width() * content_rect.height()); | 86 content_rect.width() * content_rect.height()); |
84 } | 87 } |
85 | 88 |
(...skipping 22 matching lines...) Expand all Loading... |
108 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { | 111 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { |
109 if (opaque != layer_is_opaque_) { | 112 if (opaque != layer_is_opaque_) { |
110 canvas_.clear(); | 113 canvas_.clear(); |
111 canvas_size_ = gfx::Size(); | 114 canvas_size_ = gfx::Size(); |
112 } | 115 } |
113 | 116 |
114 ContentLayerUpdater::SetOpaque(opaque); | 117 ContentLayerUpdater::SetOpaque(opaque); |
115 } | 118 } |
116 | 119 |
117 } // namespace cc | 120 } // namespace cc |
OLD | NEW |