Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: ui/gfx/skia_util.cc

Issue 11275089: SkRect to gfx::Rect type conversions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove unnecessary lines Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698