aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrClipData.cpp
blob: ce9dcdf44f7172f963e5ecd660d9ec8dec816cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

/*
 * Copyright 2010 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrClipData.h"
#include "GrSurface.h"
#include "GrRect.h"

///////////////////////////////////////////////////////////////////////////////

/**
 * getConservativeBounds returns the conservative bounding box of the clip
 * in device (as opposed to canvas) coordinates. If the bounding box is
 * the result of purely intersections of rects (with an initial replace)
 * isIntersectionOfRects will be set to true.
 */
void GrClipData::getConservativeBounds(const GrSurface* surface,
                                       GrIRect* devResult,
                                       bool* isIntersectionOfRects) const {
    GrRect devBounds;

    fClipStack->getConservativeBounds(-fOrigin.fX,
                                      -fOrigin.fY,
                                      surface->width(),
                                      surface->height(),
                                      &devBounds,
                                      isIntersectionOfRects);

    devBounds.roundOut(devResult);
}