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

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

Issue 919683002: Remove canApplyCoverage from XP and all related functions in gpu code. (Closed) Base URL: https://skia.googlesource.com/skia.git@pdDstCopy
Patch Set: Rebase Created 5 years, 10 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/effects/SkArithmeticMode_gpu.h ('k') | src/gpu/GrOvalRenderer.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 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom); 473 SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom);
474 } 474 }
475 475
476 static bool apply_aa_to_rect(GrDrawTarget* target, 476 static bool apply_aa_to_rect(GrDrawTarget* target,
477 GrPipelineBuilder* pipelineBuilder, 477 GrPipelineBuilder* pipelineBuilder,
478 SkRect* devBoundRect, 478 SkRect* devBoundRect,
479 const SkRect& rect, 479 const SkRect& rect,
480 SkScalar strokeWidth, 480 SkScalar strokeWidth,
481 const SkMatrix& combinedMatrix, 481 const SkMatrix& combinedMatrix,
482 GrColor color) { 482 GrColor color) {
483 if (!pipelineBuilder->canTweakAlphaForCoverage() &&
484 !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
485 #ifdef SK_DEBUG
486 //SkDebugf("Turning off AA to correctly apply blend.\n");
487 #endif
488 return false;
489 }
490
491 if (pipelineBuilder->getRenderTarget()->isMultisampled()) { 483 if (pipelineBuilder->getRenderTarget()->isMultisampled()) {
492 return false; 484 return false;
493 } 485 }
494 486
495 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) 487 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT)
496 if (strokeWidth >= 0) { 488 if (strokeWidth >= 0) {
497 #endif 489 #endif
498 if (!combinedMatrix.preservesAxisAlignment()) { 490 if (!combinedMatrix.preservesAxisAlignment()) {
499 return false; 491 return false;
500 } 492 }
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 if (path.isInverseFillType()) { 874 if (path.isInverseFillType()) {
883 return false; 875 return false;
884 } 876 }
885 877
886 // TODO: this restriction could be lifted if we were willing to apply 878 // TODO: this restriction could be lifted if we were willing to apply
887 // the matrix to all the points individually rather than just to the rect 879 // the matrix to all the points individually rather than just to the rect
888 if (!viewMatrix.preservesAxisAlignment()) { 880 if (!viewMatrix.preservesAxisAlignment()) {
889 return false; 881 return false;
890 } 882 }
891 883
892 if (!pipelineBuilder->canTweakAlphaForCoverage() &&
893 !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
894 return false;
895 }
896
897 SkPath::Direction dirs[2]; 884 SkPath::Direction dirs[2];
898 if (!path.isNestedRects(rects, dirs)) { 885 if (!path.isNestedRects(rects, dirs)) {
899 return false; 886 return false;
900 } 887 }
901 888
902 if (SkPath::kWinding_FillType == path.getFillType() && dirs[0] == dirs[1]) { 889 if (SkPath::kWinding_FillType == path.getFillType() && dirs[0] == dirs[1]) {
903 // The two rects need to be wound opposite to each other 890 // The two rects need to be wound opposite to each other
904 return false; 891 return false;
905 } 892 }
906 893
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 SkASSERT(!path.isEmpty()); 1008 SkASSERT(!path.isEmpty());
1022 1009
1023 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target); 1010 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target);
1024 1011
1025 1012
1026 // An Assumption here is that path renderer would use some form of tweaking 1013 // An Assumption here is that path renderer would use some form of tweaking
1027 // the src color (either the input alpha or in the frag shader) to implement 1014 // the src color (either the input alpha or in the frag shader) to implement
1028 // aa. If we have some future driver-mojo path AA that can do the right 1015 // aa. If we have some future driver-mojo path AA that can do the right
1029 // thing WRT to the blend then we'll need some query on the PR. 1016 // thing WRT to the blend then we'll need some query on the PR.
1030 bool useCoverageAA = useAA && 1017 bool useCoverageAA = useAA &&
1031 !pipelineBuilder->getRenderTarget()->isMultisampled() && 1018 !pipelineBuilder->getRenderTarget()->isMultisampled();
1032 pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
1033 1019
1034 1020
1035 GrPathRendererChain::DrawType type = 1021 GrPathRendererChain::DrawType type =
1036 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType : 1022 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType :
1037 GrPathRendererChain::kColor_DrawType; 1023 GrPathRendererChain::kColor_DrawType;
1038 1024
1039 const SkPath* pathPtr = &path; 1025 const SkPath* pathPtr = &path;
1040 SkTLazy<SkPath> tmpPath; 1026 SkTLazy<SkPath> tmpPath;
1041 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec()); 1027 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec());
1042 1028
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 } 1593 }
1608 } 1594 }
1609 1595
1610 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1596 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1611 fGpu->removeGpuTraceMarker(marker); 1597 fGpu->removeGpuTraceMarker(marker);
1612 if (fDrawBuffer) { 1598 if (fDrawBuffer) {
1613 fDrawBuffer->removeGpuTraceMarker(marker); 1599 fDrawBuffer->removeGpuTraceMarker(marker);
1614 } 1600 }
1615 } 1601 }
1616 1602
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.h ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698