OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/heads_up_display_layer_impl.h" | 5 #include "cc/layers/heads_up_display_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 hud_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); | 163 hud_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); |
164 hud_canvas_->save(); | 164 hud_canvas_->save(); |
165 hud_canvas_->scale(contents_scale_x(), contents_scale_y()); | 165 hud_canvas_->scale(contents_scale_x(), contents_scale_y()); |
166 | 166 |
167 DrawHudContents(hud_canvas_.get()); | 167 DrawHudContents(hud_canvas_.get()); |
168 | 168 |
169 hud_canvas_->restore(); | 169 hud_canvas_->restore(); |
170 } | 170 } |
171 | 171 |
172 TRACE_EVENT0("cc", "UploadHudTexture"); | 172 TRACE_EVENT0("cc", "UploadHudTexture"); |
173 const SkBitmap* bitmap = &hud_canvas_->getDevice()->accessBitmap(false); | 173 SkImageInfo info; |
174 SkAutoLockPixels locker(*bitmap); | 174 size_t rowBytes; |
danakj
2014/03/25 16:13:59
size_t row_bytes = 0;
(name style + always initia
reed1
2014/03/25 17:19:41
Done.
| |
175 | 175 const void* pixels = hud_canvas_->peekPixels(&info, &rowBytes); |
176 DCHECK(pixels); | |
176 gfx::Rect content_rect(content_bounds()); | 177 gfx::Rect content_rect(content_bounds()); |
177 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); | 178 DCHECK(info.colorType() == kPMColor_SkColorType); |
178 resource_provider->SetPixels(hud_resource_->id(), | 179 resource_provider->SetPixels(hud_resource_->id(), |
179 static_cast<const uint8_t*>(bitmap->getPixels()), | 180 static_cast<const uint8_t*>(pixels), |
180 content_rect, | 181 content_rect, |
181 content_rect, | 182 content_rect, |
182 gfx::Vector2d()); | 183 gfx::Vector2d()); |
183 } | 184 } |
184 | 185 |
185 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); } | 186 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); } |
186 | 187 |
187 void HeadsUpDisplayLayerImpl::UpdateHudContents() { | 188 void HeadsUpDisplayLayerImpl::UpdateHudContents() { |
188 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); | 189 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); |
189 | 190 |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 746 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
746 return "cc::HeadsUpDisplayLayerImpl"; | 747 return "cc::HeadsUpDisplayLayerImpl"; |
747 } | 748 } |
748 | 749 |
749 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const { | 750 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const { |
750 LayerImpl::AsValueInto(dict); | 751 LayerImpl::AsValueInto(dict); |
751 dict->SetString("layer_name", "Heads Up Display Layer"); | 752 dict->SetString("layer_name", "Heads Up Display Layer"); |
752 } | 753 } |
753 | 754 |
754 } // namespace cc | 755 } // namespace cc |
OLD | NEW |