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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 float contents_width_scale, | 59 float contents_width_scale, |
60 float contents_height_scale, | 60 float contents_height_scale, |
61 gfx::Rect* resulting_opaque_rect) { | 61 gfx::Rect* resulting_opaque_rect) { |
62 devtools_instrumentation::ScopedLayerTask paint_layer( | 62 devtools_instrumentation::ScopedLayerTask paint_layer( |
63 devtools_instrumentation::kPaintLayer, layer_id_); | 63 devtools_instrumentation::kPaintLayer, layer_id_); |
64 if (canvas_size_.width() < content_rect.size().width() || | 64 if (canvas_size_.width() < content_rect.size().width() || |
65 canvas_size_.height() < content_rect.size().height()) { | 65 canvas_size_.height() < content_rect.size().height()) { |
66 devtools_instrumentation::ScopedLayerTask paint_setup( | 66 devtools_instrumentation::ScopedLayerTask paint_setup( |
67 devtools_instrumentation::kPaintSetup, layer_id_); | 67 devtools_instrumentation::kPaintSetup, layer_id_); |
68 canvas_size_ = content_rect.size(); | 68 canvas_size_ = content_rect.size(); |
69 canvas_ = skia::AdoptRef(skia::CreateBitmapCanvas( | 69 bitmap_backing_.setConfig( |
70 canvas_size_.width(), canvas_size_.height(), layer_is_opaque_)); | 70 SkBitmap::kARGB_8888_Config, |
| 71 canvas_size_.width(), canvas_size_.height(), |
| 72 0, layer_is_opaque_ ? kOpaque_SkAlphaType : kPremul_SkAlphaType); |
| 73 bitmap_backing_.allocPixels(); |
| 74 canvas_ = skia::AdoptRef(new SkCanvas(bitmap_backing_)); |
71 } | 75 } |
72 | 76 |
73 base::TimeTicks start_time = | 77 base::TimeTicks start_time = |
74 rendering_stats_instrumentation_->StartRecording(); | 78 rendering_stats_instrumentation_->StartRecording(); |
75 PaintContents(canvas_.get(), | 79 PaintContents(canvas_.get(), |
76 content_rect, | 80 content_rect, |
77 contents_width_scale, | 81 contents_width_scale, |
78 contents_height_scale, | 82 contents_height_scale, |
79 resulting_opaque_rect); | 83 resulting_opaque_rect); |
80 base::TimeDelta duration = | 84 base::TimeDelta duration = |
(...skipping 27 matching lines...) Expand all Loading... |
108 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { | 112 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { |
109 if (opaque != layer_is_opaque_) { | 113 if (opaque != layer_is_opaque_) { |
110 canvas_.clear(); | 114 canvas_.clear(); |
111 canvas_size_ = gfx::Size(); | 115 canvas_size_ = gfx::Size(); |
112 } | 116 } |
113 | 117 |
114 ContentLayerUpdater::SetOpaque(opaque); | 118 ContentLayerUpdater::SetOpaque(opaque); |
115 } | 119 } |
116 | 120 |
117 } // namespace cc | 121 } // namespace cc |
OLD | NEW |