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

Unified Diff: ui/views/style/mac/dialog_button_border_mac.cc

Issue 1831883002: Use sk_sp-based shader creation APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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/style/mac/combobox_background_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/style/mac/dialog_button_border_mac.cc
diff --git a/ui/views/style/mac/dialog_button_border_mac.cc b/ui/views/style/mac/dialog_button_border_mac.cc
index 24cedaec8cb19ee46e5d0016ba419e48a124323d..f9eadf4743b22fd599e0f2fd04523f90f7e7d540 100644
--- a/ui/views/style/mac/dialog_button_border_mac.cc
+++ b/ui/views/style/mac/dialog_button_border_mac.cc
@@ -38,8 +38,8 @@ const double kInnerShadowBlurRadius = 2.0;
const int kPaddingX = 14;
const int kPaddingY = 4;
-skia::RefPtr<SkShader> GetButtonGradient(int height,
- Button::ButtonState state) {
+sk_sp<SkShader> CreateButtonGradient(int height,
+ Button::ButtonState state) {
ColorByState start = {0xFFF0F0F0, 0xFFF4F4F4, 0xFFEBEBEB, 0xFFEDEDED};
ColorByState end = {0xFFE0E0E0, 0xFFE4E4E4, 0xFFDBDBDB, 0xFFDEDEDE};
@@ -50,11 +50,9 @@ skia::RefPtr<SkShader> GetButtonGradient(int height,
SkColor gradient_colors[] = {start[state], start[state], end[state]};
SkScalar gradient_positions[] = {0.0, 0.38, 1.0};
- skia::RefPtr<SkShader> gradient_shader =
- skia::AdoptRef(SkGradientShader::CreateLinear(
+ return SkGradientShader::MakeLinear(
gradient_points, gradient_colors, gradient_positions, 3,
- SkShader::kClamp_TileMode));
- return gradient_shader;
+ SkShader::kClamp_TileMode);
}
void DrawConstrainedButtonBackground(const SkRect& button_rect,
@@ -78,9 +76,7 @@ void DrawConstrainedButtonBackground(const SkRect& button_rect,
paint.setLooper(looper.get());
// Background.
- skia::RefPtr<SkShader> gradient_shader =
- GetButtonGradient(rect.height(), button_state);
- paint.setShader(gradient_shader.get());
+ paint.setShader(CreateButtonGradient(rect.height(), button_state));
paint.setStyle(SkPaint::kFill_Style);
paint.setFlags(SkPaint::kAntiAlias_Flag);
canvas->drawRoundRect(rect, kCornerRadius, kCornerRadius, paint);
« no previous file with comments | « ui/views/style/mac/combobox_background_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698