| 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 |
| 23 gfx::Rect SkRectToRect(const SkRect& rect) { | 28 gfx::Rect SkRectToRect(const SkRect& rect) { |
| 24 return gfx::Rect(static_cast<int>(rect.fLeft), | 29 return gfx::Rect(static_cast<int>(rect.fLeft), |
| 25 static_cast<int>(rect.fTop), | 30 static_cast<int>(rect.fTop), |
| 26 static_cast<int>(rect.width()), | 31 static_cast<int>(rect.width()), |
| 27 static_cast<int>(rect.height())); | 32 static_cast<int>(rect.height())); |
| 28 } | 33 } |
| 29 | 34 |
| 30 SkShader* CreateGradientShader(int start_point, | 35 SkShader* CreateGradientShader(int start_point, |
| 31 int end_point, | 36 int end_point, |
| 32 SkColor start_color, | 37 SkColor start_color, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 96 |
| 92 if (accelerated_char_pos) | 97 if (accelerated_char_pos) |
| 93 *accelerated_char_pos = last_char_pos; | 98 *accelerated_char_pos = last_char_pos; |
| 94 if (accelerated_char_span) | 99 if (accelerated_char_span) |
| 95 *accelerated_char_span = last_char_span; | 100 *accelerated_char_span = last_char_span; |
| 96 | 101 |
| 97 return accelerator_removed; | 102 return accelerator_removed; |
| 98 } | 103 } |
| 99 | 104 |
| 100 } // namespace gfx | 105 } // namespace gfx |
| OLD | NEW |