summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'skia/ext/skia_utils.cc')
-rw-r--r--skia/ext/skia_utils.cc26
1 files changed, 26 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
+