From f81401763e2faed6f3af0552ae904edda1864684 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 5 Apr 2011 20:05:56 +0000 Subject: [PATCH] add rect.inset(dx, dy) git-svn-id: http://skia.googlecode.com/svn/trunk@1058 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/include/GrRect.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gpu/include/GrRect.h b/gpu/include/GrRect.h index 552fa5e58c..67e366c3bf 100644 --- a/gpu/include/GrRect.h +++ b/gpu/include/GrRect.h @@ -232,6 +232,15 @@ struct GrRect { fRight += tx; fBottom += ty; } + /** + * Inset the rectangle by dx,dy. If dx > 0 the rect becomes narrower, + * if dx < 0 the rect becomes wider. + */ + void inset(GrScalar dx, GrScalar dy) { + fLeft += dx; fTop += dy; + fRight -= dx; fBottom -= dy; + } + /** * Initialize a rectangle to a point. * @param pt the point used to initialize the rectangle.