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

Side by Side Diff: include/core/SkPatch.h

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added array constructor for FwDCubicEvaluator Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPatch_DEFINED 8 #ifndef SkPatch_DEFINED
9 #define SkPatch_DEFINED 9 #define SkPatch_DEFINED
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 }; 69 };
70 70
71 /** 71 /**
72 * Points are in the following order: 72 * Points are in the following order:
73 * (top curve) 73 * (top curve)
74 * 0 1 2 3 74 * 0 1 2 3
75 * (left curve) 11 4 (right curve) 75 * (left curve) 11 4 (right curve)
76 * 10 5 76 * 10 5
77 * 9 8 7 6 77 * 9 8 7 6
78 * (bottom curve) 78 * (bottom curve)
79 * Used pointer to an array to guarantee that this method receives an array of 4 SkColors
80 */ 79 */
81 SkPatch(SkPoint points[12], SkColor colors[4]); 80 SkPatch(SkPoint points[12], SkColor colors[4]);
82 81
83 /** 82 /**
84 * Function that evaluates the coons patch interpolation. 83 * Function that evaluates the coons patch interpolation.
85 * data refers to the pointer of the PatchData struct in which the tessellat ion data is set. 84 * data refers to the pointer of the PatchData struct in which the tessellat ion data is set.
86 * divisions defines the number of steps in which the SkPatch is going to be subdivided per 85 * lod refers the level of detail for each axis.
87 * axis.
88 */ 86 */
89 bool getVertexData(SkPatch::VertexData* data, int divisions); 87 bool getVertexData(SkPatch::VertexData* data, int lodX, int lodY) const;
90 88
91 void getTopPoints(SkPoint points[4]) { 89 void getTopPoints(SkPoint points[4]) const {
92 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts]; 90 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts];
93 points[1] = fCtrlPoints[kTopP1_CubicCtrlPts]; 91 points[1] = fCtrlPoints[kTopP1_CubicCtrlPts];
94 points[2] = fCtrlPoints[kTopP2_CubicCtrlPts]; 92 points[2] = fCtrlPoints[kTopP2_CubicCtrlPts];
95 points[3] = fCtrlPoints[kTopP3_CubicCtrlPts]; 93 points[3] = fCtrlPoints[kTopP3_CubicCtrlPts];
96 } 94 }
97 95
98 void getBottomPoints(SkPoint points[4]) { 96 void getBottomPoints(SkPoint points[4]) const {
99 points[0] = fCtrlPoints[kBottomP0_CubicCtrlPts]; 97 points[0] = fCtrlPoints[kBottomP0_CubicCtrlPts];
100 points[1] = fCtrlPoints[kBottomP1_CubicCtrlPts]; 98 points[1] = fCtrlPoints[kBottomP1_CubicCtrlPts];
101 points[2] = fCtrlPoints[kBottomP2_CubicCtrlPts]; 99 points[2] = fCtrlPoints[kBottomP2_CubicCtrlPts];
102 points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts]; 100 points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts];
103 } 101 }
104 102
105 void getLeftPoints(SkPoint points[4]) { 103 void getLeftPoints(SkPoint points[4]) const {
106 points[0] = fCtrlPoints[kLeftP0_CubicCtrlPts]; 104 points[0] = fCtrlPoints[kLeftP0_CubicCtrlPts];
107 points[1] = fCtrlPoints[kLeftP1_CubicCtrlPts]; 105 points[1] = fCtrlPoints[kLeftP1_CubicCtrlPts];
108 points[2] = fCtrlPoints[kLeftP2_CubicCtrlPts]; 106 points[2] = fCtrlPoints[kLeftP2_CubicCtrlPts];
109 points[3] = fCtrlPoints[kLeftP3_CubicCtrlPts]; 107 points[3] = fCtrlPoints[kLeftP3_CubicCtrlPts];
110 } 108 }
111 109
112 void getRightPoints(SkPoint points[4]) { 110 void getRightPoints(SkPoint points[4]) const {
113 points[0] = fCtrlPoints[kRightP0_CubicCtrlPts]; 111 points[0] = fCtrlPoints[kRightP0_CubicCtrlPts];
114 points[1] = fCtrlPoints[kRightP1_CubicCtrlPts]; 112 points[1] = fCtrlPoints[kRightP1_CubicCtrlPts];
115 points[2] = fCtrlPoints[kRightP2_CubicCtrlPts]; 113 points[2] = fCtrlPoints[kRightP2_CubicCtrlPts];
116 points[3] = fCtrlPoints[kRightP3_CubicCtrlPts]; 114 points[3] = fCtrlPoints[kRightP3_CubicCtrlPts];
117 } 115 }
118 116
117 void getCornerPoints(SkPoint points[4]) const {
118 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts];
119 points[1] = fCtrlPoints[kTopP3_CubicCtrlPts];
120 points[2] = fCtrlPoints[kBottomP3_CubicCtrlPts];
121 points[3] = fCtrlPoints[kBottomP0_CubicCtrlPts];
122 }
123
124 const SkPoint* getControlPoints() const {
125 return fCtrlPoints;
126 }
127
128 const SkColor* getColors() const {
129 return fCornerColors;
130 }
131
119 private: 132 private:
120 SkPoint fCtrlPoints[12]; 133 SkPoint fCtrlPoints[12];
121 SkPMColor fCornerColors[4]; 134 SkPMColor fCornerColors[4];
122 }; 135 };
123 136
124 #endif 137 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698