180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2010 Google Inc. 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "GrClipData.h" 958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "GrSurface.h" 1158190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#include "SkRect.h" 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/////////////////////////////////////////////////////////////////////////////// 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/** 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * getConservativeBounds returns the conservative bounding box of the clip 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * in device (as opposed to canvas) coordinates. If the bounding box is 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * the result of purely intersections of rects (with an initial replace) 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * isIntersectionOfRects will be set to true. 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruvoid GrClipData::getConservativeBounds(const GrSurface* surface, 2258190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger SkIRect* devResult, 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool* isIntersectionOfRects) const { 2458190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger SkRect devBounds; 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fClipStack->getConservativeBounds(-fOrigin.fX, 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru -fOrigin.fY, 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru surface->width(), 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru surface->height(), 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru &devBounds, 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru isIntersectionOfRects); 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru devBounds.roundOut(devResult); 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 35