blob: 106cd30076ca82249f0b3a003209f216811f5030 (
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
35
36
37
38
39
40
|
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkPathOpsBounds.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
void SkPathOpsBounds::setCubicBounds(const SkPoint a[4]) {
SkDCubic cubic;
cubic.set(a);
SkDRect dRect;
dRect.setBounds(cubic);
set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
}
void SkPathOpsBounds::setLineBounds(const SkPoint a[2]) {
setPointBounds(a[0]);
add(a[1]);
}
void SkPathOpsBounds::setQuadBounds(const SkPoint a[3]) {
SkDQuad quad;
quad.set(a);
SkDRect dRect;
dRect.setBounds(quad);
set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
}
void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]) = {
NULL,
&SkPathOpsBounds::setLineBounds,
&SkPathOpsBounds::setQuadBounds,
&SkPathOpsBounds::setCubicBounds
};
|