12016-07-12 Said Abou-Hallawa <sabouhallawa@apple.com>
2
3 Split the pixel data of ImageFrame to a separate class
4 https://bugs.webkit.org/show_bug.cgi?id=159679
5
6 Reviewed by NOBODY (OOPS!).
7
8 Move the pixel data manipulation part in ImageFrame into a separate class
9 and then make it optional (allocated on demand).
10
11 * CMakeLists.txt:
12 * PlatformEfl.cmake:
13 * PlatformGTK.cmake:
14 * PlatformWinCairo.cmake:
15 * WebCore.xcodeproj/project.pbxproj:
16 * platform/graphics/BitmapPixels.h: Added.
17 (WebCore::BitmapPixels::create):
18 (WebCore::BitmapPixels::BitmapPixels):
19 (WebCore::BitmapPixels::width):
20 (WebCore::BitmapPixels::height):
21 (WebCore::BitmapPixels::setSize):
22 (WebCore::BitmapPixels::at):
23 (WebCore::BitmapPixels::clear):
24 (WebCore::BitmapPixels::clearRect):
25 (WebCore::BitmapPixels::repeatFirstRow):
26 (WebCore::BitmapPixels::setRGBA):
27 (WebCore::BitmapPixels::overRGBA):
28 (WebCore::BitmapPixels::inBounds):
29 * platform/graphics/Color.cpp:
30 (WebCore::multiply255):
31 (WebCore::divide255):
32 (WebCore::divideCeil):
33 (WebCore::premultipliedChannel):
34 (WebCore::unpremultipliedChannel):
35 (WebCore::makePremultipliedRGBA):
36 (WebCore::makeUnPremultipliedRGBA):
37 * platform/graphics/Color.h:
38 * platform/graphics/ImageFrameData.h:
39 (WebCore::ImageFrameData::pixels):
40 (WebCore::ImageFrameData::hasPixels):
41 * platform/image-decoders/ImageDecoder.cpp:
42 (WebCore::ImageFrame::operator=):
43 (WebCore::ImageFrame::clearPixelData):
44 (WebCore::ImageFrame::zeroFillPixelData):
45 (WebCore::ImageFrame::zeroFillFrameRect):
46 (WebCore::ImageFrame::copyBitmapData):
47 (WebCore::ImageFrame::setSize):
48 (WebCore::ImageFrame::copyRowNTimes):
49 * platform/image-decoders/ImageDecoder.h:
50 (WebCore::ImageFrame::asNewNativeImage):
51 (WebCore::ImageFrame::setRGBA):
52 (WebCore::ImageFrame::getAddr):
53 (WebCore::ImageFrame::hasPixelData):
54 (WebCore::ImageFrame::overRGBA):
55 (WebCore::ImageFrame::width):
56 (WebCore::ImageFrame::height):
57 (WebCore::ImageFrame::copyRowNTimes): Deleted.
58 (WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
59 (WebCore::ImageFrame::divide255): Deleted.
60 * platform/image-decoders/bmp/BMPImageReader.cpp:
61 (WebCore::BMPImageReader::decodeBMP):
62 * platform/image-decoders/cairo/BitmapPixelsCairo.cpp: Renamed from Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp.
63 (WebCore::BitmapPixels::image):
64 * platform/image-decoders/gif/GIFImageDecoder.cpp:
65 (WebCore::GIFImageDecoder::haveDecodedRow):
66 (WebCore::GIFImageDecoder::frameComplete):
67 (WebCore::GIFImageDecoder::initFrameBuffer):
68 * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
69 (WebCore::setPixel):
70 (WebCore::JPEGImageDecoder::outputScanlines):
71 * platform/image-decoders/png/PNGImageDecoder.cpp:
72 (WebCore::setPixelRGB):
73 (WebCore::setPixelRGBA):
74 (WebCore::setPixelPremultipliedRGBA):
75 (WebCore::PNGImageDecoder::rowAvailable):
76 (WebCore::PNGImageDecoder::initFrameBuffer):
77 (WebCore::PNGImageDecoder::frameComplete):
78 * platform/image-decoders/webp/WEBPImageDecoder.cpp:
79 (WebCore::WEBPImageDecoder::decode):
80
812016-07-11 Said Abou-Hallawa <sabouhallawa@apple,com>
82
83 Rename FrameData to ImageFrameData and move it to a separate file
84 https://bugs.webkit.org/show_bug.cgi?id=155444
85
86 Reviewed by NOBODY (OOPS!).
87
88 Move ImageFrameData to a separate file so it can be cached by ImageSource
89 and will still be consumed by BitmapImage. Make the data members of ImageFrameData
90 be private and add getters to return their values.
91
92 No new tests -- Code refactoring, no behavior change.
93
94 * CMakeLists.txt:
95 * WebCore.xcodeproj/project.pbxproj:
96 * platform/graphics/BitmapImage.cpp:
97 (WebCore::BitmapImage::BitmapImage):
98 (WebCore::BitmapImage::haveFrameImageAtIndex):
99 (WebCore::BitmapImage::destroyDecodedData):
100 (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
101 (WebCore::BitmapImage::cacheFrame):
102 (WebCore::BitmapImage::dataChanged):
103 (WebCore::BitmapImage::ensureFrameIsCached):
104 (WebCore::BitmapImage::frameImageAtIndex):
105 (WebCore::BitmapImage::frameIsCompleteAtIndex):
106 (WebCore::BitmapImage::frameDurationAtIndex):
107 (WebCore::BitmapImage::frameHasAlphaAtIndex):
108 (WebCore::BitmapImage::frameOrientationAtIndex):
109 (WebCore::BitmapImage::singlePixelSolidColor):
110 (WebCore::BitmapImage::isAlmostSolidColor):
111 * platform/graphics/BitmapImage.h:
112 (WebCore::FrameData::FrameData): Deleted.
113 (WebCore::FrameData::~FrameData): Deleted.
114 (WebCore::FrameData::usedFrameBytes): Deleted.
115 * platform/graphics/ImageSource.cpp:
116 (WebCore::ImageSource::createFrameDataAtIndex):
117 * platform/graphics/ImageSource.h:
118 * platform/graphics/imageFrameData.cpp: Added.
119 (WebCore::ImageFrameData::ImageFrameData):
120 (WebCore::ImageFrameData::~ImageFrameData):
121 (WebCore::ImageFrameData::clearSubImages):
122 (WebCore::ImageFrameData::clear):
123 (WebCore::ImageFrameData::singlePixelSolidColor):
124 (WebCore::ImageFrameData::isAlmostSolidColor):
125 * platform/graphics/imageFrameData.h: Added.
126 (WebCore::ImageFrameData::status):
127 (WebCore::ImageFrameData::isComplete):
128 (WebCore::ImageFrameData::size):
129 (WebCore::ImageFrameData::frameBytes):
130 (WebCore::ImageFrameData::image):
131 (WebCore::ImageFrameData::orientation):
132 (WebCore::ImageFrameData::subsamplingLevel):
133 (WebCore::ImageFrameData::duration):
134 (WebCore::ImageFrameData::hasAlpha):
135 (WebCore::ImageFrameData::hasImage):
136 (WebCore::ImageFrameData::hasMetadata):
137
1382016-06-24 Said Abou-Hallawa <sabouhallawa@apple,com>
139
140 Introduce PlatformImage and make it is a wrapper for NativeImagePtr
141 https://bugs.webkit.org/show_bug.cgi?id=158684
142
143 Reviewed by NOBODY (OOPS!).
144
145 The main purpose of this refactoring is to move the platform image dependent
146 code from BitmapImage to PlatformImage. PlatformImage is responsible of
147 drawing the image and answering NativeImagePtr questions when an ImageDecoder
148 is not available. Apart from drawing the image, the query functions will be
149 called only when constructing a FrameData so we will keep everything as a
150 NativeImagePtr. But we will cast the NativeImagePtr to PlatformImage when
151 a platform dependent function is needed.
152
153 No new tests -- Code refactoring, no behavior change.
154
155 * PlatformAppleWin.cmake:
156 * PlatformEfl.cmake:
157 * PlatformGTK.cmake:
158 * PlatformMac.cmake:
159 * PlatformWinCairo.cmake:
160 * WebCore.xcodeproj/project.pbxproj:
161 * bindings/objc/DOM.mm:
162 (-[DOMNode getPreviewSnapshotImage:andRects:]):
163 * page/mac/TextIndicatorWindow.mm:
164 (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
165 (createContentCrossfadeAnimation):
166 * platform/graphics/BitmapImage.cpp:
167 (WebCore::BitmapImage::BitmapImage):
168 (WebCore::BitmapImage::destroyDecodedData):
169 (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
170 (WebCore::BitmapImage::dataChanged):
171 (WebCore::BitmapImage::frameImageAtIndex):
172 (WebCore::BitmapImage::nativeImage):
173 (WebCore::BitmapImage::nativeImageOfSize):
174 (WebCore::BitmapImage::nativeImageForCurrentFrame):
175 (WebCore::BitmapImage::framesNativeImages):
176 (WebCore::BitmapImage::singlePixelSolidColor):
177 (WebCore::BitmapImage::isAlmostSolidColor):
178 (WebCore::BitmapImage::draw):
179 * platform/graphics/BitmapImage.h:
180 (WebCore::FrameData::FrameData):
181 m_hasAlpha can be initialized with false because it is accessed only in
182 BitmapImage::frameHasAlphaAtIndex() and it is guarded by m_haveMetadata.
183 Both m_haveMetadata and m_hasAlpha are set in BitmapImage constructor
184 and in BitmapImage::cacheFrame().
185
186 (WebCore::FrameData::~FrameData):
187 (WebCore::FrameData::clear):
188 * platform/graphics/Image.h:
189 (WebCore::Image::nativeImage):
190 (WebCore::Image::nativeImageOfSize):
191 (WebCore::Image::framesNativeImages):
192 (WebCore::Image::getCGImageRef): Deleted.
193 (WebCore::Image::getFirstCGImageRefOfSize): Deleted.
194 (WebCore::Image::getCGImageArray): Deleted.
195 * platform/graphics/PlatformImage.h: Added.
196 (WebCore::PlatformImage::PlatformImage):
197 (WebCore::PlatformImage::isNil):
198 (WebCore::PlatformImage::cgImageRef):
199 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
200 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
201 * platform/graphics/cairo/PlatformImageCairo.cpp: Renamed from Source/WebCore/platform/graphics/cairo/BitmapImageCairo.cpp.
202 (WebCore::PlatformImage::clearSubImages):
203 (WebCore::PlatformImage::size):
204 (WebCore::PlatformImage::hasAlpha):
205 (WebCore::PlatformImage::singlePixelSolidColor):
206 (WebCore::PlatformImage::isAlmostSolidColor):
207 (WebCore::PlatformImage::subsamplingScale):
208 (WebCore::PlatformImage::draw):
209 * platform/graphics/cg/BitmapImageCG.cpp: Removed.
210 * platform/graphics/cg/PatternCG.cpp:
211 (WebCore::Pattern::createPlatformPattern):
212 * platform/graphics/cg/PlatformImageCG.cpp: Added.
213 (WebCore::PlatformImage::clearSubImages):
214 (WebCore::PlatformImage::size):
215 (WebCore::PlatformImage::hasAlpha):
216 (WebCore::PlatformImage::singlePixelSolidColor):
217 (WebCore::PlatformImage::isAlmostSolidColor): Moved from PluginView.cpp since PlatformImage is what this function belongs to.
218 (WebCore::PlatformImage::subsamplingScale): Returns the sub-sampling scale based on the context scaling.
219 (WebCore::PlatformImage::draw):
220 * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
221 (TextTrackRepresentationCocoa::update):
222 * platform/graphics/mac/ImageMac.mm:
223 (WebCore::BitmapImage::getTIFFRepresentation):
224 * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
225 (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer):
226 * platform/win/DragImageCGWin.cpp:
227 (WebCore::createDragImageFromImage):
228