| 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/heads_up_display_layer_impl.h" | 5 #include "cc/heads_up_display_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "cc/debug_colors.h" | 9 #include "cc/debug_colors.h" |
| 10 #include "cc/debug_rect_history.h" | 10 #include "cc/debug_rect_history.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 , m_fpsGraph(60.0, 80.0) | 73 , m_fpsGraph(60.0, 80.0) |
| 74 , m_paintTimeGraph(16.0, 48.0) | 74 , m_paintTimeGraph(16.0, 48.0) |
| 75 , m_typeface(skia::AdoptRef(SkFontHost::CreateTypeface(NULL, "monospace", Sk
Typeface::kBold))) | 75 , m_typeface(skia::AdoptRef(SkFontHost::CreateTypeface(NULL, "monospace", Sk
Typeface::kBold))) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() | 79 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() |
| 80 { | 80 { |
| 81 } | 81 } |
| 82 | 82 |
| 83 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::createLayerImpl(LayerTreeImpl* tr
eeImpl) | 83 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(LayerTreeImpl* tr
eeImpl) |
| 84 { | 84 { |
| 85 return HeadsUpDisplayLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); | 85 return HeadsUpDisplayLayerImpl::Create(treeImpl, id()).PassAs<LayerImpl>(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) | 88 void HeadsUpDisplayLayerImpl::WillDraw(ResourceProvider* resourceProvider) |
| 89 { | 89 { |
| 90 LayerImpl::willDraw(resourceProvider); | 90 LayerImpl::WillDraw(resourceProvider); |
| 91 | 91 |
| 92 if (!m_hudTexture) | 92 if (!m_hudTexture) |
| 93 m_hudTexture = ScopedResource::create(resourceProvider); | 93 m_hudTexture = ScopedResource::create(resourceProvider); |
| 94 | 94 |
| 95 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. | 95 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. |
| 96 | 96 |
| 97 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. | 97 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. |
| 98 if (m_hudTexture->size() != bounds() || resourceProvider->InUseByConsumer(m_
hudTexture->id())) | 98 if (m_hudTexture->size() != bounds() || resourceProvider->InUseByConsumer(m_
hudTexture->id())) |
| 99 m_hudTexture->Free(); | 99 m_hudTexture->Free(); |
| 100 | 100 |
| 101 if (!m_hudTexture->id()) { | 101 if (!m_hudTexture->id()) { |
| 102 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); | 102 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); |
| 103 // TODO(epenner): This texture was being used before SetPixels was calle
d, | 103 // TODO(epenner): This texture was being used before SetPixels was calle
d, |
| 104 // which is now not allowed (it's an uninitialized read). This should be
fixed | 104 // which is now not allowed (it's an uninitialized read). This should be
fixed |
| 105 // and this allocateForTesting() removed. | 105 // and this allocateForTesting() removed. |
| 106 // http://crbug.com/166784 | 106 // http://crbug.com/166784 |
| 107 resourceProvider->AllocateForTesting(m_hudTexture->id()); | 107 resourceProvider->AllocateForTesting(m_hudTexture->id()); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
ppendQuadsData) | 111 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quadSink, AppendQuadsData* a
ppendQuadsData) |
| 112 { | 112 { |
| 113 if (!m_hudTexture->id()) | 113 if (!m_hudTexture->id()) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); | 116 SharedQuadState* sharedQuadState = quadSink->useSharedQuadState(CreateShared
QuadState()); |
| 117 | 117 |
| 118 gfx::Rect quadRect(gfx::Point(), bounds()); | 118 gfx::Rect quadRect(gfx::Point(), bounds()); |
| 119 gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect()); | 119 gfx::Rect opaqueRect(contents_opaque() ? quadRect : gfx::Rect()); |
| 120 bool premultipliedAlpha = true; | 120 bool premultipliedAlpha = true; |
| 121 gfx::PointF uv_top_left(0.f, 0.f); | 121 gfx::PointF uv_top_left(0.f, 0.f); |
| 122 gfx::PointF uv_bottom_right(1.f, 1.f); | 122 gfx::PointF uv_bottom_right(1.f, 1.f); |
| 123 const float vertex_opacity[] = {1.f, 1.f, 1.f, 1.f}; | 123 const float vertex_opacity[] = {1.f, 1.f, 1.f, 1.f}; |
| 124 bool flipped = false; | 124 bool flipped = false; |
| 125 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 125 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 126 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_hudTexture->id(), prem
ultipliedAlpha, uv_top_left, uv_bottom_right, vertex_opacity, flipped); | 126 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_hudTexture->id(), prem
ultipliedAlpha, uv_top_left, uv_bottom_right, vertex_opacity, flipped); |
| 127 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 127 quadSink->append(quad.PassAs<DrawQuad>(), appendQuadsData); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void HeadsUpDisplayLayerImpl::updateHudTexture(ResourceProvider* resourceProvide
r) | 130 void HeadsUpDisplayLayerImpl::updateHudTexture(ResourceProvider* resourceProvide
r) |
| 131 { | 131 { |
| 132 if (!m_hudTexture->id()) | 132 if (!m_hudTexture->id()) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 SkISize canvasSize; | 135 SkISize canvasSize; |
| 136 if (m_hudCanvas) | 136 if (m_hudCanvas) |
| 137 canvasSize = m_hudCanvas->getDeviceSize(); | 137 canvasSize = m_hudCanvas->getDeviceSize(); |
| 138 else | 138 else |
| 139 canvasSize.set(0, 0); | 139 canvasSize.set(0, 0); |
| 140 | 140 |
| 141 if (canvasSize.fWidth != bounds().width() || canvasSize.fHeight != bounds().
height() || !m_hudCanvas) | 141 if (canvasSize.fWidth != bounds().width() || canvasSize.fHeight != bounds().
height() || !m_hudCanvas) |
| 142 m_hudCanvas = make_scoped_ptr(skia::CreateBitmapCanvas(bounds().width(),
bounds().height(), false /* opaque */)); | 142 m_hudCanvas = make_scoped_ptr(skia::CreateBitmapCanvas(bounds().width(),
bounds().height(), false /* opaque */)); |
| 143 | 143 |
| 144 updateHudContents(); | 144 updateHudContents(); |
| 145 | 145 |
| 146 m_hudCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 146 m_hudCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
| 147 drawHudContents(m_hudCanvas.get()); | 147 drawHudContents(m_hudCanvas.get()); |
| 148 | 148 |
| 149 const SkBitmap* bitmap = &m_hudCanvas->getDevice()->accessBitmap(false); | 149 const SkBitmap* bitmap = &m_hudCanvas->getDevice()->accessBitmap(false); |
| 150 SkAutoLockPixels locker(*bitmap); | 150 SkAutoLockPixels locker(*bitmap); |
| 151 | 151 |
| 152 gfx::Rect layerRect(gfx::Point(), bounds()); | 152 gfx::Rect layerRect(bounds()); |
| 153 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); | 153 DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); |
| 154 resourceProvider->SetPixels(m_hudTexture->id(), static_cast<const uint8_t*>(
bitmap->getPixels()), layerRect, layerRect, gfx::Vector2d()); | 154 resourceProvider->SetPixels(m_hudTexture->id(), static_cast<const uint8_t*>(
bitmap->getPixels()), layerRect, layerRect, gfx::Vector2d()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void HeadsUpDisplayLayerImpl::didDraw(ResourceProvider* resourceProvider) | 157 void HeadsUpDisplayLayerImpl::DidDraw(ResourceProvider* resourceProvider) |
| 158 { | 158 { |
| 159 LayerImpl::didDraw(resourceProvider); | 159 LayerImpl::DidDraw(resourceProvider); |
| 160 | 160 |
| 161 if (!m_hudTexture->id()) | 161 if (!m_hudTexture->id()) |
| 162 return; | 162 return; |
| 163 | 163 |
| 164 // FIXME: the following assert will not be true when sending resources to a | 164 // FIXME: the following assert will not be true when sending resources to a |
| 165 // parent compositor. We will probably need to hold on to m_hudTexture for | 165 // parent compositor. We will probably need to hold on to m_hudTexture for |
| 166 // longer, and have several HUD textures in the pipeline. | 166 // longer, and have several HUD textures in the pipeline. |
| 167 DCHECK(!resourceProvider->InUseByConsumer(m_hudTexture->id())); | 167 DCHECK(!resourceProvider->InUseByConsumer(m_hudTexture->id())); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void HeadsUpDisplayLayerImpl::didLoseOutputSurface() | 170 void HeadsUpDisplayLayerImpl::DidLoseOutputSurface() |
| 171 { | 171 { |
| 172 m_hudTexture.reset(); | 172 m_hudTexture.reset(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool HeadsUpDisplayLayerImpl::layerIsAlwaysDamaged() const | 175 bool HeadsUpDisplayLayerImpl::LayerIsAlwaysDamaged() const |
| 176 { | 176 { |
| 177 return true; | 177 return true; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void HeadsUpDisplayLayerImpl::updateHudContents() | 180 void HeadsUpDisplayLayerImpl::updateHudContents() |
| 181 { | 181 { |
| 182 const LayerTreeDebugState& debugState = layerTreeImpl()->debug_state(); | 182 const LayerTreeDebugState& debugState = layer_tree_impl()->debug_state(); |
| 183 | 183 |
| 184 // Don't update numbers every frame so text is readable. | 184 // Don't update numbers every frame so text is readable. |
| 185 base::TimeTicks now = layerTreeImpl()->CurrentFrameTime(); | 185 base::TimeTicks now = layer_tree_impl()->CurrentFrameTime(); |
| 186 if (base::TimeDelta(now - m_timeOfLastGraphUpdate).InSecondsF() > 0.25f) { | 186 if (base::TimeDelta(now - m_timeOfLastGraphUpdate).InSecondsF() > 0.25f) { |
| 187 m_timeOfLastGraphUpdate = now; | 187 m_timeOfLastGraphUpdate = now; |
| 188 | 188 |
| 189 if (debugState.showFPSCounter) { | 189 if (debugState.showFPSCounter) { |
| 190 FrameRateCounter* fpsCounter = layerTreeImpl()->frame_rate_counter()
; | 190 FrameRateCounter* fpsCounter = layer_tree_impl()->frame_rate_counter
(); |
| 191 m_fpsGraph.value = fpsCounter->getAverageFPS(); | 191 m_fpsGraph.value = fpsCounter->getAverageFPS(); |
| 192 fpsCounter->getMinAndMaxFPS(m_fpsGraph.min, m_fpsGraph.max); | 192 fpsCounter->getMinAndMaxFPS(m_fpsGraph.min, m_fpsGraph.max); |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (debugState.continuousPainting) { | 195 if (debugState.continuousPainting) { |
| 196 PaintTimeCounter* paintTimeCounter = layerTreeImpl()->paint_time_cou
nter(); | 196 PaintTimeCounter* paintTimeCounter = layer_tree_impl()->paint_time_c
ounter(); |
| 197 base::TimeDelta latest, min, max; | 197 base::TimeDelta latest, min, max; |
| 198 | 198 |
| 199 if (paintTimeCounter->End()) | 199 if (paintTimeCounter->End()) |
| 200 latest = paintTimeCounter->End()->total_time(); | 200 latest = paintTimeCounter->End()->total_time(); |
| 201 paintTimeCounter->GetMinAndMaxPaintTime(&min, &max); | 201 paintTimeCounter->GetMinAndMaxPaintTime(&min, &max); |
| 202 | 202 |
| 203 m_paintTimeGraph.value = latest.InMillisecondsF(); | 203 m_paintTimeGraph.value = latest.InMillisecondsF(); |
| 204 m_paintTimeGraph.min = min.InMillisecondsF(); | 204 m_paintTimeGraph.min = min.InMillisecondsF(); |
| 205 m_paintTimeGraph.max = max.InMillisecondsF(); | 205 m_paintTimeGraph.max = max.InMillisecondsF(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (debugState.showMemoryStats()) { | 208 if (debugState.showMemoryStats()) { |
| 209 MemoryHistory* memoryHistory = layerTreeImpl()->memory_history(); | 209 MemoryHistory* memoryHistory = layer_tree_impl()->memory_history(); |
| 210 if (memoryHistory->End()) | 210 if (memoryHistory->End()) |
| 211 m_memoryEntry = **memoryHistory->End(); | 211 m_memoryEntry = **memoryHistory->End(); |
| 212 else | 212 else |
| 213 m_memoryEntry = MemoryHistory::Entry(); | 213 m_memoryEntry = MemoryHistory::Entry(); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 m_fpsGraph.updateUpperBound(); | 217 m_fpsGraph.updateUpperBound(); |
| 218 m_paintTimeGraph.updateUpperBound(); | 218 m_paintTimeGraph.updateUpperBound(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void HeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas) const | 221 void HeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas) const |
| 222 { | 222 { |
| 223 const LayerTreeDebugState& debugState = layerTreeImpl()->debug_state(); | 223 const LayerTreeDebugState& debugState = layer_tree_impl()->debug_state(); |
| 224 | 224 |
| 225 if (debugState.showHudRects()) | 225 if (debugState.showHudRects()) |
| 226 drawDebugRects(canvas, layerTreeImpl()->debug_rect_history()); | 226 drawDebugRects(canvas, layer_tree_impl()->debug_rect_history()); |
| 227 | 227 |
| 228 if (debugState.showPlatformLayerTree) | 228 if (debugState.showPlatformLayerTree) |
| 229 drawPlatformLayerTree(canvas); | 229 drawPlatformLayerTree(canvas); |
| 230 | 230 |
| 231 SkRect area = SkRect::MakeEmpty(); | 231 SkRect area = SkRect::MakeEmpty(); |
| 232 if (debugState.continuousPainting) | 232 if (debugState.continuousPainting) |
| 233 area = drawPaintTimeDisplay(canvas, layerTreeImpl()->paint_time_counter(
), 0, 0); | 233 area = drawPaintTimeDisplay(canvas, layer_tree_impl()->paint_time_counte
r(), 0, 0); |
| 234 // Don't show the FPS display when continuous painting is enabled, because i
t would show misleading numbers. | 234 // Don't show the FPS display when continuous painting is enabled, because i
t would show misleading numbers. |
| 235 else if (debugState.showFPSCounter) | 235 else if (debugState.showFPSCounter) |
| 236 area = drawFPSDisplay(canvas, layerTreeImpl()->frame_rate_counter(), 0,
0); | 236 area = drawFPSDisplay(canvas, layer_tree_impl()->frame_rate_counter(), 0
, 0); |
| 237 | 237 |
| 238 if (debugState.showMemoryStats()) | 238 if (debugState.showMemoryStats()) |
| 239 drawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 15
0)); | 239 drawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 15
0)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void HeadsUpDisplayLayerImpl::drawText(SkCanvas* canvas, SkPaint* paint, const s
td::string& text, SkPaint::Align align, int size, int x, int y) const | 242 void HeadsUpDisplayLayerImpl::drawText(SkCanvas* canvas, SkPaint* paint, const s
td::string& text, SkPaint::Align align, int size, int x, int y) const |
| 243 { | 243 { |
| 244 const bool antiAlias = paint->isAntiAlias(); | 244 const bool antiAlias = paint->isAntiAlias(); |
| 245 paint->setAntiAlias(true); | 245 paint->setAntiAlias(true); |
| 246 | 246 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 277 canvas->drawLine(bounds.left(), bounds.top() + indicatorTop, bounds.right(),
bounds.top() + indicatorTop, *paint); | 277 canvas->drawLine(bounds.left(), bounds.top() + indicatorTop, bounds.right(),
bounds.top() + indicatorTop, *paint); |
| 278 paint->setXfermode(NULL); | 278 paint->setXfermode(NULL); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void HeadsUpDisplayLayerImpl::drawPlatformLayerTree(SkCanvas* canvas) const | 281 void HeadsUpDisplayLayerImpl::drawPlatformLayerTree(SkCanvas* canvas) const |
| 282 { | 282 { |
| 283 const int fontHeight = 14; | 283 const int fontHeight = 14; |
| 284 SkPaint paint = createPaint(); | 284 SkPaint paint = createPaint(); |
| 285 drawGraphBackground(canvas, &paint, SkRect::MakeXYWH(0, 0, bounds().width(),
bounds().height())); | 285 drawGraphBackground(canvas, &paint, SkRect::MakeXYWH(0, 0, bounds().width(),
bounds().height())); |
| 286 | 286 |
| 287 std::string layerTree = layerTreeImpl()->layer_tree_as_text(); | 287 std::string layerTree = layer_tree_impl()->layer_tree_as_text(); |
| 288 std::vector<std::string> lines; | 288 std::vector<std::string> lines; |
| 289 base::SplitString(layerTree, '\n', &lines); | 289 base::SplitString(layerTree, '\n', &lines); |
| 290 | 290 |
| 291 paint.setColor(DebugColors::PlatformLayerTreeTextColor()); | 291 paint.setColor(DebugColors::PlatformLayerTreeTextColor()); |
| 292 for (size_t i = 0; i < lines.size() && static_cast<int>(2 + i * fontHeight)
< bounds().height(); ++i) { | 292 for (size_t i = 0; i < lines.size() && static_cast<int>(2 + i * fontHeight)
< bounds().height(); ++i) { |
| 293 drawText(canvas, &paint, lines[i], SkPaint::kLeft_Align, fontHeight, 2,
2 + (i + 1) * fontHeight); | 293 drawText(canvas, &paint, lines[i], SkPaint::kLeft_Align, fontHeight, 2,
2 + (i + 1) * fontHeight); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 SkRect HeadsUpDisplayLayerImpl::drawFPSDisplay(SkCanvas* canvas, const FrameRate
Counter* fpsCounter, int right, int top) const | 297 SkRect HeadsUpDisplayLayerImpl::drawFPSDisplay(SkCanvas* canvas, const FrameRate
Counter* fpsCounter, int right, int top) const |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 drawGraphLines(canvas, &paint, graphBounds, m_paintTimeGraph); | 476 drawGraphLines(canvas, &paint, graphBounds, m_paintTimeGraph); |
| 477 | 477 |
| 478 return area; | 478 return area; |
| 479 } | 479 } |
| 480 | 480 |
| 481 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory*
debugRectHistory) const | 481 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory*
debugRectHistory) const |
| 482 { | 482 { |
| 483 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects(); | 483 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects(); |
| 484 float rectScale = 1 / layerTreeImpl()->device_scale_factor(); | 484 float rectScale = 1 / layer_tree_impl()->device_scale_factor(); |
| 485 SkPaint paint = createPaint(); | 485 SkPaint paint = createPaint(); |
| 486 | 486 |
| 487 canvas->save(); | 487 canvas->save(); |
| 488 canvas->scale(rectScale, rectScale); | 488 canvas->scale(rectScale, rectScale); |
| 489 | 489 |
| 490 for (size_t i = 0; i < debugRects.size(); ++i) { | 490 for (size_t i = 0; i < debugRects.size(); ++i) { |
| 491 SkColor strokeColor = 0; | 491 SkColor strokeColor = 0; |
| 492 SkColor fillColor = 0; | 492 SkColor fillColor = 0; |
| 493 float strokeWidth = 0; | 493 float strokeWidth = 0; |
| 494 | 494 |
| 495 switch (debugRects[i].type) { | 495 switch (debugRects[i].type) { |
| 496 case PaintRectType: | 496 case PaintRectType: |
| 497 strokeColor = DebugColors::PaintRectBorderColor(); | 497 strokeColor = DebugColors::PaintRectBorderColor(); |
| 498 fillColor = DebugColors::PaintRectFillColor(); | 498 fillColor = DebugColors::PaintRectFillColor(); |
| 499 strokeWidth = DebugColors::PaintRectBorderWidth(layerTreeImpl()); | 499 strokeWidth = DebugColors::PaintRectBorderWidth(layer_tree_impl()); |
| 500 break; | 500 break; |
| 501 case PropertyChangedRectType: | 501 case PropertyChangedRectType: |
| 502 strokeColor = DebugColors::PropertyChangedRectBorderColor(); | 502 strokeColor = DebugColors::PropertyChangedRectBorderColor(); |
| 503 fillColor = DebugColors::PropertyChangedRectFillColor(); | 503 fillColor = DebugColors::PropertyChangedRectFillColor(); |
| 504 strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layerTreeI
mpl()); | 504 strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layer_tree
_impl()); |
| 505 break; | 505 break; |
| 506 case SurfaceDamageRectType: | 506 case SurfaceDamageRectType: |
| 507 strokeColor = DebugColors::SurfaceDamageRectBorderColor(); | 507 strokeColor = DebugColors::SurfaceDamageRectBorderColor(); |
| 508 fillColor = DebugColors::SurfaceDamageRectFillColor(); | 508 fillColor = DebugColors::SurfaceDamageRectFillColor(); |
| 509 strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layerTreeImp
l()); | 509 strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layer_tree_i
mpl()); |
| 510 break; | 510 break; |
| 511 case ReplicaScreenSpaceRectType: | 511 case ReplicaScreenSpaceRectType: |
| 512 strokeColor = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor(
); | 512 strokeColor = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor(
); |
| 513 fillColor = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor(); | 513 fillColor = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor(); |
| 514 strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(
layerTreeImpl()); | 514 strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(
layer_tree_impl()); |
| 515 break; | 515 break; |
| 516 case ScreenSpaceRectType: | 516 case ScreenSpaceRectType: |
| 517 strokeColor = DebugColors::ScreenSpaceLayerRectBorderColor(); | 517 strokeColor = DebugColors::ScreenSpaceLayerRectBorderColor(); |
| 518 fillColor = DebugColors::ScreenSpaceLayerRectFillColor(); | 518 fillColor = DebugColors::ScreenSpaceLayerRectFillColor(); |
| 519 strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layerTree
Impl()); | 519 strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layer_tre
e_impl()); |
| 520 break; | 520 break; |
| 521 case OccludingRectType: | 521 case OccludingRectType: |
| 522 strokeColor = DebugColors::OccludingRectBorderColor(); | 522 strokeColor = DebugColors::OccludingRectBorderColor(); |
| 523 fillColor = DebugColors::OccludingRectFillColor(); | 523 fillColor = DebugColors::OccludingRectFillColor(); |
| 524 strokeWidth = DebugColors::OccludingRectBorderWidth(layerTreeImpl())
; | 524 strokeWidth = DebugColors::OccludingRectBorderWidth(layer_tree_impl(
)); |
| 525 break; | 525 break; |
| 526 case NonOccludingRectType: | 526 case NonOccludingRectType: |
| 527 strokeColor = DebugColors::NonOccludingRectBorderColor(); | 527 strokeColor = DebugColors::NonOccludingRectBorderColor(); |
| 528 fillColor = DebugColors::NonOccludingRectFillColor(); | 528 fillColor = DebugColors::NonOccludingRectFillColor(); |
| 529 strokeWidth = DebugColors::NonOccludingRectBorderWidth(layerTreeImpl
()); | 529 strokeWidth = DebugColors::NonOccludingRectBorderWidth(layer_tree_im
pl()); |
| 530 break; | 530 break; |
| 531 } | 531 } |
| 532 | 532 |
| 533 const gfx::RectF& rect = debugRects[i].rect; | 533 const gfx::RectF& rect = debugRects[i].rect; |
| 534 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.
height()); | 534 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.
height()); |
| 535 paint.setColor(fillColor); | 535 paint.setColor(fillColor); |
| 536 paint.setStyle(SkPaint::kFill_Style); | 536 paint.setStyle(SkPaint::kFill_Style); |
| 537 canvas->drawRect(skRect, paint); | 537 canvas->drawRect(skRect, paint); |
| 538 | 538 |
| 539 paint.setColor(strokeColor); | 539 paint.setColor(strokeColor); |
| 540 paint.setStyle(SkPaint::kStroke_Style); | 540 paint.setStyle(SkPaint::kStroke_Style); |
| 541 paint.setStrokeWidth(SkFloatToScalar(strokeWidth)); | 541 paint.setStrokeWidth(SkFloatToScalar(strokeWidth)); |
| 542 canvas->drawRect(skRect, paint); | 542 canvas->drawRect(skRect, paint); |
| 543 } | 543 } |
| 544 | 544 |
| 545 canvas->restore(); | 545 canvas->restore(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 548 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const |
| 549 { | 549 { |
| 550 return "HeadsUpDisplayLayer"; | 550 return "HeadsUpDisplayLayer"; |
| 551 } | 551 } |
| 552 | 552 |
| 553 } // namespace cc | 553 } // namespace cc |
| OLD | NEW |