michael@0: /* michael@0: * Copyright 2010 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrRect_DEFINED michael@0: #define GrRect_DEFINED michael@0: michael@0: #include "SkTypes.h" michael@0: #include "SkRect.h" michael@0: michael@0: struct GrIRect16 { michael@0: int16_t fLeft, fTop, fRight, fBottom; michael@0: michael@0: int width() const { return fRight - fLeft; } michael@0: int height() const { return fBottom - fTop; } michael@0: int area() const { return this->width() * this->height(); } michael@0: bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } michael@0: michael@0: void set(const SkIRect& r) { michael@0: fLeft = SkToS16(r.fLeft); michael@0: fTop = SkToS16(r.fTop); michael@0: fRight = SkToS16(r.fRight); michael@0: fBottom = SkToS16(r.fBottom); michael@0: } michael@0: }; michael@0: michael@0: #endif