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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 DrawHudContents(hud_surface_->getCanvas()); | 203 DrawHudContents(hud_surface_->getCanvas()); |
204 | 204 |
205 hud_surface_->getCanvas()->restore(); | 205 hud_surface_->getCanvas()->restore(); |
206 } | 206 } |
207 | 207 |
208 TRACE_EVENT0("cc", "UploadHudTexture"); | 208 TRACE_EVENT0("cc", "UploadHudTexture"); |
209 SkImageInfo info; | 209 SkImageInfo info; |
210 size_t row_bytes = 0; | 210 size_t row_bytes = 0; |
211 const void* pixels = hud_surface_->getCanvas()->peekPixels(&info, &row_bytes); | 211 const void* pixels = hud_surface_->getCanvas()->peekPixels(&info, &row_bytes); |
212 DCHECK(pixels); | 212 DCHECK(pixels); |
213 gfx::Rect content_rect(internal_content_bounds_); | |
214 DCHECK(info.colorType() == kN32_SkColorType); | 213 DCHECK(info.colorType() == kN32_SkColorType); |
215 resource_provider->SetPixels(resources_.back()->id(), | 214 resource_provider->CopyToResource(resources_.back()->id(), |
216 static_cast<const uint8_t*>(pixels), | 215 static_cast<const uint8_t*>(pixels), |
217 content_rect, | 216 internal_content_bounds_); |
218 content_rect, | |
219 gfx::Vector2d()); | |
220 } | 217 } |
221 | 218 |
222 void HeadsUpDisplayLayerImpl::ReleaseResources() { | 219 void HeadsUpDisplayLayerImpl::ReleaseResources() { |
223 resources_.clear(); | 220 resources_.clear(); |
224 } | 221 } |
225 | 222 |
226 void HeadsUpDisplayLayerImpl::UpdateHudContents() { | 223 void HeadsUpDisplayLayerImpl::UpdateHudContents() { |
227 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); | 224 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); |
228 | 225 |
229 // Don't update numbers every frame so text is readable. | 226 // Don't update numbers every frame so text is readable. |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 return "cc::HeadsUpDisplayLayerImpl"; | 832 return "cc::HeadsUpDisplayLayerImpl"; |
836 } | 833 } |
837 | 834 |
838 void HeadsUpDisplayLayerImpl::AsValueInto( | 835 void HeadsUpDisplayLayerImpl::AsValueInto( |
839 base::trace_event::TracedValue* dict) const { | 836 base::trace_event::TracedValue* dict) const { |
840 LayerImpl::AsValueInto(dict); | 837 LayerImpl::AsValueInto(dict); |
841 dict->SetString("layer_name", "Heads Up Display Layer"); | 838 dict->SetString("layer_name", "Heads Up Display Layer"); |
842 } | 839 } |
843 | 840 |
844 } // namespace cc | 841 } // namespace cc |
OLD | NEW |