1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/pathops/SkPathOpsBounds.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +/* 1.5 + * Copyright 2012 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 +#include "SkPathOpsBounds.h" 1.11 +#include "SkPathOpsCubic.h" 1.12 +#include "SkPathOpsLine.h" 1.13 +#include "SkPathOpsQuad.h" 1.14 + 1.15 +void SkPathOpsBounds::setCubicBounds(const SkPoint a[4]) { 1.16 + SkDCubic cubic; 1.17 + cubic.set(a); 1.18 + SkDRect dRect; 1.19 + dRect.setBounds(cubic); 1.20 + set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), 1.21 + SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); 1.22 +} 1.23 + 1.24 +void SkPathOpsBounds::setLineBounds(const SkPoint a[2]) { 1.25 + setPointBounds(a[0]); 1.26 + add(a[1]); 1.27 +} 1.28 + 1.29 +void SkPathOpsBounds::setQuadBounds(const SkPoint a[3]) { 1.30 + SkDQuad quad; 1.31 + quad.set(a); 1.32 + SkDRect dRect; 1.33 + dRect.setBounds(quad); 1.34 + set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), 1.35 + SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); 1.36 +} 1.37 + 1.38 +void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]) = { 1.39 + NULL, 1.40 + &SkPathOpsBounds::setLineBounds, 1.41 + &SkPathOpsBounds::setQuadBounds, 1.42 + &SkPathOpsBounds::setCubicBounds 1.43 +};