blob: 40bdec8877a7f686c34554b88c7746f5949d001c [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 */
commit-bot@chromium.org8ddc26b2014-03-31 17:55:12 +000021void GrClipData::getConservativeBounds(int width, int height,
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,
commit-bot@chromium.org8ddc26b2014-03-31 17:55:12 +000028 width,
29 height,
robertphillips@google.coma2d71482012-08-01 20:08:47 +000030 &devBounds,
31 isIntersectionOfRects);
32
33 devBounds.roundOut(devResult);
34}