blob: 488643d1d17b0e45b492e1c5bccdfee7e73b7a96 [file] [log] [blame]
robertphillips@google.coma2d71482012-08-01 20:08:47 +00001
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#include "GrClipData.h"
10#include "GrSurface.h"
11#include "GrRect.h"
12
13///////////////////////////////////////////////////////////////////////////////
14
15/**
16 * getConservativeBounds returns the conservative bounding box of the clip
17 * in device (as opposed to canvas) coordinates. If the bounding box is
18 * the result of purely intersections of rects (with an initial replace)
19 * isIntersectionOfRects will be set to true.
20 */
21void GrClipData::getConservativeBounds(const GrSurface* surface,
22 GrIRect* devResult,
23 bool* isIntersectionOfRects) const {
24 GrRect devBounds;
25
26 fClipStack->getConservativeBounds(-fOrigin.fX,
27 -fOrigin.fY,
28 surface->width(),
29 surface->height(),
30 &devBounds,
31 isIntersectionOfRects);
32
33 devBounds.roundOut(devResult);
34}
35