Chromium Code Reviews| Index: ui/gfx/skia_util.cc |
| diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc |
| index f5d51eae5c4d6f252bf8f4baf9cd5447d332f2d0..b4fd1f3faa6068d94448f1b9cd7785b48fbccc7e 100644 |
| --- a/ui/gfx/skia_util.cc |
| +++ b/ui/gfx/skia_util.cc |
| @@ -14,25 +14,33 @@ |
| #include "third_party/skia/include/effects/SkLayerDrawLooper.h" |
| #include "ui/gfx/image/image_skia_rep.h" |
| #include "ui/gfx/rect.h" |
| +#include "ui/gfx/rect_f.h" |
| #include "ui/gfx/shadow_value.h" |
| namespace gfx { |
| SkRect RectToSkRect(const gfx::Rect& rect) { |
| - SkRect r; |
| - r.iset(rect.x(), rect.y(), rect.right(), rect.bottom()); |
| - return r; |
| + return SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); |
|
tfarina
2012/11/10 20:23:08
I think you can't guarantee that SkScalar is int?
danakj
2012/11/12 20:01:54
Yeh, these parameters need SkIntToScalar()
|
| +} |
| + |
| +SkRect RectFToSkRect(const gfx::RectF& rect) { |
| + return SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); |
|
danakj
2012/11/12 20:01:54
SkIntToScalar() here also.
|
| } |
| SkIRect RectToSkIRect(const gfx::Rect& rect) { |
| return SkIRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); |
| } |
| -gfx::Rect SkRectToRect(const SkRect& rect) { |
| - return gfx::Rect(static_cast<int>(rect.left()), |
| - static_cast<int>(rect.top()), |
| - static_cast<int>(rect.width()), |
| - static_cast<int>(rect.height())); |
| +gfx::Rect SkIRectToRect(const SkIRect& rect) { |
| + return gfx::Rect(rect.x(), rect.y(), rect.width(), rect.height()); |
| +} |
| + |
| +gfx::RectF SkIRectToRectF(const SkIRect& rect) { |
| + return gfx::RectF(rect.x(), rect.y(), rect.width(), rect.height()); |
| +} |
| + |
| +gfx::RectF SkRectToRectF(const SkRect& rect) { |
| + return gfx::RectF(rect.x(), rect.y(), rect.width(), rect.height()); |
|
danakj
2012/11/12 20:01:54
SkScalarToFloat for these parameters.
|
| } |
| SkShader* CreateImageRepShader(const gfx::ImageSkiaRep& image_rep, |