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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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 | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.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 * 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 target->drawState()->setDefaultVertexAttribs(); 233 target->drawState()->setDefaultVertexAttribs();
234 if (!arg->set(target, maxPts, maxIdxs)) { 234 if (!arg->set(target, maxPts, maxIdxs)) {
235 return false; 235 return false;
236 } 236 }
237 237
238 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices()); 238 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices());
239 uint16_t* idx = idxBase; 239 uint16_t* idx = idxBase;
240 uint16_t subpathIdxStart = 0; 240 uint16_t subpathIdxStart = 0;
241 241
242 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices()); 242 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices());
243 SkASSERT(NULL != base); 243 SkASSERT(base);
244 SkPoint* vert = base; 244 SkPoint* vert = base;
245 245
246 SkPoint pts[4]; 246 SkPoint pts[4];
247 247
248 bool first = true; 248 bool first = true;
249 int subpath = 0; 249 int subpath = 0;
250 250
251 SkPath::Iter iter(path, false); 251 SkPath::Iter iter(path, false);
252 252
253 for (;;) { 253 for (;;) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 *stroke, 354 *stroke,
355 tol, 355 tol,
356 target, 356 target,
357 &primType, 357 &primType,
358 &vertexCnt, 358 &vertexCnt,
359 &indexCnt, 359 &indexCnt,
360 &arg)) { 360 &arg)) {
361 return false; 361 return false;
362 } 362 }
363 363
364 SkASSERT(NULL != target); 364 SkASSERT(target);
365 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit); 365 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit);
366 GrDrawState* drawState = target->drawState(); 366 GrDrawState* drawState = target->drawState();
367 bool colorWritesWereDisabled = drawState->isColorWriteDisabled(); 367 bool colorWritesWereDisabled = drawState->isColorWriteDisabled();
368 // face culling doesn't make sense here 368 // face culling doesn't make sense here
369 SkASSERT(GrDrawState::kBoth_DrawFace == drawState->getDrawFace()); 369 SkASSERT(GrDrawState::kBoth_DrawFace == drawState->getDrawFace());
370 370
371 int passCount = 0; 371 int passCount = 0;
372 const GrStencilSettings* passes[3]; 372 const GrStencilSettings* passes[3];
373 GrDrawState::DrawFace drawFace[3]; 373 GrDrawState::DrawFace drawFace[3];
374 bool reverse = false; 374 bool reverse = false;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return false; 458 return false;
459 } 459 }
460 } 460 }
461 } 461 }
462 462
463 SkRect devBounds; 463 SkRect devBounds;
464 GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds); 464 GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds);
465 465
466 for (int p = 0; p < passCount; ++p) { 466 for (int p = 0; p < passCount; ++p) {
467 drawState->setDrawFace(drawFace[p]); 467 drawState->setDrawFace(drawFace[p]);
468 if (NULL != passes[p]) { 468 if (passes[p]) {
469 *drawState->stencil() = *passes[p]; 469 *drawState->stencil() = *passes[p];
470 } 470 }
471 471
472 if (lastPassIsBounds && (p == passCount-1)) { 472 if (lastPassIsBounds && (p == passCount-1)) {
473 if (!colorWritesWereDisabled) { 473 if (!colorWritesWereDisabled) {
474 drawState->disableState(GrDrawState::kNoColorWrites_StateBit); 474 drawState->disableState(GrDrawState::kNoColorWrites_StateBit);
475 } 475 }
476 SkRect bounds; 476 SkRect bounds;
477 GrDrawState::AutoViewMatrixRestore avmr; 477 GrDrawState::AutoViewMatrixRestore avmr;
478 if (reverse) { 478 if (reverse) {
479 SkASSERT(NULL != drawState->getRenderTarget()); 479 SkASSERT(drawState->getRenderTarget());
480 // draw over the dev bounds (which will be the whole dst surface for inv fill). 480 // draw over the dev bounds (which will be the whole dst surface for inv fill).
481 bounds = devBounds; 481 bounds = devBounds;
482 SkMatrix vmi; 482 SkMatrix vmi;
483 // mapRect through persp matrix may not be correct 483 // mapRect through persp matrix may not be correct
484 if (!drawState->getViewMatrix().hasPerspective() && 484 if (!drawState->getViewMatrix().hasPerspective() &&
485 drawState->getViewInverse(&vmi)) { 485 drawState->getViewInverse(&vmi)) {
486 vmi.mapRect(&bounds); 486 vmi.mapRect(&bounds);
487 } else { 487 } else {
488 avmr.setIdentity(drawState); 488 avmr.setIdentity(drawState);
489 } 489 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 false); 528 false);
529 } 529 }
530 530
531 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, 531 void GrDefaultPathRenderer::onStencilPath(const SkPath& path,
532 const SkStrokeRec& stroke, 532 const SkStrokeRec& stroke,
533 GrDrawTarget* target) { 533 GrDrawTarget* target) {
534 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 534 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
535 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 535 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
536 this->internalDrawPath(path, stroke, target, true); 536 this->internalDrawPath(path, stroke, target, true);
537 } 537 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698