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

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

Issue 1491843006: add support for capped hairlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 5 years 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 | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.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 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 #define __STDC_LIMIT_MACROS 7 #define __STDC_LIMIT_MACROS
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 1125
1126 void (*proc)(const SkPath&, const SkRasterClip&, SkBlitter*); 1126 void (*proc)(const SkPath&, const SkRasterClip&, SkBlitter*);
1127 if (doFill) { 1127 if (doFill) {
1128 if (paint->isAntiAlias()) { 1128 if (paint->isAntiAlias()) {
1129 proc = SkScan::AntiFillPath; 1129 proc = SkScan::AntiFillPath;
1130 } else { 1130 } else {
1131 proc = SkScan::FillPath; 1131 proc = SkScan::FillPath;
1132 } 1132 }
1133 } else { // hairline 1133 } else { // hairline
1134 if (paint->isAntiAlias()) { 1134 if (paint->isAntiAlias()) {
1135 switch (paint->getStrokeCap()) {
1136 case SkPaint::kButt_Cap:
1137 proc = SkScan::AntiHairPath;
1138 break;
1139 case SkPaint::kSquare_Cap:
1140 proc = SkScan::AntiHairSquarePath;
1141 break;
1142 case SkPaint::kRound_Cap:
1143 proc = SkScan::AntiHairRoundPath;
1144 break;
1145 default:
1146 proc SK_INIT_TO_AVOID_WARNING;
1147 SkDEBUGFAIL("unknown paint cap type");
1148 }
1149 #ifdef SK_SUPPORT_LEGACY_HAIR_IGNORES_CAPS
1135 proc = SkScan::AntiHairPath; 1150 proc = SkScan::AntiHairPath;
1151 #endif
1136 } else { 1152 } else {
1153 switch (paint->getStrokeCap()) {
1154 case SkPaint::kButt_Cap:
1155 proc = SkScan::HairPath;
1156 break;
1157 case SkPaint::kSquare_Cap:
1158 proc = SkScan::HairSquarePath;
1159 break;
1160 case SkPaint::kRound_Cap:
1161 proc = SkScan::HairRoundPath;
1162 break;
1163 default:
1164 proc SK_INIT_TO_AVOID_WARNING;
1165 SkDEBUGFAIL("unknown paint cap type");
1166 }
1167 #ifdef SK_SUPPORT_LEGACY_HAIR_IGNORES_CAPS
1137 proc = SkScan::HairPath; 1168 proc = SkScan::HairPath;
1169 #endif
1138 } 1170 }
1139 } 1171 }
1140 proc(*devPathPtr, *fRC, blitter); 1172 proc(*devPathPtr, *fRC, blitter);
1141 } 1173 }
1142 1174
1143 /** For the purposes of drawing bitmaps, if a matrix is "almost" translate 1175 /** For the purposes of drawing bitmaps, if a matrix is "almost" translate
1144 go ahead and treat it as if it were, so that subsequent code can go fast. 1176 go ahead and treat it as if it were, so that subsequent code can go fast.
1145 */ 1177 */
1146 static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) { 1178 static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) {
1147 unsigned bits = 0; // TODO: find a way to allow the caller to tell us to 1179 unsigned bits = 0; // TODO: find a way to allow the caller to tell us to
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 mask->fImage = SkMask::AllocImage(size); 2141 mask->fImage = SkMask::AllocImage(size);
2110 memset(mask->fImage, 0, mask->computeImageSize()); 2142 memset(mask->fImage, 0, mask->computeImageSize());
2111 } 2143 }
2112 2144
2113 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2145 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2114 draw_into_mask(*mask, devPath, style); 2146 draw_into_mask(*mask, devPath, style);
2115 } 2147 }
2116 2148
2117 return true; 2149 return true;
2118 } 2150 }
OLDNEW
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698