| 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 23 matching lines...) Expand all Loading... |
| 34 #include "platform/transforms/AffineTransform.h" | 34 #include "platform/transforms/AffineTransform.h" |
| 35 | 35 |
| 36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 | 39 |
| 40 class SkShader; | 40 class SkShader; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class DisplayList; |
| 45 |
| 44 class PLATFORM_EXPORT Pattern : public RefCounted<Pattern> { | 46 class PLATFORM_EXPORT Pattern : public RefCounted<Pattern> { |
| 45 public: | 47 public: |
| 46 enum RepeatMode { | 48 enum RepeatMode { |
| 47 RepeatModeX = 1 << 0, | 49 RepeatModeX = 1 << 0, |
| 48 RepeatModeY = 1 << 1, | 50 RepeatModeY = 1 << 1, |
| 49 | 51 |
| 50 RepeatModeNone = 0, | 52 RepeatModeNone = 0, |
| 51 RepeatModeXY = RepeatModeX | RepeatModeY | 53 RepeatModeXY = RepeatModeX | RepeatModeY |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 static PassRefPtr<Pattern> createBitmapPattern(PassRefPtr<Image> tileImage, | 56 static PassRefPtr<Pattern> createBitmapPattern(PassRefPtr<Image> tileImage, |
| 55 RepeatMode = RepeatModeXY); | 57 RepeatMode = RepeatModeXY); |
| 58 static PassRefPtr<Pattern> createDisplayListPattern(PassRefPtr<DisplayList>, |
| 59 RepeatMode = RepeatModeXY); |
| 56 virtual ~Pattern(); | 60 virtual ~Pattern(); |
| 57 | 61 |
| 58 SkShader* shader(); | 62 SkShader* shader(); |
| 59 | 63 |
| 60 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); | 64 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); |
| 61 const AffineTransform& patternSpaceTransform() const { return m_patternSpace
Transformation; } | 65 const AffineTransform& patternSpaceTransform() const { return m_patternSpace
Transformation; } |
| 62 | 66 |
| 63 bool isRepeatX() { return m_repeatMode & RepeatModeX; } | 67 bool isRepeatX() { return m_repeatMode & RepeatModeX; } |
| 64 bool isRepeatY() { return m_repeatMode & RepeatModeY; } | 68 bool isRepeatY() { return m_repeatMode & RepeatModeY; } |
| 65 bool isRepeatXY() { return m_repeatMode == RepeatModeXY; } | 69 bool isRepeatXY() { return m_repeatMode == RepeatModeXY; } |
| 66 | 70 |
| 67 protected: | 71 protected: |
| 68 virtual PassRefPtr<SkShader> createShader() = 0; | 72 virtual PassRefPtr<SkShader> createShader() = 0; |
| 69 | 73 |
| 70 void adjustExternalMemoryAllocated(int64_t delta); | 74 void adjustExternalMemoryAllocated(int64_t delta); |
| 71 | 75 |
| 72 RepeatMode m_repeatMode; | 76 RepeatMode m_repeatMode; |
| 73 AffineTransform m_patternSpaceTransformation; | 77 AffineTransform m_patternSpaceTransformation; |
| 74 | 78 |
| 75 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0); | 79 Pattern(RepeatMode, int64_t externalMemoryAllocated = 0); |
| 76 | 80 |
| 77 private: | 81 private: |
| 78 RefPtr<SkShader> m_pattern; | 82 RefPtr<SkShader> m_pattern; |
| 79 int64_t m_externalMemoryAllocated; | 83 int64_t m_externalMemoryAllocated; |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace blink | 86 } // namespace blink |
| 83 | 87 |
| 84 #endif | 88 #endif |
| OLD | NEW |