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

Unified Diff: ui/native_theme/native_theme_base.cc

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 years, 7 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
Index: ui/native_theme/native_theme_base.cc
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc
index d36a2c31faf9dad97f0cc8034b7e9559ec1b82fd..be70a65d5c63abb985059737208e596c650c8e03 100644
--- a/ui/native_theme/native_theme_base.cc
+++ b/ui/native_theme/native_theme_base.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_shader.h"
#include "third_party/skia/include/core/SkPath.h"
@@ -600,11 +601,11 @@ SkRect NativeThemeBase::PaintCheckboxRadioCommon(
SkColor colors[3] = {startEndColors[0], startEndColors[0], startEndColors[1]};
cc::PaintFlags flags;
flags.setAntiAlias(true);
- flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear(
- gradient_bounds, colors, NULL, 3, SkShader::kClamp_TileMode)));
+ flags.setShader(base::MakeUnique<cc::PaintShader>(
+ gradient_bounds, colors, nullptr, 3, SkShader::kClamp_TileMode));
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->drawRoundRect(skrect, borderRadius, borderRadius, flags);
- flags.setShader(NULL);
+ flags.setShader(nullptr);
// Draw the border.
if (state == kHovered)
@@ -681,11 +682,11 @@ void NativeThemeBase::PaintButton(cc::PaintCanvas* canvas,
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
- flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear(
- gradient_bounds, colors, NULL, 2, SkShader::kClamp_TileMode)));
+ flags.setShader(base::MakeUnique<cc::PaintShader>(
+ gradient_bounds, colors, nullptr, 2, SkShader::kClamp_TileMode));
canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), flags);
- flags.setShader(NULL);
+ flags.setShader(nullptr);
if (button.has_border) {
int border_alpha = state == kHovered ? 0x80 : 0x55;

Powered by Google App Engine
This is Rietveld 408576698