| OLD | NEW |
| 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 "chrome/common/icon_with_badge_image_source.h" | 5 #include "chrome/common/icon_with_badge_image_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/common/badge_util.h" | 9 #include "chrome/common/badge_util.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/image/image_skia_operations.h" | 12 #include "ui/gfx/image/image_skia_operations.h" |
| 13 | 13 |
| 14 IconWithBadgeImageSource::Badge::Badge(std::string text, | 14 IconWithBadgeImageSource::Badge::Badge(const std::string& text, |
| 15 SkColor text_color, | 15 SkColor text_color, |
| 16 SkColor background_color) | 16 SkColor background_color) |
| 17 : text(text), text_color(text_color), background_color(background_color) { | 17 : text(text), text_color(text_color), background_color(background_color) {} |
| 18 } | |
| 19 | 18 |
| 20 IconWithBadgeImageSource::Badge::~Badge() {} | 19 IconWithBadgeImageSource::Badge::~Badge() {} |
| 21 | 20 |
| 22 IconWithBadgeImageSource::IconWithBadgeImageSource(const gfx::Size& size) | 21 IconWithBadgeImageSource::IconWithBadgeImageSource(const gfx::Size& size) |
| 23 : gfx::CanvasImageSource(size, false), | 22 : gfx::CanvasImageSource(size, false), |
| 24 grayscale_(false), | 23 grayscale_(false), |
| 25 paint_decoration_(false) { | 24 paint_decoration_(false) { |
| 26 } | 25 } |
| 27 | 26 |
| 28 IconWithBadgeImageSource::~IconWithBadgeImageSource() { | 27 IconWithBadgeImageSource::~IconWithBadgeImageSource() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 72 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 74 canvas->DrawCircle(center_point, | 73 canvas->DrawCircle(center_point, |
| 75 major_radius, | 74 major_radius, |
| 76 paint); | 75 paint); |
| 77 paint.setColor(decoration_color); | 76 paint.setColor(decoration_color); |
| 78 canvas->DrawCircle(center_point, | 77 canvas->DrawCircle(center_point, |
| 79 minor_radius, | 78 minor_radius, |
| 80 paint); | 79 paint); |
| 81 } | 80 } |
| 82 | 81 |
| OLD | NEW |