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

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: 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom); 479 SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom);
480 } 480 }
481 481
482 static bool apply_aa_to_rect(GrDrawTarget* target, 482 static bool apply_aa_to_rect(GrDrawTarget* target,
483 GrPipelineBuilder* pipelineBuilder, 483 GrPipelineBuilder* pipelineBuilder,
484 SkRect* devBoundRect, 484 SkRect* devBoundRect,
485 const SkRect& rect, 485 const SkRect& rect,
486 SkScalar strokeWidth, 486 SkScalar strokeWidth,
487 const SkMatrix& combinedMatrix, 487 const SkMatrix& combinedMatrix,
488 GrColor color) { 488 GrColor color) {
489 if (!pipelineBuilder->canTweakAlphaForCoverage() &&
490 !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
491 #ifdef SK_DEBUG
492 //SkDebugf("Turning off AA to correctly apply blend.\n");
493 #endif
494 return false;
495 }
496
497 if (pipelineBuilder->getRenderTarget()->isMultisampled()) { 489 if (pipelineBuilder->getRenderTarget()->isMultisampled()) {
498 return false; 490 return false;
499 } 491 }
500 492
501 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) 493 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT)
502 if (strokeWidth >= 0) { 494 if (strokeWidth >= 0) {
503 #endif 495 #endif
504 if (!combinedMatrix.preservesAxisAlignment()) { 496 if (!combinedMatrix.preservesAxisAlignment()) {
505 return false; 497 return false;
506 } 498 }
(...skipping 375 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 SkASSERT(!path.isEmpty()); 1007 SkASSERT(!path.isEmpty());
1021 1008
1022 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target); 1009 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target);
1023 1010
1024 1011
1025 // An Assumption here is that path renderer would use some form of tweaking 1012 // An Assumption here is that path renderer would use some form of tweaking
1026 // the src color (either the input alpha or in the frag shader) to implement 1013 // the src color (either the input alpha or in the frag shader) to implement
1027 // aa. If we have some future driver-mojo path AA that can do the right 1014 // aa. If we have some future driver-mojo path AA that can do the right
1028 // thing WRT to the blend then we'll need some query on the PR. 1015 // thing WRT to the blend then we'll need some query on the PR.
1029 bool useCoverageAA = useAA && 1016 bool useCoverageAA = useAA &&
1030 !pipelineBuilder->getRenderTarget()->isMultisampled() && 1017 !pipelineBuilder->getRenderTarget()->isMultisampled();
1031 pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
1032 1018
1033 1019
1034 GrPathRendererChain::DrawType type = 1020 GrPathRendererChain::DrawType type =
1035 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType : 1021 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType :
1036 GrPathRendererChain::kColor_DrawType; 1022 GrPathRendererChain::kColor_DrawType;
1037 1023
1038 const SkPath* pathPtr = &path; 1024 const SkPath* pathPtr = &path;
1039 SkTLazy<SkPath> tmpPath; 1025 SkTLazy<SkPath> tmpPath;
1040 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec()); 1026 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec());
1041 1027
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 } 1591 }
1606 } 1592 }
1607 1593
1608 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1594 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1609 fGpu->removeGpuTraceMarker(marker); 1595 fGpu->removeGpuTraceMarker(marker);
1610 if (fDrawBuffer) { 1596 if (fDrawBuffer) {
1611 fDrawBuffer->removeGpuTraceMarker(marker); 1597 fDrawBuffer->removeGpuTraceMarker(marker);
1612 } 1598 }
1613 } 1599 }
1614 1600
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698