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

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: Removed Random Patches in GM 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 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));
robertphillips 2014/08/05 15:42:00 extra line here ?
150
151 }
152
153 void setColors(const SkColor colors[4]) {
154 memcpy(fCornerColors, colors, kNumColors * sizeof(SkColor));
155 }
156
157 void reset(const SkPoint points[12], const SkColor colors[4]) {
158 this->setPoints(points);
159 this->setColors(colors);
160 }
161
162 /**
163 * Write the patch to the buffer, and return the number of bytes written.
164 * If buffer is NULL, it still returns the number of bytes.
165 */
166 size_t writeToMemory(void* buffer) const;
167
168 /**
169 * Initializes the patch from the buffer
170 *
171 * buffer Memory to read from
172 * length Amount of memory available in the buffer
robertphillips 2014/08/05 15:42:00 Should the rest of this comment not be: * Returns
dandov 2014/08/05 17:34:05 Done. Fixed function to follow the comment.
173 * returns the number of bytes read
174 * number of bytes read (must be a multiple of 4) or
175 * 0 if there was not enough memory available
176 */
177 size_t readFromMemory(const void* buffer, size_t length);
178
141 private: 179 private:
142 SkPoint fCtrlPoints[12]; 180 SkPoint fCtrlPoints[kNumCtrlPts];
143 SkColor fCornerColors[4]; 181 SkColor fCornerColors[kNumColors];
144 }; 182 };
145 183
146 #endif 184 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698