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

Side by Side Diff: src/core/SkDraw.cpp

Issue 38573007: Do not apply hairline optimization for paths if nv_path_rendering is used (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address problems Created 7 years, 1 month 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 | « no previous file | src/core/SkDrawProcs.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkBounder.h" 10 #include "SkBounder.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 switch (dc) { 981 switch (dc) {
982 case SkXfermode::kOne_Coeff: 982 case SkXfermode::kOne_Coeff:
983 case SkXfermode::kISA_Coeff: 983 case SkXfermode::kISA_Coeff:
984 case SkXfermode::kISC_Coeff: 984 case SkXfermode::kISC_Coeff:
985 return true; 985 return true;
986 default: 986 default:
987 return false; 987 return false;
988 } 988 }
989 } 989 }
990 990
991 bool SkDrawTreatAsHairline(const SkPaint& paint, const SkMatrix& matrix, 991 bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix& matrix,
992 SkScalar* coverage) { 992 SkScalar* coverage) {
993 SkASSERT(coverage); 993 SkASSERT(strokeWidth > 0);
994 if (SkPaint::kStroke_Style != paint.getStyle()) { 994 // We need to try to fake a thick-stroke with a modulated hairline.
995 return false;
996 }
997 SkScalar strokeWidth = paint.getStrokeWidth();
998 if (0 == strokeWidth) {
999 *coverage = SK_Scalar1;
1000 return true;
1001 }
1002 995
1003 // if we get here, we need to try to fake a thick-stroke with a modulated
1004 // hairline
1005
1006 if (!paint.isAntiAlias()) {
1007 return false;
1008 }
1009 if (matrix.hasPerspective()) { 996 if (matrix.hasPerspective()) {
1010 return false; 997 return false;
1011 } 998 }
1012 999
1013 SkVector src[2], dst[2]; 1000 SkVector src[2], dst[2];
1014 src[0].set(strokeWidth, 0); 1001 src[0].set(strokeWidth, 0);
1015 src[1].set(0, strokeWidth); 1002 src[1].set(0, strokeWidth);
1016 matrix.mapVectors(dst, src, 2); 1003 matrix.mapVectors(dst, src, 2);
1017 SkScalar len0 = fast_len(dst[0]); 1004 SkScalar len0 = fast_len(dst[0]);
1018 SkScalar len1 = fast_len(dst[1]); 1005 SkScalar len1 = fast_len(dst[1]);
1019 if (len0 <= SK_Scalar1 && len1 <= SK_Scalar1) { 1006 if (len0 <= SK_Scalar1 && len1 <= SK_Scalar1) {
1020 *coverage = SkScalarAve(len0, len1); 1007 if (NULL != coverage) {
1008 *coverage = SkScalarAve(len0, len1);
1009 }
1021 return true; 1010 return true;
1022 } 1011 }
1023 return false; 1012 return false;
1024 } 1013 }
1025 1014
1026 void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const { 1015 void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const {
1027 SkDEBUGCODE(this->validate()); 1016 SkDEBUGCODE(this->validate());
1028 1017
1029 if (fRC->isEmpty()) { 1018 if (fRC->isEmpty()) {
1030 return; 1019 return;
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 mask->fImage = SkMask::AllocImage(size); 2867 mask->fImage = SkMask::AllocImage(size);
2879 memset(mask->fImage, 0, mask->computeImageSize()); 2868 memset(mask->fImage, 0, mask->computeImageSize());
2880 } 2869 }
2881 2870
2882 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2871 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2883 draw_into_mask(*mask, devPath, style); 2872 draw_into_mask(*mask, devPath, style);
2884 } 2873 }
2885 2874
2886 return true; 2875 return true;
2887 } 2876 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkDrawProcs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698