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

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

Issue 429343004: Stopped skipping tests in dm of SkPatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Moved DRAW_PATCH DrawType to the last position 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
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkReadBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }; 70 };
71 71
72 // Enum for corner colors also clockwise. 72 // Enum for corner colors also clockwise.
73 enum CornerColors { 73 enum CornerColors {
74 kTopLeft_CornerColors = 0, 74 kTopLeft_CornerColors = 0,
75 kTopRight_CornerColors, 75 kTopRight_CornerColors,
76 kBottomRight_CornerColors, 76 kBottomRight_CornerColors,
77 kBottomLeft_CornerColors 77 kBottomLeft_CornerColors
78 }; 78 };
79 79
80 enum {
81 kNumCtrlPts = 12,
82 kNumColors = 4,
83 kNumPtsCubic = 4
84 };
85
80 /** 86 /**
81 * Points are in the following order: 87 * Points are in the following order:
82 * (top curve) 88 * (top curve)
83 * 0 1 2 3 89 * 0 1 2 3
84 * (left curve) 11 4 (right curve) 90 * (left curve) 11 4 (right curve)
85 * 10 5 91 * 10 5
86 * 9 8 7 6 92 * 9 8 7 6
87 * (bottom curve) 93 * (bottom curve)
88 */ 94 */
89 SkPatch(SkPoint points[12], SkColor colors[4]); 95 SkPatch() { }
96 SkPatch(const SkPoint points[12], const SkColor colors[4]);
90 97
91 /** 98 /**
92 * Function that evaluates the coons patch interpolation. 99 * Function that evaluates the coons patch interpolation.
93 * data refers to the pointer of the PatchData struct in which the tessellat ion data is set. 100 * data refers to the pointer of the PatchData struct in which the tessellat ion data is set.
94 * lod refers the level of detail for each axis. 101 * lod refers the level of detail for each axis.
95 */ 102 */
96 bool getVertexData(SkPatch::VertexData* data, int lodX, int lodY) const; 103 bool getVertexData(SkPatch::VertexData* data, int lodX, int lodY) const;
97 104
98 void getTopPoints(SkPoint points[4]) const { 105 void getTopPoints(SkPoint points[4]) const {
99 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts]; 106 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 138 }
132 139
133 const SkPoint* getControlPoints() const { 140 const SkPoint* getControlPoints() const {
134 return fCtrlPoints; 141 return fCtrlPoints;
135 } 142 }
136 143
137 const SkColor* getColors() const { 144 const SkColor* getColors() const {
138 return fCornerColors; 145 return fCornerColors;
139 } 146 }
140 147
148 void setPoints(const SkPoint points[12]) {
149 memcpy(fCtrlPoints, points, kNumCtrlPts * sizeof(SkPoint));
150 }
151
152 void setColors(const SkColor colors[4]) {
153 memcpy(fCornerColors, colors, kNumColors * sizeof(SkColor));
154 }
155
156 void reset(const SkPoint points[12], const SkColor colors[4]) {
157 this->setPoints(points);
158 this->setColors(colors);
159 }
160
161 /**
162 * Write the patch to the buffer, and return the number of bytes written.
163 * If buffer is NULL, it still returns the number of bytes.
164 */
165 size_t writeToMemory(void* buffer) const;
166
167 /**
168 * Initializes the patch from the buffer
169 *
170 * buffer Memory to read from
171 * length Amount of memory available in the buffer
172 * returns the number of bytes read (must be a multiple of 4) or
173 * 0 if there was not enough memory available
174 */
175 size_t readFromMemory(const void* buffer, size_t length);
176
141 private: 177 private:
142 SkPoint fCtrlPoints[12]; 178 SkPoint fCtrlPoints[kNumCtrlPts];
143 SkColor fCornerColors[4]; 179 SkColor fCornerColors[kNumColors];
144 }; 180 };
145 181
146 #endif 182 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698