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

Side by Side Diff: src/gpu/GrDefaultPathRenderer.cpp

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.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 2011 Google Inc. 2 * Copyright 2011 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 #include "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 target->drawState()->setDefaultVertexAttribs(); 234 target->drawState()->setDefaultVertexAttribs();
235 if (!arg->set(target, maxPts, maxIdxs)) { 235 if (!arg->set(target, maxPts, maxIdxs)) {
236 return false; 236 return false;
237 } 237 }
238 238
239 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices()); 239 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices());
240 uint16_t* idx = idxBase; 240 uint16_t* idx = idxBase;
241 uint16_t subpathIdxStart = 0; 241 uint16_t subpathIdxStart = 0;
242 242
243 GrPoint* base = reinterpret_cast<GrPoint*>(arg->vertices()); 243 GrPoint* base = reinterpret_cast<GrPoint*>(arg->vertices());
244 GrAssert(NULL != base); 244 SkASSERT(NULL != base);
245 GrPoint* vert = base; 245 GrPoint* vert = base;
246 246
247 GrPoint pts[4]; 247 GrPoint pts[4];
248 248
249 bool first = true; 249 bool first = true;
250 int subpath = 0; 250 int subpath = 0;
251 251
252 SkPath::Iter iter(path, false); 252 SkPath::Iter iter(path, false);
253 253
254 for (;;) { 254 for (;;) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 case SkPath::kClose_Verb: 308 case SkPath::kClose_Verb:
309 break; 309 break;
310 case SkPath::kDone_Verb: 310 case SkPath::kDone_Verb:
311 // uint16_t currIdx = (uint16_t) (vert - base); 311 // uint16_t currIdx = (uint16_t) (vert - base);
312 goto FINISHED; 312 goto FINISHED;
313 } 313 }
314 first = false; 314 first = false;
315 } 315 }
316 FINISHED: 316 FINISHED:
317 GrAssert((vert - base) <= maxPts); 317 SkASSERT((vert - base) <= maxPts);
318 GrAssert((idx - idxBase) <= maxIdxs); 318 SkASSERT((idx - idxBase) <= maxIdxs);
319 319
320 *vertexCnt = vert - base; 320 *vertexCnt = vert - base;
321 *indexCnt = idx - idxBase; 321 *indexCnt = idx - idxBase;
322 322
323 } 323 }
324 return true; 324 return true;
325 } 325 }
326 326
327 bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path, 327 bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
328 const SkStrokeRec& stroke, 328 const SkStrokeRec& stroke,
(...skipping 12 matching lines...) Expand all
341 stroke, 341 stroke,
342 tol, 342 tol,
343 target, 343 target,
344 &primType, 344 &primType,
345 &vertexCnt, 345 &vertexCnt,
346 &indexCnt, 346 &indexCnt,
347 &arg)) { 347 &arg)) {
348 return false; 348 return false;
349 } 349 }
350 350
351 GrAssert(NULL != target); 351 SkASSERT(NULL != target);
352 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit); 352 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit);
353 GrDrawState* drawState = target->drawState(); 353 GrDrawState* drawState = target->drawState();
354 bool colorWritesWereDisabled = drawState->isColorWriteDisabled(); 354 bool colorWritesWereDisabled = drawState->isColorWriteDisabled();
355 // face culling doesn't make sense here 355 // face culling doesn't make sense here
356 GrAssert(GrDrawState::kBoth_DrawFace == drawState->getDrawFace()); 356 SkASSERT(GrDrawState::kBoth_DrawFace == drawState->getDrawFace());
357 357
358 int passCount = 0; 358 int passCount = 0;
359 const GrStencilSettings* passes[3]; 359 const GrStencilSettings* passes[3];
360 GrDrawState::DrawFace drawFace[3]; 360 GrDrawState::DrawFace drawFace[3];
361 bool reverse = false; 361 bool reverse = false;
362 bool lastPassIsBounds; 362 bool lastPassIsBounds;
363 363
364 if (stroke.isHairlineStyle()) { 364 if (stroke.isHairlineStyle()) {
365 passCount = 1; 365 passCount = 1;
366 if (stencilOnly) { 366 if (stencilOnly) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 lastPassIsBounds = true; 434 lastPassIsBounds = true;
435 drawFace[passCount-1] = GrDrawState::kBoth_DrawFace; 435 drawFace[passCount-1] = GrDrawState::kBoth_DrawFace;
436 if (reverse) { 436 if (reverse) {
437 passes[passCount-1] = &gInvWindColorPass; 437 passes[passCount-1] = &gInvWindColorPass;
438 } else { 438 } else {
439 passes[passCount-1] = &gWindColorPass; 439 passes[passCount-1] = &gWindColorPass;
440 } 440 }
441 } 441 }
442 break; 442 break;
443 default: 443 default:
444 GrAssert(!"Unknown path fFill!"); 444 SkASSERT(!"Unknown path fFill!");
445 return false; 445 return false;
446 } 446 }
447 } 447 }
448 } 448 }
449 449
450 SkRect devBounds; 450 SkRect devBounds;
451 GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds); 451 GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds);
452 452
453 for (int p = 0; p < passCount; ++p) { 453 for (int p = 0; p < passCount; ++p) {
454 drawState->setDrawFace(drawFace[p]); 454 drawState->setDrawFace(drawFace[p]);
455 if (NULL != passes[p]) { 455 if (NULL != passes[p]) {
456 *drawState->stencil() = *passes[p]; 456 *drawState->stencil() = *passes[p];
457 } 457 }
458 458
459 if (lastPassIsBounds && (p == passCount-1)) { 459 if (lastPassIsBounds && (p == passCount-1)) {
460 if (!colorWritesWereDisabled) { 460 if (!colorWritesWereDisabled) {
461 drawState->disableState(GrDrawState::kNoColorWrites_StateBit); 461 drawState->disableState(GrDrawState::kNoColorWrites_StateBit);
462 } 462 }
463 SkRect bounds; 463 SkRect bounds;
464 GrDrawState::AutoViewMatrixRestore avmr; 464 GrDrawState::AutoViewMatrixRestore avmr;
465 if (reverse) { 465 if (reverse) {
466 GrAssert(NULL != drawState->getRenderTarget()); 466 SkASSERT(NULL != drawState->getRenderTarget());
467 // draw over the dev bounds (which will be the whole dst surface for inv fill). 467 // draw over the dev bounds (which will be the whole dst surface for inv fill).
468 bounds = devBounds; 468 bounds = devBounds;
469 SkMatrix vmi; 469 SkMatrix vmi;
470 // mapRect through persp matrix may not be correct 470 // mapRect through persp matrix may not be correct
471 if (!drawState->getViewMatrix().hasPerspective() && 471 if (!drawState->getViewMatrix().hasPerspective() &&
472 drawState->getViewInverse(&vmi)) { 472 drawState->getViewInverse(&vmi)) {
473 vmi.mapRect(&bounds); 473 vmi.mapRect(&bounds);
474 } else { 474 } else {
475 avmr.setIdentity(drawState); 475 avmr.setIdentity(drawState);
476 } 476 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 bool antiAlias) { 508 bool antiAlias) {
509 return this->internalDrawPath(path, 509 return this->internalDrawPath(path,
510 stroke, 510 stroke,
511 target, 511 target,
512 false); 512 false);
513 } 513 }
514 514
515 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, 515 void GrDefaultPathRenderer::onStencilPath(const SkPath& path,
516 const SkStrokeRec& stroke, 516 const SkStrokeRec& stroke,
517 GrDrawTarget* target) { 517 GrDrawTarget* target) {
518 GrAssert(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 518 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
519 GrAssert(SkPath::kInverseWinding_FillType != path.getFillType()); 519 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
520 this->internalDrawPath(path, stroke, target, true); 520 this->internalDrawPath(path, stroke, target, true);
521 } 521 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698