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

Side by Side Diff: ui/native_theme/common_theme.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months 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 | « ui/native_theme/common_theme.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/native_theme/common_theme.h" 5 #include "ui/native_theme/common_theme.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/base/resource/resource_bundle.h" 11 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/color_palette.h" 13 #include "ui/gfx/color_palette.h"
13 #include "ui/gfx/color_utils.h" 14 #include "ui/gfx/color_utils.h"
14 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
16 #include "ui/gfx/skia_util.h" 17 #include "ui/gfx/skia_util.h"
17 #include "ui/resources/grit/ui_resources.h" 18 #include "ui/resources/grit/ui_resources.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 429 }
429 if (menu_item.corner_radius > 0) { 430 if (menu_item.corner_radius > 0) {
430 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); 431 const SkScalar radius = SkIntToScalar(menu_item.corner_radius);
431 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); 432 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint);
432 return; 433 return;
433 } 434 }
434 canvas->drawRect(gfx::RectToSkRect(rect), paint); 435 canvas->drawRect(gfx::RectToSkRect(rect), paint);
435 } 436 }
436 437
437 // static 438 // static
438 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { 439 std::unique_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) {
439 // TODO(pkotwicz): Do something better and don't infer device 440 // TODO(pkotwicz): Do something better and don't infer device
440 // scale factor from canvas scale. 441 // scale factor from canvas scale.
441 SkMatrix m = sk_canvas->getTotalMatrix(); 442 SkMatrix m = sk_canvas->getTotalMatrix();
442 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); 443 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX()));
443 return make_scoped_ptr(new gfx::Canvas(skia::SharePtr(sk_canvas), 444 return base::WrapUnique(
444 device_scale)); 445 new gfx::Canvas(skia::SharePtr(sk_canvas), device_scale));
445 } 446 }
446 447
447 } // namespace ui 448 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/common_theme.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698