OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/skia_util.h" | 5 #include "ui/gfx/skia_util.h" |
6 | 6 |
7 #include "base/i18n/char_iterator.h" | 7 #include "base/i18n/char_iterator.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkColorPriv.h" | 9 #include "third_party/skia/include/core/SkColorPriv.h" |
10 #include "third_party/skia/include/core/SkShader.h" | 10 #include "third_party/skia/include/core/SkShader.h" |
11 #include "third_party/skia/include/effects/SkGradientShader.h" | 11 #include "third_party/skia/include/effects/SkGradientShader.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 SkRect RectToSkRect(const gfx::Rect& rect) { | 16 SkRect RectToSkRect(const gfx::Rect& rect) { |
17 SkRect r; | 17 SkRect r; |
18 r.set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y()), | 18 r.set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y()), |
19 SkIntToScalar(rect.right()), SkIntToScalar(rect.bottom())); | 19 SkIntToScalar(rect.right()), SkIntToScalar(rect.bottom())); |
20 return r; | 20 return r; |
21 } | 21 } |
22 | 22 |
23 SkIRect RectToSkIRect(const gfx::Rect& rect) { | |
24 SkIRect r = { rect.x(), rect.y(), rect.right(), rect.bottom() }; | |
25 return r; | |
26 } | |
27 | |
28 gfx::Rect SkRectToRect(const SkRect& rect) { | 23 gfx::Rect SkRectToRect(const SkRect& rect) { |
29 return gfx::Rect(static_cast<int>(rect.fLeft), | 24 return gfx::Rect(static_cast<int>(rect.fLeft), |
30 static_cast<int>(rect.fTop), | 25 static_cast<int>(rect.fTop), |
31 static_cast<int>(rect.width()), | 26 static_cast<int>(rect.width()), |
32 static_cast<int>(rect.height())); | 27 static_cast<int>(rect.height())); |
33 } | 28 } |
34 | 29 |
35 SkShader* CreateGradientShader(int start_point, | 30 SkShader* CreateGradientShader(int start_point, |
36 int end_point, | 31 int end_point, |
37 SkColor start_color, | 32 SkColor start_color, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 91 |
97 if (accelerated_char_pos) | 92 if (accelerated_char_pos) |
98 *accelerated_char_pos = last_char_pos; | 93 *accelerated_char_pos = last_char_pos; |
99 if (accelerated_char_span) | 94 if (accelerated_char_span) |
100 *accelerated_char_span = last_char_span; | 95 *accelerated_char_span = last_char_span; |
101 | 96 |
102 return accelerator_removed; | 97 return accelerator_removed; |
103 } | 98 } |
104 | 99 |
105 } // namespace gfx | 100 } // namespace gfx |
OLD | NEW |