OLD | NEW |
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 14 matching lines...) Expand all Loading... |
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/transforms/AffineTransform.h" | 34 #include "platform/transforms/AffineTransform.h" |
| 35 #include "third_party/skia/include/core/SkRefCnt.h" |
35 | 36 |
36 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
39 #include "wtf/RefPtr.h" | |
40 | 40 |
41 class SkPaint; | 41 class SkPaint; |
42 class SkPicture; | 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 public: | 48 public: |
49 enum RepeatMode { | 49 enum RepeatMode { |
(...skipping 14 matching lines...) Expand all Loading... |
64 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); | 64 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); |
65 const AffineTransform& patternSpaceTransform() const { return m_patternSpace
Transformation; } | 65 const AffineTransform& patternSpaceTransform() const { return m_patternSpace
Transformation; } |
66 | 66 |
67 bool isRepeatX() { return m_repeatMode & RepeatModeX; } | 67 bool isRepeatX() { return m_repeatMode & RepeatModeX; } |
68 bool isRepeatY() { return m_repeatMode & RepeatModeY; } | 68 bool isRepeatY() { return m_repeatMode & RepeatModeY; } |
69 bool isRepeatXY() { return m_repeatMode == RepeatModeXY; } | 69 bool isRepeatXY() { return m_repeatMode == RepeatModeXY; } |
70 | 70 |
71 virtual bool isTextureBacked() const { return false; } | 71 virtual bool isTextureBacked() const { return false; } |
72 | 72 |
73 protected: | 73 protected: |
74 virtual PassRefPtr<SkShader> createShader() = 0; | 74 virtual sk_sp<SkShader> createShader() = 0; |
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 AffineTransform m_patternSpaceTransformation; | 79 AffineTransform m_patternSpaceTransformation; |
80 | 80 |
81 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0); | 81 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0); |
82 | 82 |
83 private: | 83 private: |
84 RefPtr<SkShader> m_pattern; | 84 sk_sp<SkShader> m_pattern; |
85 int64_t m_externalMemoryAllocated; | 85 int64_t m_externalMemoryAllocated; |
86 }; | 86 }; |
87 | 87 |
88 } // namespace blink | 88 } // namespace blink |
89 | 89 |
90 #endif | 90 #endif |
OLD | NEW |