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

Side by Side Diff: Source/platform/graphics/ImageBufferSurface.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) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ImageBufferSurface_h 31 #ifndef ImageBufferSurface_h
32 #define ImageBufferSurface_h 32 #define ImageBufferSurface_h
33 33
34 #include "Image.h"
Justin Novosad 2014/07/29 14:56:52 No need for this header.
Rémi Piotaix 2014/07/29 17:18:23 Done.
34 #include "platform/PlatformExport.h" 35 #include "platform/PlatformExport.h"
35 #include "platform/geometry/IntSize.h" 36 #include "platform/geometry/IntSize.h"
36 #include "platform/graphics/GraphicsTypes3D.h" 37 #include "platform/graphics/GraphicsTypes3D.h"
37 #include "wtf/FastAllocBase.h" 38 #include "wtf/FastAllocBase.h"
38 #include "wtf/Noncopyable.h" 39 #include "wtf/Noncopyable.h"
39 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
40 41
41 class SkBitmap; 42 class SkBitmap;
42 class SkCanvas; 43 class SkCanvas;
43 class SkPicture; 44 class SkPicture;
(...skipping 25 matching lines...) Expand all
69 virtual Platform3DObject getBackingTexture() const { return 0; } 70 virtual Platform3DObject getBackingTexture() const { return 0; }
70 virtual bool cachedBitmapEnabled() const { return false; } 71 virtual bool cachedBitmapEnabled() const { return false; }
71 virtual const SkBitmap& cachedBitmap() const; 72 virtual const SkBitmap& cachedBitmap() const;
72 virtual void invalidateCachedBitmap() { } 73 virtual void invalidateCachedBitmap() { }
73 virtual void updateCachedBitmapIfNeeded() { } 74 virtual void updateCachedBitmapIfNeeded() { }
74 virtual void setIsHidden(bool) { } 75 virtual void setIsHidden(bool) { }
75 virtual void setImageBuffer(ImageBuffer*) { } 76 virtual void setImageBuffer(ImageBuffer*) { }
76 virtual PassRefPtr<SkPicture> getPicture(); 77 virtual PassRefPtr<SkPicture> getPicture();
77 virtual void didClearCanvas() { } 78 virtual void didClearCanvas() { }
78 79
80 virtual PassRefPtr<SkImage> newImageSnapshot() const { return nullptr; }
81
79 OpacityMode opacityMode() const { return m_opacityMode; } 82 OpacityMode opacityMode() const { return m_opacityMode; }
80 const IntSize& size() const { return m_size; } 83 const IntSize& size() const { return m_size; }
81 void notifyIsValidChanged(bool isValid) const; 84 void notifyIsValidChanged(bool isValid) const;
82 85
83 protected: 86 protected:
84 ImageBufferSurface(const IntSize&, OpacityMode); 87 ImageBufferSurface(const IntSize&, OpacityMode);
85 void clear(); 88 void clear();
86 89
87 private: 90 private:
88 OpacityMode m_opacityMode; 91 OpacityMode m_opacityMode;
89 IntSize m_size; 92 IntSize m_size;
90 }; 93 };
91 94
92 } // namespace blink 95 } // namespace blink
93 96
94 #endif 97 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698