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

Unified Diff: Source/platform/graphics/Pattern.h

Issue 358893002: Use newImageSnapshot() to get an image from a Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correcting bugs and use new cache mechanism from SkImage Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/Pattern.h
diff --git a/Source/platform/graphics/Pattern.h b/Source/platform/graphics/Pattern.h
index 3a2b89d5096d1466ee0aac8668f6339ac3d5448b..ef0ba2f79cfc871ece2d2d06c00813481fbcec31 100644
--- a/Source/platform/graphics/Pattern.h
+++ b/Source/platform/graphics/Pattern.h
@@ -32,6 +32,7 @@
#include "SkShader.h"
#include "platform/PlatformExport.h"
#include "platform/graphics/Image.h"
+#include "platform/graphics/StaticBitmapImage.h"
Justin Novosad 2014/07/29 14:56:52 No need for include.
Rémi Piotaix 2014/07/29 17:18:23 Done.
#include "platform/transforms/AffineTransform.h"
#include "wtf/PassRefPtr.h"
@@ -40,35 +41,36 @@
namespace blink {
-class AffineTransform;
-
class PLATFORM_EXPORT Pattern : public RefCounted<Pattern> {
public:
- static PassRefPtr<Pattern> create(PassRefPtr<Image> tileImage, bool repeatX, bool repeatY)
- {
- return adoptRef(new Pattern(tileImage, repeatX, repeatY));
- }
- ~Pattern();
+ static PassRefPtr<Pattern> create(PassRefPtr<Image> tileImage, bool repeatX, bool repeatY);
+
+ virtual ~Pattern();
Justin Novosad 2014/07/29 14:56:52 The pattern destructor should be responsible for f
Rémi Piotaix 2014/07/29 17:18:23 Already in Pattern.cpp ?
SkShader* shader();
void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformation);
- const AffineTransform& getPatternSpaceTransform() { return m_patternSpaceTransformation; };
+ const AffineTransform& getPatternSpaceTransform() { return m_patternSpaceTransformation; }
bool repeatX() const { return m_repeatX; }
bool repeatY() const { return m_repeatY; }
+protected:
+ virtual PassRefPtr<SkShader> createShader() = 0;
-private:
- Pattern(PassRefPtr<Image>, bool repeatX, bool repeatY);
+ Pattern(bool repeatX, bool repeatY)
+ : m_repeatX(repeatX)
+ , m_repeatY(repeatY)
+ , m_externalMemoryAllocated(0) { }
- RefPtr<NativeImageSkia> m_tileImage;
bool m_repeatX;
bool m_repeatY;
AffineTransform m_patternSpaceTransformation;
- RefPtr<SkShader> m_pattern;
int m_externalMemoryAllocated;
Justin Novosad 2014/07/29 14:56:52 should probably be intptr_t. What type does v8 ex
Rémi Piotaix 2014/07/30 18:59:12 Done.
+
+private:
+ RefPtr<SkShader> m_pattern;
};
-} //namespace
+} // namespace
#endif

Powered by Google App Engine
This is Rietveld 408576698