Home | History | Annotate | Download | only in gpu
      1 
      2 /*
      3  * Copyright 2010 Google Inc.
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 
     10 
     11 #ifndef GrRect_DEFINED
     12 #define GrRect_DEFINED
     13 
     14 #include "GrPoint.h"
     15 #include "SkRect.h"
     16 
     17 typedef SkIRect GrIRect;
     18 typedef SkRect  GrRect;
     19 
     20 struct GrIRect16 {
     21     int16_t fLeft, fTop, fRight, fBottom;
     22 
     23     int width() const { return fRight - fLeft; }
     24     int height() const { return fBottom - fTop; }
     25     int area() const { return this->width() * this->height(); }
     26     bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
     27 
     28     void set(const GrIRect& r) {
     29         fLeft   = SkToS16(r.fLeft);
     30         fTop    = SkToS16(r.fTop);
     31         fRight  = SkToS16(r.fRight);
     32         fBottom = SkToS16(r.fBottom);
     33     }
     34 };
     35 
     36 #endif
     37 
     38