From 05b7f994c66470750905eabb12acf1643099f9b7 Mon Sep 17 00:00:00 2001 From: "brettw@google.com" Date: Wed, 3 Dec 2008 21:28:33 +0000 Subject: Split the cross-platform part of skia_utils_win into skia_utils. Use this new function when possible. Add a little documentation. This does not change the Mac build, I'll do that in a separate pass, and the function moved is never used on the mac). Review URL: http://codereview.chromium.org/12917 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6312 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/sad_tab_view.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'chrome/browser/views/sad_tab_view.cc') diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index 7b34bcb..26d7f5f 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -10,6 +10,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "generated_resources.h" +#include "skia/ext/skia_utils.h" #include "skia/include/SkGradientShader.h" static const int kSadTabOffset = -64; @@ -34,20 +35,11 @@ SadTabView::SadTabView() { InitClass(); } -static SkShader* CreateGradientShader(int end_point) { - SkColor grad_colors[2] = { kBackgroundColor, kBackgroundEndColor }; - SkPoint grad_points[2]; - grad_points[0].set(SkIntToScalar(0), SkIntToScalar(0)); - grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point)); - return SkGradientShader::CreateLinear( - grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); -} - void SadTabView::Paint(ChromeCanvas* canvas) { - SkShader* background_shader = CreateGradientShader(height()); SkPaint paint; - paint.setShader(background_shader); - background_shader->unref(); + paint.setShader(gfx::CreateGradientShader(0, height(), + kBackgroundColor, + kBackgroundEndColor))->safeUnref(); paint.setStyle(SkPaint::kFill_Style); canvas->drawRectCoords(0, 0, SkIntToScalar(width()), SkIntToScalar(height()), -- cgit v1.1