OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GFX_SKIA_UTIL_H_ | 5 #ifndef GFX_SKIA_UTIL_H_ |
6 #define GFX_SKIA_UTIL_H_ | 6 #define GFX_SKIA_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "ui/gfx/skia_util.h" |
10 #include "third_party/skia/include/core/SkRect.h" | 10 // TODO(sail): remove this file once all includes have been updated. |
11 | |
12 class SkBitmap; | |
13 class SkShader; | |
14 | |
15 namespace gfx { | |
16 | |
17 class Rect; | |
18 | |
19 // Convert between Skia and gfx rect types. | |
20 SkRect RectToSkRect(const gfx::Rect& rect); | |
21 gfx::Rect SkRectToRect(const SkRect& rect); | |
22 | |
23 // Creates a vertical gradient shader. The caller owns the shader. | |
24 // Example usage to avoid leaks: | |
25 // SkSafeUnref(paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))); | |
26 // | |
27 // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will | |
28 // handle the NULL case.) | |
29 SkShader* CreateGradientShader(int start_point, | |
30 int end_point, | |
31 SkColor start_color, | |
32 SkColor end_color); | |
33 | |
34 // Returns true if the two bitmaps contain the same pixels. | |
35 bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2); | |
36 | |
37 } // namespace gfx; | |
38 | 11 |
39 #endif // GFX_SKIA_UTIL_H_ | 12 #endif // GFX_SKIA_UTIL_H_ |
OLD | NEW |