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

Unified Diff: include/core/SkRect.h

Issue 2133413002: try to speed-up maprect + round2i + contains (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: and un-move it in gyp Created 4 years, 5 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
« no previous file with comments | « gyp/tools.gyp ('k') | include/private/SkNx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 39cbb330f82b207cd6a508570fe41f1372353590..67080d115acb564f40b205e4dd5a0fd68e2d0724 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -10,6 +10,7 @@
#include "SkPoint.h"
#include "SkSize.h"
+#include "../private/SkNx.h"
struct SkRect;
@@ -869,7 +870,20 @@ public:
this->roundOut(&ir);
return ir;
}
-
+
+ SkIRect round2i() const {
+ SkIRect dst;
+ Sk4s rd = (Sk4s::Load(&fLeft) + Sk4s(0.5)).floor();
+ SkNx_cast<int32_t>(rd).store(&dst.fLeft);
mtklein 2016/07/11 19:43:18 SkIRect dst; SkNx_cast<int32_t>(this->round2s()).s
reed1 2016/07/11 19:46:31 round2s returns SkRect, not Sk4s
+ return dst;
+ }
+
+ SkRect round2s() const {
+ SkRect dst;
+ (Sk4s::Load(&fLeft) + Sk4s(0.5)).floor().store(&dst.fLeft);
mtklein 2016/07/11 19:43:18 It's okay if you like writing this out, but you ca
+ return dst;
+ }
+
/**
* Swap top/bottom or left/right if there are flipped (i.e. if width()
* or height() would have returned a negative value.) This should be called
« no previous file with comments | « gyp/tools.gyp ('k') | include/private/SkNx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698