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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.h

Issue 1696753002: Change createImageBitmap(Blob) to use ImageDecoder instead of ImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ImageBitmap_h 5 #ifndef ImageBitmap_h
6 #define ImageBitmap_h 6 #define ImageBitmap_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
11 #include "core/html/canvas/CanvasImageSource.h" 11 #include "core/html/canvas/CanvasImageSource.h"
12 #include "core/imagebitmap/ImageBitmapOptions.h" 12 #include "core/imagebitmap/ImageBitmapOptions.h"
13 #include "core/imagebitmap/ImageBitmapSource.h" 13 #include "core/imagebitmap/ImageBitmapSource.h"
14 #include "platform/geometry/IntRect.h" 14 #include "platform/geometry/IntRect.h"
15 #include "platform/graphics/Image.h" 15 #include "platform/graphics/Image.h"
16 #include "platform/graphics/ImageBuffer.h" 16 #include "platform/graphics/ImageBuffer.h"
17 #include "platform/graphics/StaticBitmapImage.h" 17 #include "platform/graphics/StaticBitmapImage.h"
18 #include "platform/heap/Handle.h" 18 #include "platform/heap/Handle.h"
19 #include "wtf/PassRefPtr.h" 19 #include "wtf/PassRefPtr.h"
20 #include "wtf/RefCounted.h" 20 #include "wtf/RefCounted.h"
21 21
22 namespace blink { 22 namespace blink {
23 23
24 class HTMLCanvasElement; 24 class HTMLCanvasElement;
25 class HTMLVideoElement; 25 class HTMLVideoElement;
26 class ImageData; 26 class ImageData;
27 class ImageDecoder;
27 28
28 enum AlphaDisposition { 29 enum AlphaDisposition {
29 PremultiplyAlpha, 30 PremultiplyAlpha,
30 DontPremultiplyAlpha, 31 DontPremultiplyAlpha,
31 }; 32 };
32 33
33 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public CanvasImageSource, public Im ageBitmapSource { 34 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public CanvasImageSource, public Im ageBitmapSource {
34 DEFINE_WRAPPERTYPEINFO(); 35 DEFINE_WRAPPERTYPEINFO();
35 public: 36 public:
36 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&, Document*, const ImageBitmapOptions& = ImageBitmapOptions()); 37 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&, Document*, const ImageBitmapOptions& = ImageBitmapOptions());
37 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&, Document*, const ImageBitmapOptions& = ImageBitmapOptions()); 38 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&, Document*, const ImageBitmapOptions& = ImageBitmapOptions());
38 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions()); 39 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions());
39 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& , const ImageBitmapOptions& = ImageBitmapOptions()); 40 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& , const ImageBitmapOptions& = ImageBitmapOptions());
40 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&, const ImageBitmapOptions& = ImageBitmapOptions()); 41 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&, const ImageBitmapOptions& = ImageBitmapOptions());
41 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<StaticBitmapIma ge>); 42 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<StaticBitmapIma ge>);
42 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<StaticBitmapIma ge>, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions()); 43 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<StaticBitmapIma ge>, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions());
44 static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>);
43 45
44 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } 46 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; }
45 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti plyAlpha); 47 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti plyAlpha);
46 unsigned long width() const; 48 unsigned long width() const;
47 unsigned long height() const; 49 unsigned long height() const;
48 IntSize size() const; 50 IntSize size() const;
49 51
50 bool isNeutered() const { return m_isNeutered; } 52 bool isNeutered() const { return m_isNeutered; }
51 bool originClean() const { return m_image->originClean(); } 53 bool originClean() const { return m_image->originClean(); }
52 bool isPremultiplied() const { return m_isPremultiplied; } 54 bool isPremultiplied() const { return m_isPremultiplied; }
(...skipping 26 matching lines...) Expand all
79 void parseOptions(const ImageBitmapOptions&, bool&); 81 void parseOptions(const ImageBitmapOptions&, bool&);
80 82
81 RefPtr<StaticBitmapImage> m_image; 83 RefPtr<StaticBitmapImage> m_image;
82 bool m_isNeutered = false; 84 bool m_isNeutered = false;
83 bool m_isPremultiplied = true; 85 bool m_isPremultiplied = true;
84 }; 86 };
85 87
86 } // namespace blink 88 } // namespace blink
87 89
88 #endif // ImageBitmap_h 90 #endif // ImageBitmap_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698