Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 enum AlphaDisposition { | 29 enum AlphaDisposition { |
| 30 PremultiplyAlpha, | 30 PremultiplyAlpha, |
| 31 DontPremultiplyAlpha, | 31 DontPremultiplyAlpha, |
| 32 }; | 32 }; |
| 33 enum DataColorFormat { | 33 enum DataColorFormat { |
| 34 RGBAColorType, | 34 RGBAColorType, |
| 35 N32ColorType, | 35 N32ColorType, |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 struct ParsedOptions { | |
|
jbroman
2016/07/07 19:18:00
This struct (and the method that makes it) seem pr
xidachen
2016/07/07 20:43:29
Done.
| |
| 39 bool flipY = false; | |
| 40 bool premultiplyAlpha = true; | |
| 41 bool shouldScaleInput = false; | |
| 42 unsigned resizeWidth = 0; | |
| 43 unsigned resizeHeight = 0; | |
| 44 SkFilterQuality resizeQuality = kLow_SkFilterQuality; | |
| 45 }; | |
| 46 | |
| 38 class CORE_EXPORT ImageBitmap final : public GarbageCollectedFinalized<ImageBitm ap>, public ScriptWrappable, public CanvasImageSource, public ImageBitmapSource { | 47 class CORE_EXPORT ImageBitmap final : public GarbageCollectedFinalized<ImageBitm ap>, public ScriptWrappable, public CanvasImageSource, public ImageBitmapSource { |
| 39 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
| 40 public: | 49 public: |
| 41 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); | 50 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); |
| 42 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); | 51 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); |
| 43 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi tmapOptions& = ImageBitmapOptions()); | 52 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi tmapOptions& = ImageBitmapOptions()); |
| 44 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti ons& = ImageBitmapOptions()); | 53 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti ons& = ImageBitmapOptions()); |
| 45 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp tions& = ImageBitmapOptions()); | 54 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp tions& = ImageBitmapOptions()); |
| 46 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); | 55 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); |
| 47 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co nst ImageBitmapOptions& = ImageBitmapOptions()); | 56 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co nst ImageBitmapOptions& = ImageBitmapOptions()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 int sourceWidth() override { return m_image ? m_image->width() : 0; } | 89 int sourceWidth() override { return m_image ? m_image->width() : 0; } |
| 81 int sourceHeight() override { return m_image ? m_image->height() : 0; } | 90 int sourceHeight() override { return m_image ? m_image->height() : 0; } |
| 82 | 91 |
| 83 // ImageBitmapSource implementation | 92 // ImageBitmapSource implementation |
| 84 IntSize bitmapSourceSize() const override { return size(); } | 93 IntSize bitmapSourceSize() const override { return size(); } |
| 85 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; | 94 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; |
| 86 | 95 |
| 87 DECLARE_VIRTUAL_TRACE(); | 96 DECLARE_VIRTUAL_TRACE(); |
| 88 | 97 |
| 89 private: | 98 private: |
| 90 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO ptions&); | 99 ImageBitmap(HTMLImageElement*, IntRect&, Document*, const ImageBitmapOptions &); |
| 91 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO ptions&); | 100 ImageBitmap(HTMLVideoElement*, IntRect&, Document*, const ImageBitmapOptions &); |
| 92 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); | 101 ImageBitmap(HTMLCanvasElement*, IntRect&, const ImageBitmapOptions&); |
| 93 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&); | 102 ImageBitmap(ImageData*, IntRect&, const ImageBitmapOptions&); |
| 94 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); | 103 ImageBitmap(ImageBitmap*, IntRect&, const ImageBitmapOptions&); |
| 95 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 104 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
| 96 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap Options&); | 105 ImageBitmap(PassRefPtr<StaticBitmapImage>, IntRect&, const ImageBitmapOption s&); |
| 97 ImageBitmap(WebExternalTextureMailbox&); | 106 ImageBitmap(WebExternalTextureMailbox&); |
| 98 ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height , bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean); | 107 ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height , bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean); |
| 99 | 108 |
| 100 void parseOptions(const ImageBitmapOptions&, bool&, bool&); | 109 ParsedOptions parseOptions(const ImageBitmapOptions&, const int, const int); |
|
jbroman
2016/07/07 19:18:00
Please name parameters whose use is not obvious, l
xidachen
2016/07/07 20:43:29
This line is removed because this function is now
| |
| 101 | 110 |
| 102 RefPtr<StaticBitmapImage> m_image; | 111 RefPtr<StaticBitmapImage> m_image; |
| 103 bool m_isNeutered = false; | 112 bool m_isNeutered = false; |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 } // namespace blink | 115 } // namespace blink |
| 107 | 116 |
| 108 #endif // ImageBitmap_h | 117 #endif // ImageBitmap_h |
| OLD | NEW |