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 { |
msarett
2016/07/11 12:50:06
On Intel this disassembles to roundps and cvtt?
T
|
+ SkIRect dst; |
+ Sk4s rd = (Sk4s::Load(&fLeft) + Sk4s(0.5)).floor(); |
msarett
2016/07/11 12:50:06
Why call floor when the cast will floor anyway?
mtklein
2016/07/11 13:39:13
We've got to make sure we're careful to distinguis
|
+ SkNx_cast<int32_t>(rd).store(&dst.fLeft); |
+ return dst; |
+ } |
+ |
+ SkRect round2s() const { |
+ SkRect dst; |
+ (Sk4s::Load(&fLeft) + Sk4s(0.5)).floor().store(&dst.fLeft); |
+ 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 |