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

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

Issue 1457683006: ImageBitmap using StaticBitmapImage instead of SkImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 "platform/geometry/IntRect.h" 12 #include "platform/geometry/IntRect.h"
13 #include "platform/graphics/Image.h" 13 #include "platform/graphics/Image.h"
14 #include "platform/graphics/ImageBuffer.h" 14 #include "platform/graphics/ImageBuffer.h"
15 #include "platform/graphics/StaticBitmapImage.h"
15 #include "platform/heap/Handle.h" 16 #include "platform/heap/Handle.h"
16 #include "third_party/skia/include/core/SkImage.h"
17 #include "wtf/PassRefPtr.h" 17 #include "wtf/PassRefPtr.h"
18 #include "wtf/RefCounted.h" 18 #include "wtf/RefCounted.h"
19 19
20 namespace blink { 20 namespace blink {
21 21
22 class HTMLCanvasElement; 22 class HTMLCanvasElement;
23 class HTMLVideoElement; 23 class HTMLVideoElement;
24 class ImageData; 24 class ImageData;
25 25
26 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient, public Ca nvasImageSource { 26 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient, public Ca nvasImageSource {
27 DEFINE_WRAPPERTYPEINFO(); 27 DEFINE_WRAPPERTYPEINFO();
28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmap); 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmap);
29 public: 29 public:
30 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&); 30 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&);
31 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&); 31 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&);
32 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); 32 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&);
33 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& ); 33 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& );
34 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&); 34 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&);
35 static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&); 35 static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&);
36 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<StaticBitmapIma ge>);
Justin Novosad 2015/11/20 21:23:12 Why is this needed?
xidachen 2015/11/20 21:51:26 Done.
36 37
37 SkImage* skImage() const { return (m_image) ? m_image.get() : nullptr; } 38 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; }
38 unsigned long width() const; 39 unsigned long width() const;
39 unsigned long height() const; 40 unsigned long height() const;
40 IntSize size() const; 41 IntSize size() const;
41 42
42 ~ImageBitmap() override; 43 ~ImageBitmap() override;
43 44
44 // CanvasImageSource implementation 45 // CanvasImageSource implementation
45 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt) const override; 46 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt) const override;
46 bool wouldTaintOrigin(SecurityOrigin*) const override { return false; } 47 bool wouldTaintOrigin(SecurityOrigin*) const override { return false; }
47 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; 48 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override;
48 FloatSize elementSize() const override; 49 FloatSize elementSize() const override;
49 50
50 DECLARE_VIRTUAL_TRACE(); 51 DECLARE_VIRTUAL_TRACE();
51 52
52 private: 53 private:
53 ImageBitmap(HTMLImageElement*, const IntRect&); 54 ImageBitmap(HTMLImageElement*, const IntRect&);
54 ImageBitmap(HTMLVideoElement*, const IntRect&); 55 ImageBitmap(HTMLVideoElement*, const IntRect&);
55 ImageBitmap(HTMLCanvasElement*, const IntRect&); 56 ImageBitmap(HTMLCanvasElement*, const IntRect&);
56 ImageBitmap(ImageData*, const IntRect&); 57 ImageBitmap(ImageData*, const IntRect&);
57 ImageBitmap(ImageBitmap*, const IntRect&); 58 ImageBitmap(ImageBitmap*, const IntRect&);
58 ImageBitmap(Image*, const IntRect&); 59 ImageBitmap(Image*, const IntRect&);
60 ImageBitmap(PassRefPtr<StaticBitmapImage>);
59 61
60 PassRefPtr<SkImage> cropImage(PassRefPtr<SkImage>, const IntRect&); 62 PassRefPtr<StaticBitmapImage> cropImage(StaticBitmapImage*, const IntRect&);
61 63
62 // ImageLoaderClient 64 // ImageLoaderClient
63 void notifyImageSourceChanged() override; 65 void notifyImageSourceChanged() override;
64 bool requestsHighLiveResourceCachePriority() override { return true; } 66 bool requestsHighLiveResourceCachePriority() override { return true; }
65 67
66 RefPtr<SkImage> m_image; 68 RefPtr<StaticBitmapImage> m_image;
67 }; 69 };
68 70
69 } // namespace blink 71 } // namespace blink
70 72
71 #endif // ImageBitmap_h 73 #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