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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/ClipList.cpp

Issue 1628413002: asdfsdf Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/ClipList.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/ClipList.h" 5 #include "modules/canvas2d/ClipList.h"
6 6
7 #include "platform/transforms/AffineTransform.h" 7 #include "platform/transforms/AffineTransform.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/pathops/SkPathOps.h"
9 10
10 namespace blink { 11 namespace blink {
11 12
12 ClipList::ClipList(const ClipList& other) : m_clipList(other.m_clipList) { } 13 ClipList::ClipList(const ClipList& other) : m_clipList(other.m_clipList) { }
13 14
14 void ClipList::clipPath(const SkPath& path, AntiAliasingMode antiAliasingMode, c onst SkMatrix& ctm) 15 void ClipList::clipPath(const SkPath& path, AntiAliasingMode antiAliasingMode, c onst SkMatrix& ctm)
15 { 16 {
16 ClipOp newClip; 17 ClipOp newClip;
17 newClip.m_antiAliasingMode = antiAliasingMode; 18 newClip.m_antiAliasingMode = antiAliasingMode;
18 newClip.m_path = path; 19 newClip.m_path = path;
19 newClip.m_path.transform(ctm); 20 newClip.m_path.transform(ctm);
20 m_clipList.append(newClip); 21 m_clipList.append(newClip);
21 } 22 }
22 23
23 void ClipList::playback(SkCanvas* canvas) const 24 void ClipList::playback(SkCanvas* canvas) const
24 { 25 {
25 for (const ClipOp* it = m_clipList.begin(); it < m_clipList.end(); it++) { 26 for (const ClipOp* it = m_clipList.begin(); it < m_clipList.end(); it++) {
26 canvas->clipPath(it->m_path, SkRegion::kIntersect_Op, it->m_antiAliasing Mode == AntiAliased); 27 canvas->clipPath(it->m_path, SkRegion::kIntersect_Op, it->m_antiAliasing Mode == AntiAliased);
27 } 28 }
28 } 29 }
29 30
31 SkPath ClipList::intersectPathWithClip(const SkPath& path) const
32 {
33 SkPath total = path;
34 for (const ClipOp* it = m_clipList.begin(); it < m_clipList.end(); it++) {
35 Op(total, it->m_path, SkPathOp::kIntersect_SkPathOp, &total);
36 }
37 return total;
38 }
39
30 ClipList::ClipOp::ClipOp() 40 ClipList::ClipOp::ClipOp()
31 : m_antiAliasingMode(AntiAliased) 41 : m_antiAliasingMode(AntiAliased)
32 { } 42 { }
33 43
34 ClipList::ClipOp::ClipOp(const ClipOp& other) 44 ClipList::ClipOp::ClipOp(const ClipOp& other)
35 : m_path(other.m_path) 45 : m_path(other.m_path)
36 , m_antiAliasingMode(other.m_antiAliasingMode) 46 , m_antiAliasingMode(other.m_antiAliasingMode)
37 { } 47 { }
38 48
39 } // namespace blink 49 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/ClipList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698