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

Side by Side Diff: Source/platform/graphics/Image.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: Corrections Created 6 years, 2 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
« no previous file with comments | « Source/platform/graphics/GraphicsContext.cpp ('k') | Source/platform/graphics/Image.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 23 matching lines...) Expand all
34 #include "platform/graphics/ImageOrientation.h" 34 #include "platform/graphics/ImageOrientation.h"
35 #include "platform/graphics/skia/NativeImageSkia.h" 35 #include "platform/graphics/skia/NativeImageSkia.h"
36 #include "third_party/skia/include/core/SkXfermode.h" 36 #include "third_party/skia/include/core/SkXfermode.h"
37 #include "wtf/Assertions.h" 37 #include "wtf/Assertions.h"
38 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 #include "wtf/RetainPtr.h" 41 #include "wtf/RetainPtr.h"
42 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
43 43
44 class SkImage;
45
44 namespace blink { 46 namespace blink {
45 47
46 class FloatPoint; 48 class FloatPoint;
47 class FloatRect; 49 class FloatRect;
48 class FloatSize; 50 class FloatSize;
49 class GraphicsContext; 51 class GraphicsContext;
50 class Length; 52 class Length;
51 class SharedBuffer; 53 class SharedBuffer;
52 54
53 // This class gets notified when an image creates or destroys decoded frames and when it advances animation frames. 55 // This class gets notified when an image creates or destroys decoded frames and when it advances animation frames.
54 class ImageObserver; 56 class ImageObserver;
55 57
56 class PLATFORM_EXPORT Image : public RefCounted<Image> { 58 class PLATFORM_EXPORT Image : public RefCounted<Image> {
57 friend class GeneratedImage; 59 friend class GeneratedImage;
58 friend class CrossfadeGeneratedImage; 60 friend class CrossfadeGeneratedImage;
59 friend class GradientGeneratedImage; 61 friend class GradientGeneratedImage;
60 friend class GraphicsContext; 62 friend class GraphicsContext;
61 63
62 public: 64 public:
63 virtual ~Image(); 65 virtual ~Image();
64 66
65 static PassRefPtr<Image> loadPlatformResource(const char* name); 67 static PassRefPtr<Image> loadPlatformResource(const char* name);
66 static bool supportsType(const String&); 68 static bool supportsType(const String&);
67 69
68 virtual bool isSVGImage() const { return false; } 70 virtual bool isSVGImage() const { return false; }
69 virtual bool isBitmapImage() const { return false; } 71 virtual bool isBitmapImage() const { return false; }
70 virtual bool currentFrameKnownToBeOpaque() = 0; 72 virtual bool currentFrameKnownToBeOpaque() = 0;
71 73
74 virtual PassRefPtr<SkImage> skImage();
75
72 // Derived classes should override this if they can assure that the current 76 // Derived classes should override this if they can assure that the current
73 // image frame contains only resources from its own security origin. 77 // image frame contains only resources from its own security origin.
74 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } 78 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; }
75 79
76 static Image* nullImage(); 80 static Image* nullImage();
77 bool isNull() const { return size().isEmpty(); } 81 bool isNull() const { return size().isEmpty(); }
78 82
79 virtual void setContainerSize(const IntSize&) { } 83 virtual void setContainerSize(const IntSize&) { }
80 virtual bool usesContainerSize() const { return false; } 84 virtual bool usesContainerSize() const { return false; }
81 virtual bool hasRelativeWidth() const { return false; } 85 virtual bool hasRelativeWidth() const { return false; }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 RefPtr<SharedBuffer> m_encodedImageData; 149 RefPtr<SharedBuffer> m_encodedImageData;
146 ImageObserver* m_imageObserver; 150 ImageObserver* m_imageObserver;
147 }; 151 };
148 152
149 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 153 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
150 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 154 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
151 155
152 } // namespace blink 156 } // namespace blink
153 157
154 #endif 158 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContext.cpp ('k') | Source/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698