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

Side by Side Diff: sky/engine/core/frame/ImageBitmap.h

Issue 1001913003: Remove <canvas> (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 | « sky/engine/core/editing/Editor.cpp ('k') | sky/engine/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 SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_ 5 #ifndef SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_
6 #define SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_ 6 #define SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_
7 7
8 #include "sky/engine/tonic/dart_wrappable.h" 8 #include "sky/engine/tonic/dart_wrappable.h"
9 #include "sky/engine/core/html/HTMLImageElement.h" 9 #include "sky/engine/core/html/HTMLImageElement.h"
10 #include "sky/engine/core/html/canvas/CanvasImageSource.h"
11 #include "sky/engine/platform/geometry/IntRect.h" 10 #include "sky/engine/platform/geometry/IntRect.h"
12 #include "sky/engine/platform/graphics/Image.h" 11 #include "sky/engine/platform/graphics/Image.h"
13 #include "sky/engine/platform/heap/Handle.h" 12 #include "sky/engine/platform/heap/Handle.h"
14 #include "sky/engine/wtf/PassRefPtr.h" 13 #include "sky/engine/wtf/PassRefPtr.h"
15 #include "sky/engine/wtf/RefCounted.h" 14 #include "sky/engine/wtf/RefCounted.h"
16 15
17 namespace blink { 16 namespace blink {
18 17
19 class HTMLCanvasElement;
20 class ImageData; 18 class ImageData;
21 19
22 class ImageBitmap final : public RefCounted<ImageBitmap>, public DartWrappable, public ImageLoaderClient, public CanvasImageSource { 20 class ImageBitmap final : public RefCounted<ImageBitmap>, public DartWrappable, public ImageLoaderClient {
23 DEFINE_WRAPPERTYPEINFO(); 21 DEFINE_WRAPPERTYPEINFO();
24 public: 22 public:
25 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); 23 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&);
26 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&);
27 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); 24 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&);
28 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); 25 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&);
29 static PassRefPtr<ImageBitmap> create(Image*, const IntRect&); 26 static PassRefPtr<ImageBitmap> create(Image*, const IntRect&);
30 27
31 PassRefPtr<Image> bitmapImage() const; 28 PassRefPtr<Image> bitmapImage() const;
32 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; } 29 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
33 30
34 IntRect bitmapRect() const { return m_bitmapRect; } 31 IntRect bitmapRect() const { return m_bitmapRect; }
35 32
36 int width() const { return m_cropRect.width(); } 33 int width() const { return m_cropRect.width(); }
37 int height() const { return m_cropRect.height(); } 34 int height() const { return m_cropRect.height(); }
38 IntSize size() const { return m_cropRect.size(); } 35 IntSize size() const { return m_cropRect.size(); }
39 36
40 virtual ~ImageBitmap(); 37 virtual ~ImageBitmap();
41 38
42 // CanvasImageSource implementation
43 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const override;
44 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const o verride;
45 virtual FloatSize sourceSize() const override;
46
47 private: 39 private:
48 ImageBitmap(HTMLImageElement*, const IntRect&); 40 ImageBitmap(HTMLImageElement*, const IntRect&);
49 ImageBitmap(HTMLCanvasElement*, const IntRect&);
50 ImageBitmap(ImageData*, const IntRect&); 41 ImageBitmap(ImageData*, const IntRect&);
51 ImageBitmap(ImageBitmap*, const IntRect&); 42 ImageBitmap(ImageBitmap*, const IntRect&);
52 ImageBitmap(Image*, const IntRect&); 43 ImageBitmap(Image*, const IntRect&);
53 44
54 // ImageLoaderClient 45 // ImageLoaderClient
55 virtual void notifyImageSourceChanged() override; 46 virtual void notifyImageSourceChanged() override;
56 virtual bool requestsHighLiveResourceCachePriority() override { return true; } 47 virtual bool requestsHighLiveResourceCachePriority() override { return true; }
57 48
58 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H TMLImageElement until 49 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H TMLImageElement until
59 // the image source changes. 50 // the image source changes.
60 RefPtr<HTMLImageElement> m_imageElement; 51 RefPtr<HTMLImageElement> m_imageElement;
61 RefPtr<Image> m_bitmap; 52 RefPtr<Image> m_bitmap;
62 53
63 IntRect m_bitmapRect; // The rect where the underlying Image should be place d in reference to the ImageBitmap. 54 IntRect m_bitmapRect; // The rect where the underlying Image should be place d in reference to the ImageBitmap.
64 IntRect m_cropRect; 55 IntRect m_cropRect;
65 56
66 // The offset by which the desired Image is stored internally. 57 // The offset by which the desired Image is stored internally.
67 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag eResource and may have a non-zero bitmap offset. 58 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag eResource and may have a non-zero bitmap offset.
68 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s tore the image at (0, 0). 59 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s tore the image at (0, 0).
69 IntPoint m_bitmapOffset; 60 IntPoint m_bitmapOffset;
70 61
71 }; 62 };
72 63
73 } // namespace blink 64 } // namespace blink
74 65
75 #endif // SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_ 66 #endif // SKY_ENGINE_CORE_FRAME_IMAGEBITMAP_H_
OLDNEW
« no previous file with comments | « sky/engine/core/editing/Editor.cpp ('k') | sky/engine/core/frame/ImageBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698