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

Unified Diff: include/gpu/GrRect.h

Issue 232563007: Add MakeEmpty to GrIRect16 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrRect.h
===================================================================
--- include/gpu/GrRect.h (revision 14128)
+++ include/gpu/GrRect.h (working copy)
@@ -14,11 +14,19 @@
struct GrIRect16 {
int16_t fLeft, fTop, fRight, fBottom;
+ static GrIRect16 SK_WARN_UNUSED_RESULT MakeEmpty() {
+ GrIRect16 r;
+ r.setEmpty();
+ return r;
+ }
+
int width() const { return fRight - fLeft; }
int height() const { return fBottom - fTop; }
int area() const { return this->width() * this->height(); }
bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
+ void setEmpty() { memset(this, 0, sizeof(*this)); }
+
void set(const SkIRect& r) {
fLeft = SkToS16(r.fLeft);
fTop = SkToS16(r.fTop);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698