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

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

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address kbr@'s comments Created 4 years, 6 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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPre multiplyAlpha); 52 std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPre multiplyAlpha);
53 unsigned long width() const; 53 unsigned long width() const;
54 unsigned long height() const; 54 unsigned long height() const;
55 IntSize size() const; 55 IntSize size() const;
56 56
57 bool isNeutered() const { return m_isNeutered; } 57 bool isNeutered() const { return m_isNeutered; }
58 bool originClean() const { return m_image->originClean(); } 58 bool originClean() const { return m_image->originClean(); }
59 bool isPremultiplied() const { return m_image->isPremultiplied(); } 59 bool isPremultiplied() const { return m_image->isPremultiplied(); }
60 PassRefPtr<StaticBitmapImage> transfer(); 60 PassRefPtr<StaticBitmapImage> transfer();
61 void close(); 61 void close();
62 bool isTextureBacked() const;
62 63
63 ~ImageBitmap() override; 64 ~ImageBitmap() override;
64 65
65 // CanvasImageSource implementation 66 // CanvasImageSource implementation
66 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt, SnapshotReason, const FloatSize&) const override; 67 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt, SnapshotReason, const FloatSize&) const override;
67 bool wouldTaintOrigin(SecurityOrigin*) const override { return !m_image->ori ginClean(); } 68 bool wouldTaintOrigin(SecurityOrigin*) const override { return !m_image->ori ginClean(); }
68 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; 69 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override;
69 FloatSize elementSize(const FloatSize&) const override; 70 FloatSize elementSize(const FloatSize&) const override;
70 bool isImageBitmap() const override { return true; } 71 bool isImageBitmap() const override { return true; }
72 int sourceWidth() override { return m_image ? m_image->width() : 0; }
73 int sourceHeight() override { return m_image ? m_image->height() : 0; }
71 74
72 // ImageBitmapSource implementation 75 // ImageBitmapSource implementation
73 IntSize bitmapSourceSize() const override { return size(); } 76 IntSize bitmapSourceSize() const override { return size(); }
74 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; 77 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override;
75 78
76 DECLARE_VIRTUAL_TRACE(); 79 DECLARE_VIRTUAL_TRACE();
77 80
78 private: 81 private:
79 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO ptions&); 82 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO ptions&);
80 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO ptions&); 83 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO ptions&);
81 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); 84 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&);
82 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&, const boo l&); 85 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&, const boo l&);
83 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); 86 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&);
84 ImageBitmap(PassRefPtr<StaticBitmapImage>); 87 ImageBitmap(PassRefPtr<StaticBitmapImage>);
85 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap Options&); 88 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap Options&);
86 ImageBitmap(WebExternalTextureMailbox&); 89 ImageBitmap(WebExternalTextureMailbox&);
87 90
88 void parseOptions(const ImageBitmapOptions&, bool&, bool&); 91 void parseOptions(const ImageBitmapOptions&, bool&, bool&);
89 92
90 RefPtr<StaticBitmapImage> m_image; 93 RefPtr<StaticBitmapImage> m_image;
91 bool m_isNeutered = false; 94 bool m_isNeutered = false;
92 }; 95 };
93 96
94 } // namespace blink 97 } // namespace blink
95 98
96 #endif // ImageBitmap_h 99 #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