summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/sad_tab_view.cc
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 21:28:33 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 21:28:33 +0000
commit05b7f994c66470750905eabb12acf1643099f9b7 (patch)
treed9411a629dfb1e8dc4885374d5f788bcff47ea86 /chrome/browser/views/sad_tab_view.cc
parent9ed68c36cad4f5d70a378be96d303710053eed65 (diff)
downloadchromium_src-05b7f994c66470750905eabb12acf1643099f9b7.zip
chromium_src-05b7f994c66470750905eabb12acf1643099f9b7.tar.gz
chromium_src-05b7f994c66470750905eabb12acf1643099f9b7.tar.bz2
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
Diffstat (limited to 'chrome/browser/views/sad_tab_view.cc')
-rw-r--r--chrome/browser/views/sad_tab_view.cc16
1 files changed, 4 insertions, 12 deletions
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()),