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

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

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

Powered by Google App Engine
This is Rietveld 408576698