OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 { | 1136 { |
1137 if (paintingDisabled()) | 1137 if (paintingDisabled()) |
1138 return; | 1138 return; |
1139 | 1139 |
1140 SkRect rect = ellipse; | 1140 SkRect rect = ellipse; |
1141 SkPaint paint; | 1141 SkPaint paint; |
1142 platformContext()->setupPaintForFilling(&paint); | 1142 platformContext()->setupPaintForFilling(&paint); |
1143 platformContext()->drawOval(rect, paint); | 1143 platformContext()->drawOval(rect, paint); |
1144 } | 1144 } |
1145 | 1145 |
1146 void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan) | |
1147 { | |
1148 if (paintingDisabled()) | |
1149 return; | |
1150 | |
1151 SkPaint paint; | |
1152 SkRect oval = r; | |
1153 if (strokeStyle() == NoStroke) { | |
1154 // Stroke using the fill color. | |
1155 // TODO(brettw) is this really correct? It seems unreasonable. | |
1156 platformContext()->setupPaintForFilling(&paint); | |
1157 paint.setStyle(SkPaint::kStroke_Style); | |
1158 paint.setStrokeWidth(WebCoreFloatToSkScalar(strokeThickness())); | |
1159 } else | |
1160 platformContext()->setupPaintForStroking(&paint, 0, 0); | |
1161 | |
1162 // We do this before converting to scalar, so we don't overflow SkFixed. | |
1163 startAngle = fastMod(startAngle, 360); | |
1164 angleSpan = fastMod(angleSpan, 360); | |
1165 | |
1166 SkPath path; | |
1167 path.addArc(oval, SkIntToScalar(-startAngle), SkIntToScalar(-angleSpan)); | |
1168 platformContext()->drawPath(path, paint); | |
1169 } | |
1170 | |
1171 void GraphicsContext::strokePath(const Path& pathToStroke) | 1146 void GraphicsContext::strokePath(const Path& pathToStroke) |
1172 { | 1147 { |
1173 if (paintingDisabled() || pathToStroke.isEmpty()) | 1148 if (paintingDisabled() || pathToStroke.isEmpty()) |
1174 return; | 1149 return; |
1175 | 1150 |
1176 const SkPath& path = pathToStroke.skPath(); | 1151 const SkPath& path = pathToStroke.skPath(); |
1177 SkPaint paint; | 1152 SkPaint paint; |
1178 platformContext()->setupPaintForStroking(&paint, 0, 0); | 1153 platformContext()->setupPaintForStroking(&paint, 0, 0); |
1179 platformContext()->drawPath(path, paint); | 1154 platformContext()->drawPath(path, paint); |
1180 } | 1155 } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 static const SkPMColor colors[] = { | 1722 static const SkPMColor colors[] = { |
1748 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1723 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
1749 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1724 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
1750 }; | 1725 }; |
1751 | 1726 |
1752 return colors[index]; | 1727 return colors[index]; |
1753 } | 1728 } |
1754 #endif | 1729 #endif |
1755 | 1730 |
1756 } | 1731 } |
OLD | NEW |