gfx/skia/trunk/include/gpu/GrRect.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/gpu/GrRect.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +/*
     1.5 + * Copyright 2010 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef GrRect_DEFINED
    1.12 +#define GrRect_DEFINED
    1.13 +
    1.14 +#include "SkTypes.h"
    1.15 +#include "SkRect.h"
    1.16 +
    1.17 +struct GrIRect16 {
    1.18 +    int16_t fLeft, fTop, fRight, fBottom;
    1.19 +
    1.20 +    int width() const { return fRight - fLeft; }
    1.21 +    int height() const { return fBottom - fTop; }
    1.22 +    int area() const { return this->width() * this->height(); }
    1.23 +    bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
    1.24 +
    1.25 +    void set(const SkIRect& r) {
    1.26 +        fLeft   = SkToS16(r.fLeft);
    1.27 +        fTop    = SkToS16(r.fTop);
    1.28 +        fRight  = SkToS16(r.fRight);
    1.29 +        fBottom = SkToS16(r.fBottom);
    1.30 +    }
    1.31 +};
    1.32 +
    1.33 +#endif

mercurial