• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
widthGrIRect1623     int width() const { return fRight - fLeft; }
heightGrIRect1624     int height() const { return fBottom - fTop; }
areaGrIRect1625     int area() const { return this->width() * this->height(); }
isEmptyGrIRect1626     bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
27 
setGrIRect1628     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