| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "core/html/canvas/ClipList.h" | 7 #include "core/html/canvas/ClipList.h" |
| 8 | 8 |
| 9 #include "platform/graphics/GraphicsContext.h" | |
| 10 #include "platform/graphics/Path.h" | |
| 11 #include "platform/transforms/AffineTransform.h" | 9 #include "platform/transforms/AffineTransform.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 ClipList::ClipList(const ClipList& other) : m_clipList(other.m_clipList) { } | 14 ClipList::ClipList(const ClipList& other) : m_clipList(other.m_clipList) { } |
| 16 | 15 |
| 17 void ClipList::clipPath(const Path& path, WindRule windRule, AntiAliasingMode an
tiAliasingMode, const AffineTransform& ctm) | 16 void ClipList::clipPath(const SkPath& path, AntiAliasingMode antiAliasingMode, c
onst SkMatrix& ctm) |
| 18 { | 17 { |
| 19 ClipOp newClip; | 18 ClipOp newClip; |
| 20 newClip.m_antiAliasingMode = antiAliasingMode; | 19 newClip.m_antiAliasingMode = antiAliasingMode; |
| 21 newClip.m_windRule = windRule; | |
| 22 newClip.m_path = path; | 20 newClip.m_path = path; |
| 23 newClip.m_path.transform(ctm); | 21 newClip.m_path.transform(ctm); |
| 24 m_clipList.append(newClip); | 22 m_clipList.append(newClip); |
| 25 } | 23 } |
| 26 | 24 |
| 27 void ClipList::playback(GraphicsContext* context) const | 25 void ClipList::playback(SkCanvas* canvas) const |
| 28 { | 26 { |
| 29 for (const ClipOp* it = m_clipList.begin(); it < m_clipList.end(); it++) { | 27 for (const ClipOp* it = m_clipList.begin(); it < m_clipList.end(); it++) { |
| 30 context->clipPath(it->m_path, it->m_windRule, it->m_antiAliasingMode); | 28 canvas->clipPath(it->m_path, SkRegion::kIntersect_Op, it->m_antiAliasing
Mode == AntiAliased); |
| 31 } | 29 } |
| 32 } | 30 } |
| 33 | 31 |
| 34 ClipList::ClipOp::ClipOp() | 32 ClipList::ClipOp::ClipOp() |
| 35 : m_antiAliasingMode(AntiAliased) | 33 : m_antiAliasingMode(AntiAliased) |
| 36 , m_windRule(RULE_NONZERO) | |
| 37 { } | 34 { } |
| 38 | 35 |
| 39 ClipList::ClipOp::ClipOp(const ClipOp& other) | 36 ClipList::ClipOp::ClipOp(const ClipOp& other) |
| 40 : m_path(other.m_path) | 37 : m_path(other.m_path) |
| 41 , m_antiAliasingMode(other.m_antiAliasingMode) | 38 , m_antiAliasingMode(other.m_antiAliasingMode) |
| 42 , m_windRule(other.m_windRule) | |
| 43 { } | 39 { } |
| 44 | 40 |
| 45 } // namespace blink | 41 } // namespace blink |
| OLD | NEW |