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

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: Correcting bugs and use new cache mechanism from SkImage Created 6 years, 4 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"
Justin Novosad 2014/07/29 14:56:52 forward declare instead.
Rémi Piotaix 2014/07/29 17:18:22 Done.
36 #include "third_party/skia/include/core/SkXfermode.h" 37 #include "third_party/skia/include/core/SkXfermode.h"
37 #include "wtf/Assertions.h" 38 #include "wtf/Assertions.h"
38 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
41 #include "wtf/RetainPtr.h" 42 #include "wtf/RetainPtr.h"
42 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
(...skipping 16 matching lines...) Expand all
62 public: 63 public:
63 virtual ~Image(); 64 virtual ~Image();
64 65
65 static PassRefPtr<Image> loadPlatformResource(const char* name); 66 static PassRefPtr<Image> loadPlatformResource(const char* name);
66 static bool supportsType(const String&); 67 static bool supportsType(const String&);
67 68
68 virtual bool isSVGImage() const { return false; } 69 virtual bool isSVGImage() const { return false; }
69 virtual bool isBitmapImage() const { return false; } 70 virtual bool isBitmapImage() const { return false; }
70 virtual bool currentFrameKnownToBeOpaque() = 0; 71 virtual bool currentFrameKnownToBeOpaque() = 0;
71 72
73 virtual PassRefPtr<SkImage> image() { return nullptr; }
Justin Novosad 2014/07/29 14:56:52 move to .cpp if SkImage is forward declared.
Rémi Piotaix 2014/07/29 17:18:22 Done.
74
72 // Derived classes should override this if they can assure that the current 75 // Derived classes should override this if they can assure that the current
73 // image frame contains only resources from its own security origin. 76 // image frame contains only resources from its own security origin.
74 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; } 77 virtual bool currentFrameHasSingleSecurityOrigin() const { return false; }
75 78
76 static Image* nullImage(); 79 static Image* nullImage();
77 bool isNull() const { return size().isEmpty(); } 80 bool isNull() const { return size().isEmpty(); }
78 81
79 virtual void setContainerSize(const IntSize&) { } 82 virtual void setContainerSize(const IntSize&) { }
80 virtual bool usesContainerSize() const { return false; } 83 virtual bool usesContainerSize() const { return false; }
81 virtual bool hasRelativeWidth() const { return false; } 84 virtual bool hasRelativeWidth() const { return false; }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 RefPtr<SharedBuffer> m_encodedImageData; 146 RefPtr<SharedBuffer> m_encodedImageData;
144 ImageObserver* m_imageObserver; 147 ImageObserver* m_imageObserver;
145 }; 148 };
146 149
147 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 150 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
148 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 151 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
149 152
150 } 153 }
151 154
152 #endif 155 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698