OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
10 | 10 |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 path.addRRect(rr); | 1213 path.addRRect(rr); |
1214 this->drawPath(d, path, paint, nullptr, true); | 1214 this->drawPath(d, path, paint, nullptr, true); |
1215 } | 1215 } |
1216 | 1216 |
1217 void SkXPSDevice::internalDrawRect(const SkDraw& d, | 1217 void SkXPSDevice::internalDrawRect(const SkDraw& d, |
1218 const SkRect& r, | 1218 const SkRect& r, |
1219 bool transformRect, | 1219 bool transformRect, |
1220 const SkPaint& paint) { | 1220 const SkPaint& paint) { |
1221 //Exit early if there is nothing to draw. | 1221 //Exit early if there is nothing to draw. |
1222 if (d.fRC->isEmpty() || | 1222 if (d.fRC->isEmpty() || |
1223 (paint.getAlpha() == 0 && paint.getXfermode() == nullptr)) { | 1223 (paint.getAlpha() == 0 && paint.isSrcOver())) { |
1224 return; | 1224 return; |
1225 } | 1225 } |
1226 | 1226 |
1227 //Path the rect if we can't optimize it. | 1227 //Path the rect if we can't optimize it. |
1228 if (rect_must_be_pathed(paint, *d.fMatrix)) { | 1228 if (rect_must_be_pathed(paint, *d.fMatrix)) { |
1229 SkPath tmp; | 1229 SkPath tmp; |
1230 tmp.addRect(r); | 1230 tmp.addRect(r); |
1231 tmp.setFillType(SkPath::kWinding_FillType); | 1231 tmp.setFillType(SkPath::kWinding_FillType); |
1232 this->drawPath(d, tmp, paint, nullptr, true); | 1232 this->drawPath(d, tmp, paint, nullptr, true); |
1233 return; | 1233 return; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 | 1529 |
1530 void SkXPSDevice::drawPath(const SkDraw& d, | 1530 void SkXPSDevice::drawPath(const SkDraw& d, |
1531 const SkPath& platonicPath, | 1531 const SkPath& platonicPath, |
1532 const SkPaint& origPaint, | 1532 const SkPaint& origPaint, |
1533 const SkMatrix* prePathMatrix, | 1533 const SkMatrix* prePathMatrix, |
1534 bool pathIsMutable) { | 1534 bool pathIsMutable) { |
1535 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); | 1535 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); |
1536 | 1536 |
1537 // nothing to draw | 1537 // nothing to draw |
1538 if (d.fRC->isEmpty() || | 1538 if (d.fRC->isEmpty() || |
1539 (paint->getAlpha() == 0 && paint->getXfermode() == nullptr)) { | 1539 (paint->getAlpha() == 0 && paint->isSrcOver())) { |
1540 return; | 1540 return; |
1541 } | 1541 } |
1542 | 1542 |
1543 SkPath modifiedPath; | 1543 SkPath modifiedPath; |
1544 const bool paintHasPathEffect = paint->getPathEffect() | 1544 const bool paintHasPathEffect = paint->getPathEffect() |
1545 || paint->getStyle() != SkPaint::kFill_Style; | 1545 || paint->getStyle() != SkPaint::kFill_Style; |
1546 | 1546 |
1547 //Apply pre-path matrix [Platonic-path -> Skeletal-path]. | 1547 //Apply pre-path matrix [Platonic-path -> Skeletal-path]. |
1548 SkMatrix matrix = *d.fMatrix; | 1548 SkMatrix matrix = *d.fMatrix; |
1549 SkPath* skeletalPath = const_cast<SkPath*>(&platonicPath); | 1549 SkPath* skeletalPath = const_cast<SkPath*>(&platonicPath); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 //SkXPSDevice* dev = new SkXPSDevice(this); | 2279 //SkXPSDevice* dev = new SkXPSDevice(this); |
2280 //SkSize s = SkSize::Make(width, height); | 2280 //SkSize s = SkSize::Make(width, height); |
2281 //dev->BeginCanvas(s, s, SkMatrix::I()); | 2281 //dev->BeginCanvas(s, s, SkMatrix::I()); |
2282 //return dev; | 2282 //return dev; |
2283 } | 2283 } |
2284 #endif | 2284 #endif |
2285 return new SkXPSDevice(this->fXpsFactory.get()); | 2285 return new SkXPSDevice(this->fXpsFactory.get()); |
2286 } | 2286 } |
2287 | 2287 |
2288 #endif//defined(SK_BUILD_FOR_WIN32) | 2288 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |