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

Unified Diff: ui/views/painter.cc

Issue 2637383003: Change Painter factory functions to unique_ptr (Closed)
Patch Set: msw review Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/painter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/painter.cc
diff --git a/ui/views/painter.cc b/ui/views/painter.cc
index e2ac629c3f116eb891f4a3dcd30a1c874e0c851e..c64a0d71af91500d15b1350e7a26b40c3c893541 100644
--- a/ui/views/painter.cc
+++ b/ui/views/painter.cc
@@ -297,51 +297,42 @@ void Painter::PaintFocusPainter(View* view,
}
// static
-Painter* Painter::CreateSolidRoundRectPainter(SkColor color, float radius) {
- return new SolidRoundRectPainter(color, SK_ColorTRANSPARENT, radius);
+std::unique_ptr<Painter> Painter::CreateSolidRoundRectPainter(SkColor color,
+ float radius) {
+ return base::MakeUnique<SolidRoundRectPainter>(color, SK_ColorTRANSPARENT,
+ radius);
}
// static
-Painter* Painter::CreateRoundRectWith1PxBorderPainter(SkColor bg_color,
- SkColor stroke_color,
- float radius) {
- return new SolidRoundRectPainter(bg_color, stroke_color, radius);
+std::unique_ptr<Painter> Painter::CreateRoundRectWith1PxBorderPainter(
+ SkColor bg_color,
+ SkColor stroke_color,
+ float radius) {
+ return base::MakeUnique<SolidRoundRectPainter>(bg_color, stroke_color,
+ radius);
}
// static
-Painter* Painter::CreateHorizontalGradient(SkColor c1, SkColor c2) {
+std::unique_ptr<Painter> Painter::CreateVerticalGradient(SkColor c1,
+ SkColor c2) {
SkColor colors[2];
colors[0] = c1;
colors[1] = c2;
SkScalar pos[] = {0, 1};
- return new GradientPainter(true, colors, pos, 2);
+ return base::MakeUnique<GradientPainter>(false, colors, pos, 2);
}
// static
-Painter* Painter::CreateVerticalGradient(SkColor c1, SkColor c2) {
- SkColor colors[2];
- colors[0] = c1;
- colors[1] = c2;
- SkScalar pos[] = {0, 1};
- return new GradientPainter(false, colors, pos, 2);
-}
-
-// static
-Painter* Painter::CreateVerticalMultiColorGradient(SkColor* colors,
- SkScalar* pos,
- size_t count) {
- return new GradientPainter(false, colors, pos, count);
-}
-
-// static
-Painter* Painter::CreateImagePainter(const gfx::ImageSkia& image,
- const gfx::Insets& insets) {
- return new ImagePainter(image, insets);
+std::unique_ptr<Painter> Painter::CreateImagePainter(
+ const gfx::ImageSkia& image,
+ const gfx::Insets& insets) {
+ return base::MakeUnique<ImagePainter>(image, insets);
}
// static
-Painter* Painter::CreateImageGridPainter(const int image_ids[]) {
- return new ImagePainter(image_ids);
+std::unique_ptr<Painter> Painter::CreateImageGridPainter(
+ const int image_ids[]) {
+ return base::MakeUnique<ImagePainter>(image_ids);
}
// static
« no previous file with comments | « ui/views/painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698