Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: cc/heads_up_display_layer_impl.cc

Issue 11415208: cc: Fix hudLayer size and paint rects scale for deviceScaleFactor != 1 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 170476 Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/heads_up_display_layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 7 #include <limits>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "cc/debug_colors.h" 10 #include "cc/debug_colors.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 paint.setAntiAlias(true); 304 paint.setAntiAlias(true);
305 paint.setStyle(SkPaint::kStroke_Style); 305 paint.setStyle(SkPaint::kStroke_Style);
306 paint.setStrokeWidth(1); 306 paint.setStrokeWidth(1);
307 307
308 canvas->drawPath(path, paint); 308 canvas->drawPath(path, paint);
309 } 309 }
310 310
311 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory) 311 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory)
312 { 312 {
313 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects(); 313 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects();
314 float rectScale = 1 / layerTreeHostImpl()->deviceScaleFactor();
315
316 canvas->save();
317 canvas->scale(rectScale, rectScale);
314 318
315 for (size_t i = 0; i < debugRects.size(); ++i) { 319 for (size_t i = 0; i < debugRects.size(); ++i) {
316 SkColor strokeColor = 0; 320 SkColor strokeColor = 0;
317 SkColor fillColor = 0; 321 SkColor fillColor = 0;
318 float strokeWidth = 0; 322 float strokeWidth = 0;
319 323
320 switch (debugRects[i].type) { 324 switch (debugRects[i].type) {
321 case PaintRectType: 325 case PaintRectType:
322 strokeColor = DebugColors::PaintRectBorderColor(); 326 strokeColor = DebugColors::PaintRectBorderColor();
323 fillColor = DebugColors::PaintRectFillColor(); 327 fillColor = DebugColors::PaintRectFillColor();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect. height()); 363 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect. height());
360 SkPaint paint = createPaint(); 364 SkPaint paint = createPaint();
361 paint.setColor(fillColor); 365 paint.setColor(fillColor);
362 canvas->drawRect(skRect, paint); 366 canvas->drawRect(skRect, paint);
363 367
364 paint.setColor(strokeColor); 368 paint.setColor(strokeColor);
365 paint.setStyle(SkPaint::kStroke_Style); 369 paint.setStyle(SkPaint::kStroke_Style);
366 paint.setStrokeWidth(SkFloatToScalar(strokeWidth)); 370 paint.setStrokeWidth(SkFloatToScalar(strokeWidth));
367 canvas->drawRect(skRect, paint); 371 canvas->drawRect(skRect, paint);
368 } 372 }
373
374 canvas->restore();
369 } 375 }
370 376
371 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const 377 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const
372 { 378 {
373 return "HeadsUpDisplayLayer"; 379 return "HeadsUpDisplayLayer";
374 } 380 }
375 381
376 } // namespace cc 382 } // namespace cc
OLDNEW
« no previous file with comments | « cc/heads_up_display_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698