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