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

Side by Side Diff: Source/core/html/canvas/ClipList.cpp

Issue 895153002: Make CanvasRenderingContext2D use SkCanvas directly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix issue with the copy composite operator Created 5 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 | « Source/core/html/canvas/ClipList.h ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | 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 "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
OLDNEW
« no previous file with comments | « Source/core/html/canvas/ClipList.h ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698