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

Side by Side Diff: src/gpu/gl/GrGLPath.cpp

Issue 1760163002: Avoid drawing NVPR DIF text when text size is 0 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comment Created 4 years, 9 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 | « gm/textblobmixedsizes.cpp ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrGLPath.h" 9 #include "GrGLPath.h"
10 #include "GrGLPathRendering.h" 10 #include "GrGLPathRendering.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 GR_GL_ROUND, 72 GR_GL_ROUND,
73 GR_GL_SQUARE 73 GR_GL_SQUARE
74 }; 74 };
75 return gSkCapsToGrGLCaps[cap]; 75 return gSkCapsToGrGLCaps[cap];
76 GR_STATIC_ASSERT(0 == SkPaint::kButt_Cap); 76 GR_STATIC_ASSERT(0 == SkPaint::kButt_Cap);
77 GR_STATIC_ASSERT(1 == SkPaint::kRound_Cap); 77 GR_STATIC_ASSERT(1 == SkPaint::kRound_Cap);
78 GR_STATIC_ASSERT(2 == SkPaint::kSquare_Cap); 78 GR_STATIC_ASSERT(2 == SkPaint::kSquare_Cap);
79 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount); 79 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount);
80 } 80 }
81 81
82 #ifdef SK_DEBUG
83 inline void verify_floats(const float* floats, int count) {
84 for (int i = 0; i < count; ++i) {
85 SkASSERT(!SkScalarIsNaN(SkFloatToScalar(floats[i])));
86 }
87 }
88 #endif
89
82 inline void points_to_coords(const SkPoint points[], size_t first_point, size_t amount, 90 inline void points_to_coords(const SkPoint points[], size_t first_point, size_t amount,
83 GrGLfloat coords[]) { 91 GrGLfloat coords[]) {
84 for (size_t i = 0; i < amount; ++i) { 92 for (size_t i = 0; i < amount; ++i) {
85 coords[i * 2] = SkScalarToFloat(points[first_point + i].fX); 93 coords[i * 2] = SkScalarToFloat(points[first_point + i].fX);
86 coords[i * 2 + 1] = SkScalarToFloat(points[first_point + i].fY); 94 coords[i * 2 + 1] = SkScalarToFloat(points[first_point + i].fY);
87 } 95 }
88 } 96 }
89 97
90 template<bool checkForDegenerates> 98 template<bool checkForDegenerates>
91 inline bool init_path_object_for_general_path(GrGLGpu* gpu, GrGLuint pathID, 99 inline bool init_path_object_for_general_path(GrGLGpu* gpu, GrGLuint pathID,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // which produces a degenerate segment. 171 // which produces a degenerate segment.
164 return false; 172 return false;
165 } 173 }
166 } 174 }
167 continue; 175 continue;
168 default: 176 default:
169 SkASSERT(false); // Not reached. 177 SkASSERT(false); // Not reached.
170 continue; 178 continue;
171 } 179 }
172 SkDEBUGCODE(numCoords += num_coords(verb)); 180 SkDEBUGCODE(numCoords += num_coords(verb));
181 SkDEBUGCODE(verify_floats(coords, coordsForVerb));
173 pathCoords.push_back_n(coordsForVerb, coords); 182 pathCoords.push_back_n(coordsForVerb, coords);
174 } 183 }
175 SkASSERT(verbCnt == pathCommands.count()); 184 SkASSERT(verbCnt == pathCommands.count());
176 SkASSERT(numCoords == pathCoords.count()); 185 SkASSERT(numCoords == pathCoords.count());
177 186
178 GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, pathCommands.count(), &p athCommands[0], 187 GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, pathCommands.count(), &p athCommands[0],
179 pathCoords.count(), GR_GL_FLOAT, &pathCoords[0])); 188 pathCoords.count(), GR_GL_FLOAT, &pathCoords[0]));
180 return true; 189 return true;
181 } 190 }
182 191
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 skPath.getVerbs(&pathCommands[0], verbCnt); 234 skPath.getVerbs(&pathCommands[0], verbCnt);
226 235
227 SkDEBUGCODE(int verbCoordCnt = 0); 236 SkDEBUGCODE(int verbCoordCnt = 0);
228 for (int i = 0; i < verbCnt; ++i) { 237 for (int i = 0; i < verbCnt; ++i) {
229 SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]); 238 SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]);
230 pathCommands[i] = verb_to_gl_path_cmd(v); 239 pathCommands[i] = verb_to_gl_path_cmd(v);
231 SkDEBUGCODE(verbCoordCnt += num_coords(v)); 240 SkDEBUGCODE(verbCoordCnt += num_coords(v));
232 } 241 }
233 SkASSERT(verbCnt == pathCommands.count()); 242 SkASSERT(verbCnt == pathCommands.count());
234 SkASSERT(verbCoordCnt == pathCoords.count()); 243 SkASSERT(verbCoordCnt == pathCoords.count());
244 SkDEBUGCODE(verify_floats(&pathCoords[0], pathCoords.count()));
235 GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, pathCommands.count() , &pathCommands[0], 245 GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, pathCommands.count() , &pathCommands[0],
236 pathCoords.count(), GR_GL_FL OAT, 246 pathCoords.count(), GR_GL_FL OAT,
237 &pathCoords[0])); 247 &pathCoords[0]));
238 return; 248 return;
239 } 249 }
240 #endif 250 #endif
241 SkAssertResult(init_path_object_for_general_path<false>(gpu, pathID, skPath) ); 251 SkAssertResult(init_path_object_for_general_path<false>(gpu, pathID, skPath) );
242 } 252 }
243 253
244 void GrGLPath::InitPathObjectStroke(GrGLGpu* gpu, GrGLuint pathID, const GrStrok eInfo& stroke) { 254 void GrGLPath::InitPathObjectStroke(GrGLGpu* gpu, GrGLuint pathID, const GrStrok eInfo& stroke) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 340 }
331 341
332 INHERITED::onRelease(); 342 INHERITED::onRelease();
333 } 343 }
334 344
335 void GrGLPath::onAbandon() { 345 void GrGLPath::onAbandon() {
336 fPathID = 0; 346 fPathID = 0;
337 347
338 INHERITED::onAbandon(); 348 INHERITED::onAbandon();
339 } 349 }
OLDNEW
« no previous file with comments | « gm/textblobmixedsizes.cpp ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698