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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Pattern.h

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2007-2008 Torch Mobile, Inc. 4 * Copyright (C) 2007-2008 Torch Mobile, Inc.
5 * Copyright (C) 2013 Google, Inc. All rights reserved. 5 * Copyright (C) 2013 Google, Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 13 matching lines...) Expand all
24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef Pattern_h 29 #ifndef Pattern_h
30 #define Pattern_h 30 #define Pattern_h
31 31
32 #include "platform/PlatformExport.h" 32 #include "platform/PlatformExport.h"
33 #include "platform/graphics/Image.h" 33 #include "platform/graphics/Image.h"
34 #include "platform/graphics/paint/PaintRecord.h"
35 #include "platform/graphics/paint/PaintShader.h"
34 #include "third_party/skia/include/core/SkRefCnt.h" 36 #include "third_party/skia/include/core/SkRefCnt.h"
35 37
36 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
37 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
39 41
40 class SkMatrix; 42 class SkMatrix;
41 class SkPaint;
42 class SkPicture;
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class PLATFORM_EXPORT Pattern : public RefCounted<Pattern> { 46 class PLATFORM_EXPORT Pattern : public RefCounted<Pattern> {
47 WTF_MAKE_NONCOPYABLE(Pattern); 47 WTF_MAKE_NONCOPYABLE(Pattern);
48 48
49 public: 49 public:
50 enum RepeatMode { 50 enum RepeatMode {
51 RepeatModeX = 1 << 0, 51 RepeatModeX = 1 << 0,
52 RepeatModeY = 1 << 1, 52 RepeatModeY = 1 << 1,
53 53
54 RepeatModeNone = 0, 54 RepeatModeNone = 0,
55 RepeatModeXY = RepeatModeX | RepeatModeY 55 RepeatModeXY = RepeatModeX | RepeatModeY
56 }; 56 };
57 57
58 static PassRefPtr<Pattern> createImagePattern(PassRefPtr<Image>, 58 static PassRefPtr<Pattern> createImagePattern(PassRefPtr<Image>,
59 RepeatMode = RepeatModeXY); 59 RepeatMode = RepeatModeXY);
60 static PassRefPtr<Pattern> createPicturePattern(sk_sp<SkPicture>, 60 static PassRefPtr<Pattern> createPicturePattern(sk_sp<PaintRecord>,
61 RepeatMode = RepeatModeXY); 61 RepeatMode = RepeatModeXY);
62 virtual ~Pattern(); 62 virtual ~Pattern();
63 63
64 void applyToPaint(SkPaint&, const SkMatrix&); 64 void applyToPaint(PaintFlags&, const SkMatrix&);
65 65
66 bool isRepeatX() const { return m_repeatMode & RepeatModeX; } 66 bool isRepeatX() const { return m_repeatMode & RepeatModeX; }
67 bool isRepeatY() const { return m_repeatMode & RepeatModeY; } 67 bool isRepeatY() const { return m_repeatMode & RepeatModeY; }
68 bool isRepeatXY() const { return m_repeatMode == RepeatModeXY; } 68 bool isRepeatXY() const { return m_repeatMode == RepeatModeXY; }
69 69
70 virtual bool isTextureBacked() const { return false; } 70 virtual bool isTextureBacked() const { return false; }
71 71
72 protected: 72 protected:
73 virtual sk_sp<SkShader> createShader(const SkMatrix&) = 0; 73 virtual sk_sp<PaintShader> createShader(const SkMatrix&) = 0;
74 virtual bool isLocalMatrixChanged(const SkMatrix&) const; 74 virtual bool isLocalMatrixChanged(const SkMatrix&) const;
75 75
76 void adjustExternalMemoryAllocated(int64_t delta); 76 void adjustExternalMemoryAllocated(int64_t delta);
77 77
78 RepeatMode m_repeatMode; 78 RepeatMode m_repeatMode;
79 79
80 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0); 80 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0);
81 mutable sk_sp<SkShader> m_cachedShader; 81 mutable sk_sp<PaintShader> m_cachedShader;
82 82
83 private: 83 private:
84 int64_t m_externalMemoryAllocated; 84 int64_t m_externalMemoryAllocated;
85 }; 85 };
86 86
87 } // namespace blink 87 } // namespace blink
88 88
89 #endif 89 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Path.cpp ('k') | third_party/WebKit/Source/platform/graphics/Pattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698