diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 22:10:00 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 22:10:00 +0000 |
commit | 811660224acd3f72ee7364668103602089a35f15 (patch) | |
tree | 04ed8bdf317c629164a3ed666091e11317ee0a18 /skia | |
parent | 4bb80764b3e2f3540c5bf8e1bb0efd9b0613e82b (diff) | |
download | chromium_src-811660224acd3f72ee7364668103602089a35f15.zip chromium_src-811660224acd3f72ee7364668103602089a35f15.tar.gz chromium_src-811660224acd3f72ee7364668103602089a35f15.tar.bz2 |
Revert 38828 - Make clicking on side tabs to select them work.
Use a simple round rect for the visual treatment.
Add some rect conversion utils.
http://crbug.com/34509
TEST=none
Review URL: http://codereview.chromium.org/597012
TBR=ben@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/skia_utils.cc | 26 | ||||
-rw-r--r-- | skia/ext/skia_utils.h | 27 | ||||
-rw-r--r-- | skia/skia.gyp | 2 |
3 files changed, 55 insertions, 0 deletions
diff --git a/skia/ext/skia_utils.cc b/skia/ext/skia_utils.cc new file mode 100644 index 0000000..c95054d --- /dev/null +++ b/skia/ext/skia_utils.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "skia/ext/skia_utils.h" +#include "third_party/skia/include/core/SkColorPriv.h" +#include "third_party/skia/include/core/SkShader.h" +#include "third_party/skia/include/effects/SkGradientShader.h" + +namespace skia { + +SkShader* CreateGradientShader(int start_point, + int end_point, + SkColor start_color, + SkColor end_color) { + SkColor grad_colors[2] = { start_color, end_color}; + SkPoint grad_points[2]; + grad_points[0].set(SkIntToScalar(0), SkIntToScalar(start_point)); + grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point)); + + return SkGradientShader::CreateLinear( + grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); +} + +} // namespace skia + diff --git a/skia/ext/skia_utils.h b/skia/ext/skia_utils.h new file mode 100644 index 0000000..52d9d62 --- /dev/null +++ b/skia/ext/skia_utils.h @@ -0,0 +1,27 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SKIA_EXT_SKIA_UTILS_H_ +#define SKIA_EXT_SKIA_UTILS_H_ + +#include "third_party/skia/include/core/SkColor.h" + +class SkShader; + +namespace skia { + +// Creates a vertical gradient shader. The caller owns the shader. +// Example usage to avoid leaks: +// paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))->safeUnref(); +// +// (The old shader in the paint, if any, needs to be freed, and safeUnref will +// handle the NULL case.) +SkShader* CreateGradientShader(int start_point, + int end_point, + SkColor start_color, + SkColor end_color); +} // namespace skia + +#endif // SKIA_EXT_SKIA_UTILS_H_ + diff --git a/skia/skia.gyp b/skia/skia.gyp index 41da282..f279b84 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -522,6 +522,8 @@ 'ext/platform_device_win.cc', 'ext/platform_device_win.h', 'ext/SkMemory_new_handler.cpp', + 'ext/skia_utils.cc', + 'ext/skia_utils.h', 'ext/skia_utils_gtk.cc', 'ext/skia_utils_gtk.h', 'ext/skia_utils_mac.mm', |