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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "third_party/skia/include/core/SkDevice.h" | 42 #include "third_party/skia/include/core/SkDevice.h" |
43 #include "third_party/skia/include/core/SkPicture.h" | 43 #include "third_party/skia/include/core/SkPicture.h" |
44 #include "third_party/skia/include/core/SkRRect.h" | 44 #include "third_party/skia/include/core/SkRRect.h" |
45 #include "third_party/skia/include/core/SkRefCnt.h" | 45 #include "third_party/skia/include/core/SkRefCnt.h" |
46 #include "third_party/skia/include/core/SkSurface.h" | 46 #include "third_party/skia/include/core/SkSurface.h" |
47 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" | 47 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" |
48 #include "third_party/skia/include/effects/SkCornerPathEffect.h" | 48 #include "third_party/skia/include/effects/SkCornerPathEffect.h" |
49 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 49 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
50 #include "third_party/skia/include/gpu/GrRenderTarget.h" | 50 #include "third_party/skia/include/gpu/GrRenderTarget.h" |
51 #include "third_party/skia/include/gpu/GrTexture.h" | 51 #include "third_party/skia/include/gpu/GrTexture.h" |
| 52 #include "third_party/skia/include/pathops/SkPathOps.h" |
52 #include "wtf/Assertions.h" | 53 #include "wtf/Assertions.h" |
53 #include "wtf/MathExtras.h" | 54 #include "wtf/MathExtras.h" |
54 | 55 |
55 using namespace std; | 56 using namespace std; |
56 using blink::WebBlendMode; | 57 using blink::WebBlendMode; |
57 | 58 |
58 namespace WebCore { | 59 namespace WebCore { |
59 | 60 |
60 namespace { | 61 namespace { |
61 | 62 |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); | 1367 SkPath& path = const_cast<SkPath&>(pathToClip.skPath()); |
1367 SkPath::FillType previousFillType = path.getFillType(); | 1368 SkPath::FillType previousFillType = path.getFillType(); |
1368 | 1369 |
1369 SkPath::FillType temporaryFillType = clipRule == RULE_EVENODD ? SkPath::kEve
nOdd_FillType : SkPath::kWinding_FillType; | 1370 SkPath::FillType temporaryFillType = clipRule == RULE_EVENODD ? SkPath::kEve
nOdd_FillType : SkPath::kWinding_FillType; |
1370 path.setFillType(temporaryFillType); | 1371 path.setFillType(temporaryFillType); |
1371 clipPath(path, AntiAliased); | 1372 clipPath(path, AntiAliased); |
1372 | 1373 |
1373 path.setFillType(previousFillType); | 1374 path.setFillType(previousFillType); |
1374 } | 1375 } |
1375 | 1376 |
| 1377 bool GraphicsContext::isClipMode() const |
| 1378 { |
| 1379 if (contextDisabled()) |
| 1380 return false; |
| 1381 |
| 1382 return m_canvas->getClipStack()->getSaveCount() != 0; |
| 1383 } |
| 1384 |
| 1385 Path GraphicsContext::getCurrentClipPath() const |
| 1386 { |
| 1387 if (contextDisabled()) |
| 1388 return Path(); |
| 1389 |
| 1390 const SkClipStack* clipStack = m_canvas->getClipStack(); |
| 1391 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart); |
| 1392 const SkClipStack::Element* element; |
| 1393 |
| 1394 SkPath totalClipPath; |
| 1395 totalClipPath.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 1396 |
| 1397 while ((element = iter.next())) { |
| 1398 |
| 1399 SkClipStack::Element::Type type = element->getType(); |
| 1400 SkPath clipPath; |
| 1401 if (type != SkClipStack::Element::kEmpty_Type) |
| 1402 element->asPath(&clipPath); |
| 1403 |
| 1404 SkRegion::Op elementOp = element->getOp(); |
| 1405 if (elementOp == SkRegion::kReplace_Op) |
| 1406 totalClipPath = clipPath; |
| 1407 else |
| 1408 Op(totalClipPath, clipPath, (SkPathOp)elementOp, &totalClipPath); |
| 1409 } |
| 1410 |
| 1411 return Path(totalClipPath); |
| 1412 } |
| 1413 |
1376 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
ts, bool antialiased) | 1414 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
ts, bool antialiased) |
1377 { | 1415 { |
1378 if (contextDisabled()) | 1416 if (contextDisabled()) |
1379 return; | 1417 return; |
1380 | 1418 |
1381 if (numPoints <= 1) | 1419 if (numPoints <= 1) |
1382 return; | 1420 return; |
1383 | 1421 |
1384 SkPath path; | 1422 SkPath path; |
1385 setPathFromConvexPoints(&path, numPoints, points); | 1423 setPathFromConvexPoints(&path, numPoints, points); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 | 1854 |
1817 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1855 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
1818 { | 1856 { |
1819 if (m_trackTextRegion) { | 1857 if (m_trackTextRegion) { |
1820 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); | 1858 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); |
1821 m_textRegion.join(textRect); | 1859 m_textRegion.join(textRect); |
1822 } | 1860 } |
1823 } | 1861 } |
1824 | 1862 |
1825 } | 1863 } |
OLD | NEW |