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

Unified Diff: include/core/SkRect.h

Issue 1970003003: Add bounds to GrShape (Closed) Base URL: https://chromium.googlesource.com/skia.git@grshapeisempty
Patch Set: put back const& Created 4 years, 7 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 | « no previous file | src/gpu/GrShape.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 3ebe099ae6385a2aa7a0fd124f1ccb87cd6ded5c..39cbb330f82b207cd6a508570fe41f1372353590 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -390,10 +390,8 @@ struct SK_API SkIRect {
struct SK_API SkRect {
SkScalar fLeft, fTop, fRight, fBottom;
- static SkRect SK_WARN_UNUSED_RESULT MakeEmpty() {
- SkRect r;
- r.setEmpty();
- return r;
+ static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty() {
+ return SkRect{0, 0, 0, 0};
}
static SkRect SK_WARN_UNUSED_RESULT MakeLargest() {
@@ -506,7 +504,7 @@ struct SK_API SkRect {
/** Set this rectangle to the empty rectangle (0,0,0,0)
*/
- void setEmpty() { memset(this, 0, sizeof(*this)); }
+ void setEmpty() { *this = MakeEmpty(); }
void set(const SkIRect& src) {
fLeft = SkIntToScalar(src.fLeft);
« no previous file with comments | « no previous file | src/gpu/GrShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698