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

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: Created ImagePattern and StaticBitmapImage 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 unified diff | Download patch
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 15 matching lines...) Expand all
26 26
27 #ifndef Image_h 27 #ifndef Image_h
28 #define Image_h 28 #define Image_h
29 29
30 #include "platform/PlatformExport.h" 30 #include "platform/PlatformExport.h"
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "platform/graphics/Color.h" 32 #include "platform/graphics/Color.h"
33 #include "platform/graphics/GraphicsTypes.h" 33 #include "platform/graphics/GraphicsTypes.h"
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/SkImage.h"
36 #include "third_party/skia/include/core/SkXfermode.h" 37 #include "third_party/skia/include/core/SkXfermode.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 #include "wtf/RefPtr.h"
40 #include "wtf/RetainPtr.h" 41 #include "wtf/RetainPtr.h"
41 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 class FloatPoint; 46 class FloatPoint;
(...skipping 15 matching lines...) Expand all
61 public: 62 public:
62 virtual ~Image(); 63 virtual ~Image();
63 64
64 static PassRefPtr<Image> loadPlatformResource(const char* name); 65 static PassRefPtr<Image> loadPlatformResource(const char* name);
65 static bool supportsType(const String&); 66 static bool supportsType(const String&);
66 67
67 virtual bool isSVGImage() const { return false; } 68 virtual bool isSVGImage() const { return false; }
68 virtual bool isBitmapImage() const { return false; } 69 virtual bool isBitmapImage() const { return false; }
69 virtual bool currentFrameKnownToBeOpaque() = 0; 70 virtual bool currentFrameKnownToBeOpaque() = 0;
70 71
72 virtual PassRefPtr<SkImage> image() { return nullptr; }
73
71 // Derived classes should override this if they can assure that the current 74 // Derived classes should override this if they can assure that the current
72 // image frame contains only resources from its own security origin. 75 // image frame contains only resources from its own security origin.
73 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } 76 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; }
74 77
75 static Image* nullImage(); 78 static Image* nullImage();
76 bool isNull() const { return size().isEmpty(); } 79 bool isNull() const { return size().isEmpty(); }
77 80
78 virtual void setContainerSize(const IntSize&) { } 81 virtual void setContainerSize(const IntSize&) { }
79 virtual bool usesContainerSize() const { return false; } 82 virtual bool usesContainerSize() const { return false; }
80 virtual bool hasRelativeWidth() const { return false; } 83 virtual bool hasRelativeWidth() const { return false; }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 RefPtr<SharedBuffer> m_encodedImageData; 145 RefPtr<SharedBuffer> m_encodedImageData;
143 ImageObserver* m_imageObserver; 146 ImageObserver* m_imageObserver;
144 }; 147 };
145 148
146 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 149 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
147 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 150 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
148 151
149 } 152 }
150 153
151 #endif 154 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698