diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/include/gpu/GrRect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/include/gpu/GrRect.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright 2010 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrRect_DEFINED +#define GrRect_DEFINED + +#include "SkTypes.h" +#include "SkRect.h" + +struct GrIRect16 { + int16_t fLeft, fTop, fRight, fBottom; + + 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 set(const SkIRect& r) { + fLeft = SkToS16(r.fLeft); + fTop = SkToS16(r.fTop); + fRight = SkToS16(r.fRight); + fBottom = SkToS16(r.fBottom); + } +}; + +#endif