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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/heads_up_display_layer_impl.h" | 7 #include "cc/heads_up_display_layer_impl.h" |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "cc/debug_rect_history.h" | 10 #include "cc/debug_rect_history.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 if (canvasSize.fWidth != bounds().width() || canvasSize.fHeight != bounds().
height() || !m_hudCanvas) | 99 if (canvasSize.fWidth != bounds().width() || canvasSize.fHeight != bounds().
height() || !m_hudCanvas) |
100 m_hudCanvas = make_scoped_ptr(skia::CreateBitmapCanvas(bounds().width(),
bounds().height(), false /* opaque */)); | 100 m_hudCanvas = make_scoped_ptr(skia::CreateBitmapCanvas(bounds().width(),
bounds().height(), false /* opaque */)); |
101 | 101 |
102 m_hudCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 102 m_hudCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
103 drawHudContents(m_hudCanvas.get()); | 103 drawHudContents(m_hudCanvas.get()); |
104 | 104 |
105 const SkBitmap* bitmap = &m_hudCanvas->getDevice()->accessBitmap(false); | 105 const SkBitmap* bitmap = &m_hudCanvas->getDevice()->accessBitmap(false); |
106 SkAutoLockPixels locker(*bitmap); | 106 SkAutoLockPixels locker(*bitmap); |
107 | 107 |
108 IntRect layerRect(IntPoint(), bounds()); | 108 gfx::Rect layerRect(gfx::Point(), bounds()); |
109 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); | 109 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); |
110 resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bit
map->getPixels()), layerRect, layerRect, IntSize()); | 110 resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bit
map->getPixels()), layerRect, layerRect, gfx::Vector2d()); |
111 } | 111 } |
112 | 112 |
113 void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider) | 113 void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider) |
114 { | 114 { |
115 LayerImpl::didDraw(resourceProvider); | 115 LayerImpl::didDraw(resourceProvider); |
116 | 116 |
117 if (!m_hudTexture->id()) | 117 if (!m_hudTexture->id()) |
118 return; | 118 return; |
119 | 119 |
120 // FIXME: the following assert will not be true when sending resources to a | 120 // FIXME: the following assert will not be true when sending resources to a |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 canvas->drawRect(skRect, paint); | 288 canvas->drawRect(skRect, paint); |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 292 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const |
293 { | 293 { |
294 return "HeadsUpDisplayLayer"; | 294 return "HeadsUpDisplayLayer"; |
295 } | 295 } |
296 | 296 |
297 } // namespace cc | 297 } // namespace cc |
OLD | NEW |