Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: src/pathops/SkPathOpsBounds.cpp

Issue 1107353004: align top and bounds computations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up code Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pathops/SkPathOpsBounds.h ('k') | src/pathops/SkPathOpsCommon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 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 #include "SkPathOpsBounds.h"
8 #include "SkPathOpsConic.h"
9 #include "SkPathOpsCubic.h"
10 #include "SkPathOpsLine.h"
11 #include "SkPathOpsQuad.h"
12
13 void SkPathOpsBounds::setConicBounds(const SkPoint a[3], SkScalar weight) {
14 SkDConic conic;
15 conic.set(a, weight);
16 SkDRect dRect;
17 dRect.setBounds(conic);
18 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
19 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
20 }
21
22 void SkPathOpsBounds::setCubicBounds(const SkPoint a[4], SkScalar ) {
23 SkDCubic cubic;
24 cubic.set(a);
25 SkDRect dRect;
26 dRect.setBounds(cubic);
27 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
28 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
29 }
30
31 void SkPathOpsBounds::setLineBounds(const SkPoint a[2], SkScalar ) {
32 setPointBounds(a[0]);
33 add(a[1]);
34 }
35
36 void SkPathOpsBounds::setQuadBounds(const SkPoint a[3], SkScalar ) {
37 SkDQuad quad;
38 quad.set(a);
39 SkDRect dRect;
40 dRect.setBounds(quad);
41 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop),
42 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom));
43 }
44
45 void (SkPathOpsBounds::* const SetCurveBounds[])(const SkPoint[], SkScalar weigh t) = {
46 NULL,
47 &SkPathOpsBounds::setLineBounds,
48 &SkPathOpsBounds::setQuadBounds,
49 &SkPathOpsBounds::setConicBounds,
50 &SkPathOpsBounds::setCubicBounds
51 };
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsBounds.h ('k') | src/pathops/SkPathOpsCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698