| 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 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include <wtf/PassRefPtr.h> | 34 #include <wtf/PassRefPtr.h> |
| 35 #include <wtf/RefCounted.h> | 35 #include <wtf/RefCounted.h> |
| 36 #include <wtf/RefPtr.h> | 36 #include <wtf/RefPtr.h> |
| 37 | 37 |
| 38 #if USE(CG) | 38 #if USE(CG) |
| 39 typedef struct CGPattern* CGPatternRef; | 39 typedef struct CGPattern* CGPatternRef; |
| 40 typedef CGPatternRef PlatformPatternPtr; | 40 typedef CGPatternRef PlatformPatternPtr; |
| 41 #elif USE(SKIA) | 41 #elif USE(SKIA) |
| 42 class SkShader; | 42 class SkShader; |
| 43 typedef SkShader* PlatformPatternPtr; | 43 typedef SkShader* PlatformPatternPtr; |
| 44 #elif PLATFORM(QT) | |
| 45 #include <QBrush> | |
| 46 typedef QBrush PlatformPatternPtr; | |
| 47 #elif OS(WINCE) | 44 #elif OS(WINCE) |
| 48 typedef void* PlatformPatternPtr; | 45 typedef void* PlatformPatternPtr; |
| 49 #endif | 46 #endif |
| 50 | 47 |
| 51 namespace WebCore { | 48 namespace WebCore { |
| 52 | 49 |
| 53 class AffineTransform; | 50 class AffineTransform; |
| 54 | 51 |
| 55 class Pattern : public RefCounted<Pattern> { | 52 class Pattern : public RefCounted<Pattern> { |
| 56 public: | 53 public: |
| 57 static PassRefPtr<Pattern> create(PassRefPtr<Image> tileImage, bool repeatX,
bool repeatY) | 54 static PassRefPtr<Pattern> create(PassRefPtr<Image> tileImage, bool repeatX,
bool repeatY) |
| 58 { | 55 { |
| 59 return adoptRef(new Pattern(tileImage, repeatX, repeatY)); | 56 return adoptRef(new Pattern(tileImage, repeatX, repeatY)); |
| 60 } | 57 } |
| 61 virtual ~Pattern(); | 58 virtual ~Pattern(); |
| 62 | 59 |
| 63 Image* tileImage() const { return m_tileImage.get(); } | 60 Image* tileImage() const { return m_tileImage.get(); } |
| 64 | 61 |
| 65 void platformDestroy(); | 62 void platformDestroy(); |
| 66 | 63 |
| 67 // Pattern space is an abstract space that maps to the default user space by
the transformation 'userSpaceTransformation' | 64 // Pattern space is an abstract space that maps to the default user space by
the transformation 'userSpaceTransformation' |
| 68 #if USE(SKIA) | 65 #if USE(SKIA) |
| 69 PlatformPatternPtr platformPattern(const AffineTransform& userSpaceTransform
ation); | 66 PlatformPatternPtr platformPattern(const AffineTransform& userSpaceTransform
ation); |
| 70 #elif PLATFORM(QT) | |
| 71 // Qt ignores user space transformation and uses pattern's instead | |
| 72 PlatformPatternPtr createPlatformPattern() const; | |
| 73 #else | 67 #else |
| 74 PlatformPatternPtr createPlatformPattern(const AffineTransform& userSpaceTra
nsformation) const; | 68 PlatformPatternPtr createPlatformPattern(const AffineTransform& userSpaceTra
nsformation) const; |
| 75 #endif | 69 #endif |
| 76 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); | 70 void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformat
ion); |
| 77 const AffineTransform& getPatternSpaceTransform() { return m_patternSpaceTra
nsformation; }; | 71 const AffineTransform& getPatternSpaceTransform() { return m_patternSpaceTra
nsformation; }; |
| 78 void setPlatformPatternSpaceTransform(); | 72 void setPlatformPatternSpaceTransform(); |
| 79 | 73 |
| 80 bool repeatX() const { return m_repeatX; } | 74 bool repeatX() const { return m_repeatX; } |
| 81 bool repeatY() const { return m_repeatY; } | 75 bool repeatY() const { return m_repeatY; } |
| 82 | 76 |
| 83 private: | 77 private: |
| 84 Pattern(PassRefPtr<Image>, bool repeatX, bool repeatY); | 78 Pattern(PassRefPtr<Image>, bool repeatX, bool repeatY); |
| 85 | 79 |
| 86 RefPtr<Image> m_tileImage; | 80 RefPtr<Image> m_tileImage; |
| 87 bool m_repeatX; | 81 bool m_repeatX; |
| 88 bool m_repeatY; | 82 bool m_repeatY; |
| 89 AffineTransform m_patternSpaceTransformation; | 83 AffineTransform m_patternSpaceTransformation; |
| 90 PlatformPatternPtr m_pattern; | 84 PlatformPatternPtr m_pattern; |
| 91 #if USE(SKIA) | 85 #if USE(SKIA) |
| 92 int m_externalMemoryAllocated; | 86 int m_externalMemoryAllocated; |
| 93 #endif | 87 #endif |
| 94 }; | 88 }; |
| 95 | 89 |
| 96 } //namespace | 90 } //namespace |
| 97 | 91 |
| 98 #endif | 92 #endif |
| OLD | NEW |