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

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

Issue 23440049: Implement stroking a path with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 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/GrDrawTarget.h ('k') | src/gpu/GrGpu.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 9
10 10
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 info.setDevBounds(*devBounds); 510 info.setDevBounds(*devBounds);
511 } 511 }
512 // TODO: We should continue with incorrect blending. 512 // TODO: We should continue with incorrect blending.
513 if (!this->setupDstReadIfNecessary(&info)) { 513 if (!this->setupDstReadIfNecessary(&info)) {
514 return; 514 return;
515 } 515 }
516 this->onDraw(info); 516 this->onDraw(info);
517 } 517 }
518 } 518 }
519 519
520 void GrDrawTarget::stencilPath(const GrPath* path, const SkStrokeRec& stroke, Sk Path::FillType fill) { 520 void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) {
521 // TODO: extract portions of checkDraw that are relevant to path stenciling. 521 // TODO: extract portions of checkDraw that are relevant to path stenciling.
522 SkASSERT(NULL != path); 522 SkASSERT(NULL != path);
523 SkASSERT(this->caps()->pathRenderingSupport()); 523 SkASSERT(this->caps()->pathRenderingSupport());
524 SkASSERT(!stroke.isHairlineStyle());
525 SkASSERT(!SkPath::IsInverseFillType(fill)); 524 SkASSERT(!SkPath::IsInverseFillType(fill));
526 this->onStencilPath(path, stroke, fill); 525 this->onStencilPath(path, fill);
527 } 526 }
528 527
529 void GrDrawTarget::fillPath(const GrPath* path, const SkStrokeRec& stroke, SkPat h::FillType fill) { 528 void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) {
530 // TODO: extract portions of checkDraw that are relevant to path rendering. 529 // TODO: extract portions of checkDraw that are relevant to path rendering.
531 SkASSERT(NULL != path); 530 SkASSERT(NULL != path);
532 SkASSERT(this->caps()->pathRenderingSupport()); 531 SkASSERT(this->caps()->pathRenderingSupport());
533 SkASSERT(!stroke.isHairlineStyle());
534 const GrDrawState* drawState = &getDrawState(); 532 const GrDrawState* drawState = &getDrawState();
535 533
536 SkRect devBounds; 534 SkRect devBounds;
537 if (SkPath::IsInverseFillType(fill)) { 535 if (SkPath::IsInverseFillType(fill)) {
538 devBounds = SkRect::MakeWH(SkIntToScalar(drawState->getRenderTarget()->w idth()), 536 devBounds = SkRect::MakeWH(SkIntToScalar(drawState->getRenderTarget()->w idth()),
539 SkIntToScalar(drawState->getRenderTarget()->h eight())); 537 SkIntToScalar(drawState->getRenderTarget()->h eight()));
540 } else { 538 } else {
541 devBounds = path->getBounds(); 539 devBounds = path->getBounds();
542 } 540 }
543 SkMatrix viewM = drawState->getViewMatrix(); 541 SkMatrix viewM = drawState->getViewMatrix();
544 viewM.mapRect(&devBounds); 542 viewM.mapRect(&devBounds);
545 543
546 GrDeviceCoordTexture dstCopy; 544 GrDeviceCoordTexture dstCopy;
547 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { 545 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) {
548 return; 546 return;
549 } 547 }
550 548
551 this->onFillPath(path, stroke, fill, dstCopy.texture() ? &dstCopy : NULL); 549 this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL);
552 } 550 }
553 551
554 //////////////////////////////////////////////////////////////////////////////// 552 ////////////////////////////////////////////////////////////////////////////////
555 553
556 bool GrDrawTarget::willUseHWAALines() const { 554 bool GrDrawTarget::willUseHWAALines() const {
557 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth 555 // There is a conflict between using smooth lines and our use of premultipli ed alpha. Smooth
558 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when 556 // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when
559 // our alpha is 0xff and tweaking the color for partial coverage is OK 557 // our alpha is 0xff and tweaking the color for partial coverage is OK
560 if (!this->caps()->hwAALineSupport() || 558 if (!this->caps()->hwAALineSupport() ||
561 !this->getDrawState().isHWAntialiasState()) { 559 !this->getDrawState().isHWAntialiasState()) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); 1015 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
1018 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]); 1016 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]);
1019 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); 1017 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
1020 GrPrintf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]); 1018 GrPrintf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]);
1021 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ; 1019 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ;
1022 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]); 1020 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]);
1023 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); 1021 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
1024 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); 1022 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
1025 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); 1023 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
1026 } 1024 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698