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

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

Issue 2348263005: Eliminate one copy from ImageBitmap deserialization. (Closed)
Patch Set: Created 4 years, 3 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 // 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"
(...skipping 30 matching lines...) Expand all
41 static ImageBitmap* create(HTMLImageElement*, Optional<IntRect>, Document*, const ImageBitmapOptions& = ImageBitmapOptions()); 41 static ImageBitmap* create(HTMLImageElement*, Optional<IntRect>, Document*, const ImageBitmapOptions& = ImageBitmapOptions());
42 static ImageBitmap* create(HTMLVideoElement*, Optional<IntRect>, Document*, const ImageBitmapOptions& = ImageBitmapOptions()); 42 static ImageBitmap* create(HTMLVideoElement*, Optional<IntRect>, Document*, const ImageBitmapOptions& = ImageBitmapOptions());
43 static ImageBitmap* create(HTMLCanvasElement*, Optional<IntRect>, const Imag eBitmapOptions& = ImageBitmapOptions()); 43 static ImageBitmap* create(HTMLCanvasElement*, Optional<IntRect>, const Imag eBitmapOptions& = ImageBitmapOptions());
44 static ImageBitmap* create(ImageData*, Optional<IntRect>, const ImageBitmapO ptions& = ImageBitmapOptions()); 44 static ImageBitmap* create(ImageData*, Optional<IntRect>, const ImageBitmapO ptions& = ImageBitmapOptions());
45 static ImageBitmap* create(ImageBitmap*, Optional<IntRect>, const ImageBitma pOptions& = ImageBitmapOptions()); 45 static ImageBitmap* create(ImageBitmap*, Optional<IntRect>, const ImageBitma pOptions& = ImageBitmapOptions());
46 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); 46 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>);
47 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBitmapOptions& = ImageBitmapOptions()); 47 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBitmapOptions& = ImageBitmapOptions());
48 // This function is called by structured-cloning an ImageBitmap. 48 // This function is called by structured-cloning an ImageBitmap.
49 // isImageBitmapPremultiplied indicates whether the original ImageBitmap is premultiplied or not. 49 // isImageBitmapPremultiplied indicates whether the original ImageBitmap is premultiplied or not.
50 // isImageBitmapOriginClean indicates whether the original ImageBitmap is or igin clean or not. 50 // isImageBitmapOriginClean indicates whether the original ImageBitmap is or igin clean or not.
51 static ImageBitmap* create(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean) ; 51 static ImageBitmap* create(const void* pixelData, uint32_t width, uint32_t h eight, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean);
52 static sk_sp<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecoder>); 52 static sk_sp<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecoder>);
53 static bool isResizeOptionValid(const ImageBitmapOptions&, ExceptionState&); 53 static bool isResizeOptionValid(const ImageBitmapOptions&, ExceptionState&);
54 static bool isSourceSizeValid(int sourceWidth, int sourceHeight, ExceptionSt ate&); 54 static bool isSourceSizeValid(int sourceWidth, int sourceHeight, ExceptionSt ate&);
55 55
56 // Type and helper function required by CallbackPromiseAdapter: 56 // Type and helper function required by CallbackPromiseAdapter:
57 using WebType = sk_sp<SkImage>; 57 using WebType = sk_sp<SkImage>;
58 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); 58 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>);
59 59
60 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } 60 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; }
61 PassRefPtr<Uint8Array> copyBitmapData(AlphaDisposition = DontPremultiplyAlph a, DataColorFormat = RGBAColorType); 61 PassRefPtr<Uint8Array> copyBitmapData(AlphaDisposition = DontPremultiplyAlph a, DataColorFormat = RGBAColorType);
(...skipping 26 matching lines...) Expand all
88 DECLARE_VIRTUAL_TRACE(); 88 DECLARE_VIRTUAL_TRACE();
89 89
90 private: 90 private:
91 ImageBitmap(HTMLImageElement*, Optional<IntRect>, Document*, const ImageBitm apOptions&); 91 ImageBitmap(HTMLImageElement*, Optional<IntRect>, Document*, const ImageBitm apOptions&);
92 ImageBitmap(HTMLVideoElement*, Optional<IntRect>, Document*, const ImageBitm apOptions&); 92 ImageBitmap(HTMLVideoElement*, Optional<IntRect>, Document*, const ImageBitm apOptions&);
93 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions& ); 93 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions& );
94 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); 94 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&);
95 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); 95 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&);
96 ImageBitmap(PassRefPtr<StaticBitmapImage>); 96 ImageBitmap(PassRefPtr<StaticBitmapImage>);
97 ImageBitmap(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBit mapOptions&); 97 ImageBitmap(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBit mapOptions&);
98 ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height , bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean); 98 ImageBitmap(const void* pixelData, uint32_t width, uint32_t height, bool isI mageBitmapPremultiplied, bool isImageBitmapOriginClean);
99 99
100 RefPtr<StaticBitmapImage> m_image; 100 RefPtr<StaticBitmapImage> m_image;
101 bool m_isNeutered = false; 101 bool m_isNeutered = false;
102 }; 102 };
103 103
104 } // namespace blink 104 } // namespace blink
105 105
106 #endif // ImageBitmap_h 106 #endif // ImageBitmap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698