blob: 22b43710f8807a3c50938282b4586571d465b2ed [file] [log] [blame]
robertphillips@google.coma2d71482012-08-01 20:08:47 +00001/*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrClipData.h"
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +00009
robertphillips@google.coma2d71482012-08-01 20:08:47 +000010#include "GrSurface.h"
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000011#include "SkRect.h"
robertphillips@google.coma2d71482012-08-01 20:08:47 +000012
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,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000022 SkIRect* devResult,
robertphillips@google.coma2d71482012-08-01 20:08:47 +000023 bool* isIntersectionOfRects) const {
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +000024 SkRect devBounds;
robertphillips@google.coma2d71482012-08-01 20:08:47 +000025
rmistry@google.comfbfcd562012-08-23 18:09:54 +000026 fClipStack->getConservativeBounds(-fOrigin.fX,
robertphillips@google.coma2d71482012-08-01 20:08:47 +000027 -fOrigin.fY,
28 surface->width(),
29 surface->height(),
30 &devBounds,
31 isIntersectionOfRects);
32
33 devBounds.roundOut(devResult);
34}