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

Side by Side Diff: include/private/SkPathPriv.h

Issue 1213093004: Revert "Move headers used by headers in include/ to include/private." (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 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 | « include/private/SkMiniRecorder.h ('k') | include/private/SkRecords.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 2015 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 #ifndef SkPathPriv_DEFINED
9 #define SkPathPriv_DEFINED
10
11 #include "SkPath.h"
12
13 class SkPathPriv {
14 public:
15 enum FirstDirection {
16 kCW_FirstDirection, // == SkPath::kCW_Direction
17 kCCW_FirstDirection, // == SkPath::kCCW_Direction
18 kUnknown_FirstDirection,
19 };
20
21 static FirstDirection AsFirstDirection(SkPath::Direction dir) {
22 // since we agree numerically for the values in Direction, we can just c ast.
23 return (FirstDirection)dir;
24 }
25
26 /**
27 * Return the opposite of the specified direction. kUnknown is its own
28 * opposite.
29 */
30 static FirstDirection OppositeFirstDirection(FirstDirection dir) {
31 static const FirstDirection gOppositeDir[] = {
32 kCCW_FirstDirection, kCW_FirstDirection, kUnknown_FirstDirection,
33 };
34 return gOppositeDir[dir];
35 }
36
37 /**
38 * Tries to quickly compute the direction of the first non-degenerate
39 * contour. If it can be computed, return true and set dir to that
40 * direction. If it cannot be (quickly) determined, return false and ignore
41 * the dir parameter. If the direction was determined, it is cached to make
42 * subsequent calls return quickly.
43 */
44 static bool CheapComputeFirstDirection(const SkPath&, FirstDirection* dir);
45
46 /**
47 * Returns true if the path's direction can be computed via
48 * cheapComputDirection() and if that computed direction matches the
49 * specified direction. If dir is kUnknown, returns true if the direction
50 * cannot be computed.
51 */
52 static bool CheapIsFirstDirection(const SkPath& path, FirstDirection dir) {
53 FirstDirection computedDir = kUnknown_FirstDirection;
54 (void)CheapComputeFirstDirection(path, &computedDir);
55 return computedDir == dir;
56 }
57
58 static bool LastVerbIsClose(const SkPath& path) {
59 int count = path.countVerbs();
60 return count >= 1 && path.fPathRef->verbs()[~(count - 1)] == SkPath::Ver b::kClose_Verb;
61 }
62 };
63
64 #endif
OLDNEW
« no previous file with comments | « include/private/SkMiniRecorder.h ('k') | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698