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

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: exclude clipping region part Created 6 years, 6 months 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
OLDNEW
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 20 matching lines...) Expand all
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "platform/geometry/RoundedRect.h" 32 #include "platform/geometry/RoundedRect.h"
33 #include "platform/graphics/BitmapImage.h" 33 #include "platform/graphics/BitmapImage.h"
34 #include "platform/graphics/DisplayList.h" 34 #include "platform/graphics/DisplayList.h"
35 #include "platform/graphics/Gradient.h" 35 #include "platform/graphics/Gradient.h"
36 #include "platform/graphics/ImageBuffer.h" 36 #include "platform/graphics/ImageBuffer.h"
37 #include "platform/text/BidiResolver.h" 37 #include "platform/text/BidiResolver.h"
38 #include "platform/text/TextRunIterator.h" 38 #include "platform/text/TextRunIterator.h"
39 #include "platform/weborigin/KURL.h" 39 #include "platform/weborigin/KURL.h"
40 #include "third_party/skia/include/core/SkAnnotation.h" 40 #include "third_party/skia/include/core/SkAnnotation.h"
41 #include "third_party/skia/include/core/SkClipStack.h"
41 #include "third_party/skia/include/core/SkColorFilter.h" 42 #include "third_party/skia/include/core/SkColorFilter.h"
42 #include "third_party/skia/include/core/SkData.h" 43 #include "third_party/skia/include/core/SkData.h"
43 #include "third_party/skia/include/core/SkDevice.h" 44 #include "third_party/skia/include/core/SkDevice.h"
44 #include "third_party/skia/include/core/SkPicture.h" 45 #include "third_party/skia/include/core/SkPicture.h"
45 #include "third_party/skia/include/core/SkRRect.h" 46 #include "third_party/skia/include/core/SkRRect.h"
46 #include "third_party/skia/include/core/SkRefCnt.h" 47 #include "third_party/skia/include/core/SkRefCnt.h"
47 #include "third_party/skia/include/core/SkSurface.h" 48 #include "third_party/skia/include/core/SkSurface.h"
48 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" 49 #include "third_party/skia/include/effects/SkBlurMaskFilter.h"
49 #include "third_party/skia/include/effects/SkCornerPathEffect.h" 50 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
50 #include "third_party/skia/include/effects/SkLumaColorFilter.h" 51 #include "third_party/skia/include/effects/SkLumaColorFilter.h"
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
1376 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin ts, bool antialiased) 1385 void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin ts, bool antialiased)
1377 { 1386 {
1378 if (contextDisabled()) 1387 if (contextDisabled())
1379 return; 1388 return;
1380 1389
1381 if (numPoints <= 1) 1390 if (numPoints <= 1)
1382 return; 1391 return;
1383 1392
1384 SkPath path; 1393 SkPath path;
1385 setPathFromConvexPoints(&path, numPoints, points); 1394 setPathFromConvexPoints(&path, numPoints, points);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1825
1817 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) 1826 void GraphicsContext::didDrawTextInRect(const SkRect& textRect)
1818 { 1827 {
1819 if (m_trackTextRegion) { 1828 if (m_trackTextRegion) {
1820 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect"); 1829 TRACE_EVENT0("skia", "GraphicsContext::didDrawTextInRect");
1821 m_textRegion.join(textRect); 1830 m_textRegion.join(textRect);
1822 } 1831 }
1823 } 1832 }
1824 1833
1825 } 1834 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698