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

Unified Diff: ui/gfx/skia_util.cc

Issue 11359172: ui: Remove implicit flooring in skia rect conversion methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make root window transform in tests produce an integer result Created 8 years, 1 month 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
« no previous file with comments | « ui/gfx/skia_util.h ('k') | ui/gfx/transform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skia_util.cc
diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc
index af108daf4b08f5e2641a170b1b018a6bb597fd07..5046b6af1f1534faae8ac1d1addd6fc1a3306d7c 100644
--- a/ui/gfx/skia_util.cc
+++ b/ui/gfx/skia_util.cc
@@ -14,6 +14,7 @@
#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 {
@@ -28,17 +29,25 @@ SkIRect RectToSkIRect(const Rect& rect) {
return SkIRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height());
}
-Rect SkRectToRect(const SkRect& rect) {
- return Rect(static_cast<int>(rect.left()),
- static_cast<int>(rect.top()),
- static_cast<int>(rect.width()),
- static_cast<int>(rect.height()));
-}
-
Rect SkIRectToRect(const SkIRect& rect) {
return Rect(rect.x(), rect.y(), rect.width(), rect.height());
}
+SkRect RectFToSkRect(const RectF& rect) {
+ return SkRect::MakeXYWH(SkFloatToScalar(rect.x()),
+ SkFloatToScalar(rect.y()),
+ SkFloatToScalar(rect.width()),
+ SkFloatToScalar(rect.height()));
+}
+
+RectF SkRectToRectF(const SkRect& rect) {
+ return RectF(SkScalarToFloat(rect.x()),
+ SkScalarToFloat(rect.y()),
+ SkScalarToFloat(rect.width()),
+ SkScalarToFloat(rect.height()));
+}
+
+
SkShader* CreateImageRepShader(const gfx::ImageSkiaRep& image_rep,
SkShader::TileMode tile_mode,
const SkMatrix& local_matrix) {
« no previous file with comments | « ui/gfx/skia_util.h ('k') | ui/gfx/transform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698