Changeset 277369 in webkit
- Timestamp:
- May 12, 2021, 7:51:31 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 8 edited
-
ChangeLog (modified) (1 diff)
-
Sources.txt (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
platform/graphics/ImageBufferBackend.cpp (modified) (5 diffs)
-
platform/graphics/ImageBufferBackend.h (modified) (1 diff)
-
platform/graphics/PixelBufferConversion.cpp (added)
-
platform/graphics/PixelBufferConversion.h (added)
-
platform/graphics/cg/ImageBufferCGBackend.cpp (modified) (2 diffs)
-
platform/graphics/cg/ImageBufferCGBackend.h (modified) (1 diff)
-
platform/graphics/filters/FilterEffect.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r277367 r277369 1 2021-05-12 Sam Weinig <weinig@apple.com> 2 3 Factor copyImagePixels pixel conversion code into its own file 4 https://bugs.webkit.org/show_bug.cgi?id=225673 5 6 Reviewed by Darin Adler. 7 8 Removes virtual ImageBufferBackend::copyImagePixels() function and 9 moves functionality to new PixelBufferConversion.h/cpp. 10 11 Merge USE(ACCELERATE) code from ImageBufferCGBackend into the same 12 file and do some light cleanup. 13 14 - Function renamed to covert convertImagePixels to convey that it is 15 doing more than copying. 16 - Add PixelBufferConversionView/ConstPixelBufferConversionView structs 17 to hold parameters for the conversions, including a ColorSpace member 18 that is not yet used but will be shortly. 19 - Uses constexpr conditionals in unaccelerated cases to hoist branch 20 checking for pixel format conversion requirements outside the main 21 loop. 22 23 * Sources.txt: 24 * WebCore.xcodeproj/project.pbxproj: 25 Add new files. 26 27 * platform/graphics/PixelBufferConversion.cpp: Added. 28 (WebCore::makeVImageBuffer): 29 (WebCore::convertImagePixelsAccelerated): 30 (WebCore::convertSinglePixelPremultipliedToPremultiplied): 31 (WebCore::convertSinglePixelPremultipliedToUnpremultiplied): 32 (WebCore::convertSinglePixelUnpremultipliedToPremultiplied): 33 (WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied): 34 (WebCore::convertFunctor): 35 (WebCore::convertImagePixels): 36 * platform/graphics/PixelBufferConversion.h: Added. 37 Move existing copyImagePixels implementations here. 38 39 * platform/graphics/ImageBufferBackend.cpp: 40 (WebCore::ImageBufferBackend::toBGRAData const): 41 (WebCore::ImageBufferBackend::getPixelBuffer const): 42 (WebCore::ImageBufferBackend::putPixelBuffer): 43 (WebCore::copyPremultipliedToPremultiplied): Deleted. 44 (WebCore::copyPremultipliedToUnpremultiplied): Deleted. 45 (WebCore::copyUnpremultipliedToPremultiplied): Deleted. 46 (WebCore::copyUnpremultipliedToUnpremultiplied): Deleted. 47 (WebCore::copyFunctor): Deleted. 48 (WebCore::ImageBufferBackend::copyImagePixels const): Deleted. 49 * platform/graphics/ImageBufferBackend.h: 50 * platform/graphics/cg/ImageBufferCGBackend.cpp: 51 (WebCore::makeVImageBuffer): Deleted. 52 (WebCore::copyImagePixelsAccelerated): Deleted. 53 (WebCore::ImageBufferCGBackend::copyImagePixels const): Deleted. 54 * platform/graphics/cg/ImageBufferCGBackend.h: 55 Remove existing copyImagePixels() implementation and call new 56 convertImagePixels() instead. 57 58 * platform/graphics/filters/FilterEffect.cpp: 59 (WebCore::FilterEffect::copyUnmultipliedResult): 60 (WebCore::FilterEffect::copyPremultipliedResult): 61 (WebCore::FilterEffect::createUnmultipliedImageResult): 62 (WebCore::FilterEffect::createPremultipliedImageResult): 63 Fix pixel format for the PixelBuffers to match existing behaviors. 64 These are not being used at the moment but will in the future 65 and new assert in putPixelBuffer caught these being incorrect. 66 1 67 2021-05-12 Commit Queue <commit-queue@webkit.org> 2 68 -
trunk/Source/WebCore/Sources.txt
r277245 r277369 2014 2014 platform/graphics/Pattern.cpp 2015 2015 platform/graphics/PixelBuffer.cpp 2016 platform/graphics/PixelBufferConversion.cpp 2016 2017 platform/graphics/PlatformTimeRanges.cpp 2017 2018 platform/graphics/Region.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r277364 r277369 14093 14093 BC06F24D06D18A7E004A6FA3 /* XSLTProcessorLibxslt.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessorLibxslt.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 14094 14094 BC073BA90C399B1F000F5979 /* FloatConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FloatConversion.h; sourceTree = "<group>"; }; 14095 BC0CA74C264AED0A004FDC62 /* PixelBufferConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PixelBufferConversion.h; sourceTree = "<group>"; }; 14096 BC0CA74D264AED0A004FDC62 /* PixelBufferConversion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PixelBufferConversion.cpp; sourceTree = "<group>"; }; 14095 14097 BC10137B25C3624B00DC773C /* ColorModels.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorModels.h; sourceTree = "<group>"; }; 14096 14098 BC10137E25C3631600DC773C /* ColorTransferFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorTransferFunctions.h; sourceTree = "<group>"; }; … … 27054 27056 BC4839BB2646181A00A28B62 /* PixelBuffer.cpp */, 27055 27057 BC4839BA2646181A00A28B62 /* PixelBuffer.h */, 27058 BC0CA74D264AED0A004FDC62 /* PixelBufferConversion.cpp */, 27059 BC0CA74C264AED0A004FDC62 /* PixelBufferConversion.h */, 27056 27060 BCA55912263DBD79007F19B3 /* PixelFormat.h */, 27057 27061 726D56E1253AE0430002EF90 /* PlatformImage.h */, -
trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp
r277313 r277369 29 29 #include "Image.h" 30 30 #include "PixelBuffer.h" 31 #include "PixelBufferConversion.h" 31 32 32 33 namespace WebCore { … … 94 95 { 95 96 Vector<uint8_t> result(4 * logicalSize().area().unsafeGet()); 96 size_t destinationBytesPerRow = logicalSize().width() * 4; 97 size_t sourceBytesPerRow = bytesPerRow(); 98 99 uint8_t* sourceRows = reinterpret_cast<uint8_t*>(data); 100 101 copyImagePixels( 102 AlphaPremultiplication::Premultiplied, pixelFormat(), sourceBytesPerRow, sourceRows, 103 AlphaPremultiplication::Unpremultiplied, PixelFormat::BGRA8, destinationBytesPerRow, result.data(), logicalSize()); 97 98 ConstPixelBufferConversionView source; 99 source.alphaFormat = AlphaPremultiplication::Premultiplied; 100 source.colorSpace = DestinationColorSpace::SRGB; 101 source.pixelFormat = pixelFormat(); 102 source.bytesPerRow = bytesPerRow(); 103 source.rows = reinterpret_cast<const uint8_t*>(data); 104 105 PixelBufferConversionView destination; 106 destination.alphaFormat = AlphaPremultiplication::Unpremultiplied; 107 destination.colorSpace = DestinationColorSpace::SRGB; 108 destination.pixelFormat = PixelFormat::BGRA8; 109 destination.bytesPerRow = logicalSize().width() * 4; 110 destination.rows = result.data(); 111 112 convertImagePixels(source, destination, logicalSize()); 104 113 105 114 return result; 106 115 } 107 116 108 static inline void copyPremultipliedToPremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)109 {110 uint8_t alpha = sourcePixel[3];111 if (!alpha) {112 reinterpret_cast<uint32_t*>(destinationPixel)[0] = 0;113 return;114 }115 116 if (sourcePixelFormat == destinationPixelFormat) {117 reinterpret_cast<uint32_t*>(destinationPixel)[0] = reinterpret_cast<const uint32_t*>(sourcePixel)[0];118 return;119 }120 121 // Swap pixel channels BGRA <-> RGBA.122 destinationPixel[0] = sourcePixel[2];123 destinationPixel[1] = sourcePixel[1];124 destinationPixel[2] = sourcePixel[0];125 destinationPixel[3] = sourcePixel[3];126 }127 128 static inline void copyPremultipliedToUnpremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)129 {130 uint8_t alpha = sourcePixel[3];131 if (!alpha || alpha == 255) {132 copyPremultipliedToPremultiplied(sourcePixelFormat, sourcePixel, destinationPixelFormat, destinationPixel);133 return;134 }135 136 if (sourcePixelFormat == destinationPixelFormat) {137 destinationPixel[0] = (sourcePixel[0] * 255) / alpha;138 destinationPixel[1] = (sourcePixel[1] * 255) / alpha;139 destinationPixel[2] = (sourcePixel[2] * 255) / alpha;140 destinationPixel[3] = alpha;141 return;142 }143 144 // Swap pixel channels BGRA <-> RGBA.145 destinationPixel[0] = (sourcePixel[2] * 255) / alpha;146 destinationPixel[1] = (sourcePixel[1] * 255) / alpha;147 destinationPixel[2] = (sourcePixel[0] * 255) / alpha;148 destinationPixel[3] = alpha;149 }150 151 static inline void copyUnpremultipliedToPremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)152 {153 uint8_t alpha = sourcePixel[3];154 if (!alpha || alpha == 255) {155 copyPremultipliedToPremultiplied(sourcePixelFormat, sourcePixel, destinationPixelFormat, destinationPixel);156 return;157 }158 159 if (sourcePixelFormat == destinationPixelFormat) {160 destinationPixel[0] = (sourcePixel[0] * alpha + 254) / 255;161 destinationPixel[1] = (sourcePixel[1] * alpha + 254) / 255;162 destinationPixel[2] = (sourcePixel[2] * alpha + 254) / 255;163 destinationPixel[3] = alpha;164 return;165 }166 167 // Swap pixel channels BGRA <-> RGBA.168 destinationPixel[0] = (sourcePixel[2] * alpha + 254) / 255;169 destinationPixel[1] = (sourcePixel[1] * alpha + 254) / 255;170 destinationPixel[2] = (sourcePixel[0] * alpha + 254) / 255;171 destinationPixel[3] = alpha;172 }173 174 static inline void copyUnpremultipliedToUnpremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)175 {176 if (sourcePixelFormat == destinationPixelFormat) {177 reinterpret_cast<uint32_t*>(destinationPixel)[0] = reinterpret_cast<const uint32_t*>(sourcePixel)[0];178 return;179 }180 181 // Swap pixel channels BGRA <-> RGBA.182 destinationPixel[0] = sourcePixel[2];183 destinationPixel[1] = sourcePixel[1];184 destinationPixel[2] = sourcePixel[0];185 destinationPixel[3] = sourcePixel[3];186 }187 188 template<void (*copyFunctor)(PixelFormat, const uint8_t*, PixelFormat, uint8_t*)>189 static inline void copyImagePixelsUnaccelerated(190 PixelFormat sourcePixelFormat, unsigned sourceBytesPerRow, uint8_t* sourceRows,191 PixelFormat destinationPixelFormat, unsigned destinationBytesPerRow, uint8_t* destinationRows, const IntSize& size)192 {193 size_t bytesPerRow = size.width() * 4;194 for (int y = 0; y < size.height(); ++y) {195 for (size_t x = 0; x < bytesPerRow; x += 4)196 copyFunctor(sourcePixelFormat, &sourceRows[x], destinationPixelFormat, &destinationRows[x]);197 sourceRows += sourceBytesPerRow;198 destinationRows += destinationBytesPerRow;199 }200 }201 202 void ImageBufferBackend::copyImagePixels(203 AlphaPremultiplication sourceAlphaFormat, PixelFormat sourcePixelFormat, unsigned sourceBytesPerRow, uint8_t* sourceRows,204 AlphaPremultiplication destinationAlphaFormat, PixelFormat destinationPixelFormat, unsigned destinationBytesPerRow, uint8_t* destinationRows, const IntSize& size) const205 {206 // We don't currently support getting or putting pixel data with deep color buffers.207 ASSERT(sourcePixelFormat == PixelFormat::RGBA8 || sourcePixelFormat == PixelFormat::BGRA8);208 ASSERT(destinationPixelFormat == PixelFormat::RGBA8 || destinationPixelFormat == PixelFormat::BGRA8);209 210 if (sourceAlphaFormat == destinationAlphaFormat) {211 if (sourceAlphaFormat == AlphaPremultiplication::Premultiplied)212 copyImagePixelsUnaccelerated<copyPremultipliedToPremultiplied>(sourcePixelFormat, sourceBytesPerRow, sourceRows, destinationPixelFormat, destinationBytesPerRow, destinationRows, size);213 else214 copyImagePixelsUnaccelerated<copyUnpremultipliedToUnpremultiplied>(sourcePixelFormat, sourceBytesPerRow, sourceRows, destinationPixelFormat, destinationBytesPerRow, destinationRows, size);215 return;216 }217 218 if (destinationAlphaFormat == AlphaPremultiplication::Unpremultiplied) {219 copyImagePixelsUnaccelerated<copyPremultipliedToUnpremultiplied>(sourcePixelFormat, sourceBytesPerRow, sourceRows, destinationPixelFormat, destinationBytesPerRow, destinationRows, size);220 return;221 }222 223 copyImagePixelsUnaccelerated<copyUnpremultipliedToPremultiplied>(sourcePixelFormat, sourceBytesPerRow, sourceRows, destinationPixelFormat, destinationBytesPerRow, destinationRows, size);224 }225 226 117 Optional<PixelBuffer> ImageBufferBackend::getPixelBuffer(AlphaPremultiplication destinationAlphaFormat, const IntRect& sourceRect, void* data) const 227 118 { 228 119 auto sourceRectScaled = toBackendCoordinates(sourceRect); 229 120 230 auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, sourceRectScaled.size()); 121 auto destinationPixelFormat = PixelFormat::RGBA8; 122 123 auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, destinationPixelFormat, sourceRectScaled.size()); 231 124 if (!pixelBuffer) 232 125 return WTF::nullopt; … … 244 137 pixelBuffer->data().zeroFill(); 245 138 139 unsigned sourceBytesPerRow = bytesPerRow(); 140 const uint8_t* sourceRows = reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4; 141 246 142 unsigned destinationBytesPerRow = 4 * sourceRectScaled.width(); 247 143 uint8_t* destinationRows = pixelBuffer->data().data() + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4; 248 144 249 unsigned sourceBytesPerRow = bytesPerRow(); 250 uint8_t* sourceRows = reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4; 251 252 copyImagePixels( 253 AlphaPremultiplication::Premultiplied, pixelFormat(), sourceBytesPerRow, sourceRows, 254 destinationAlphaFormat, PixelFormat::RGBA8, destinationBytesPerRow, destinationRows, destinationRect.size()); 145 ConstPixelBufferConversionView source; 146 source.alphaFormat = AlphaPremultiplication::Premultiplied; 147 source.colorSpace = DestinationColorSpace::SRGB; 148 source.pixelFormat = pixelFormat(); 149 source.bytesPerRow = sourceBytesPerRow; 150 source.rows = sourceRows; 151 152 PixelBufferConversionView destination; 153 destination.alphaFormat = destinationAlphaFormat; 154 destination.colorSpace = DestinationColorSpace::SRGB; 155 destination.pixelFormat = destinationPixelFormat; 156 destination.bytesPerRow = destinationBytesPerRow; 157 destination.rows = destinationRows; 158 159 convertImagePixels(source, destination, destinationRect.size()); 255 160 256 161 return pixelBuffer; … … 259 164 void ImageBufferBackend::putPixelBuffer(AlphaPremultiplication sourceAlphaFormat, const PixelBuffer& pixelBuffer, const IntRect& sourceRect, const IntPoint& destinationPoint, AlphaPremultiplication destinationAlphaFormat, void* data) 260 165 { 166 // FIXME: Add support for non-RGBA8 pixel formats. 167 ASSERT(pixelBuffer.format() == PixelFormat::RGBA8); 168 261 169 auto sourceRectScaled = toBackendCoordinates(sourceRect); 262 170 auto destinationPointScaled = toBackendCoordinates(destinationPoint); … … 275 183 sourceRectClipped.setSize(destinationRect.size()); 276 184 185 unsigned sourceBytesPerRow = 4 * pixelBuffer.size().width(); 186 const uint8_t* sourceRows = pixelBuffer.data().data() + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4; 187 277 188 unsigned destinationBytesPerRow = bytesPerRow(); 278 189 uint8_t* destinationRows = reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4; 279 190 280 unsigned sourceBytesPerRow = 4 * pixelBuffer.size().width(); 281 uint8_t* sourceRows = pixelBuffer.data().data() + sourceRectClipped.y() * sourceBytesPerRow + sourceRectClipped.x() * 4; 282 283 copyImagePixels( 284 sourceAlphaFormat, PixelFormat::RGBA8, sourceBytesPerRow, sourceRows, 285 destinationAlphaFormat, pixelFormat(), destinationBytesPerRow, destinationRows, destinationRect.size()); 191 ConstPixelBufferConversionView source; 192 source.alphaFormat = sourceAlphaFormat; 193 source.colorSpace = DestinationColorSpace::SRGB; 194 source.pixelFormat = PixelFormat::RGBA8; 195 source.bytesPerRow = sourceBytesPerRow; 196 source.rows = sourceRows; 197 198 PixelBufferConversionView destination; 199 destination.alphaFormat = destinationAlphaFormat; 200 destination.colorSpace = DestinationColorSpace::SRGB; 201 destination.pixelFormat = pixelFormat(); 202 destination.bytesPerRow = destinationBytesPerRow; 203 destination.rows = destinationRows; 204 205 convertImagePixels(source, destination, destinationRect.size()); 286 206 } 287 207 -
trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h
r277313 r277369 149 149 IntRect backendRect() const { return IntRect(IntPoint::zero(), backendSize()); }; 150 150 151 WEBCORE_EXPORT virtual void copyImagePixels(152 AlphaPremultiplication srcAlphaFormat, PixelFormat srcPixelFormat, unsigned srcBytesPerRow, uint8_t* srcRows,153 AlphaPremultiplication destAlphaFormat, PixelFormat destPixelFormat, unsigned destBytesPerRow, uint8_t* destRows, const IntSize&) const;154 155 151 WEBCORE_EXPORT Vector<uint8_t> toBGRAData(void* data) const; 156 152 -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp
r277313 r277369 36 36 #include "PixelBuffer.h" 37 37 #include "RuntimeApplicationChecks.h" 38 39 #if USE(ACCELERATE)40 #include <Accelerate/Accelerate.h>41 #endif42 38 #include <CoreGraphics/CoreGraphics.h> 43 39 #include <pal/spi/cg/CoreGraphicsSPI.h> … … 251 247 } 252 248 253 #if USE(ACCELERATE)254 static inline vImage_Buffer makeVImageBuffer(unsigned bytesPerRow, uint8_t* rows, const IntSize& size)255 {256 vImage_Buffer vImageBuffer;257 258 vImageBuffer.height = static_cast<vImagePixelCount>(size.height());259 vImageBuffer.width = static_cast<vImagePixelCount>(size.width());260 vImageBuffer.rowBytes = bytesPerRow;261 vImageBuffer.data = rows;262 return vImageBuffer;263 }264 265 static inline void copyImagePixelsAccelerated(266 AlphaPremultiplication srcAlphaFormat, PixelFormat srcPixelFormat, vImage_Buffer& src,267 AlphaPremultiplication destAlphaFormat, PixelFormat destPixelFormat, vImage_Buffer& dest)268 {269 if (srcAlphaFormat == destAlphaFormat) {270 ASSERT(srcPixelFormat != destPixelFormat);271 // The destination alpha format can be unpremultiplied in the272 // case of an ImageBitmap created from an ImageData with273 // premultiplyAlpha=="none".274 275 // Swap pixel channels BGRA <-> RGBA.276 const uint8_t map[4] = { 2, 1, 0, 3 };277 vImagePermuteChannels_ARGB8888(&src, &dest, map, kvImageNoFlags);278 return;279 }280 281 if (destAlphaFormat == AlphaPremultiplication::Unpremultiplied) {282 if (srcPixelFormat == PixelFormat::RGBA8)283 vImageUnpremultiplyData_RGBA8888(&src, &dest, kvImageNoFlags);284 else285 vImageUnpremultiplyData_BGRA8888(&src, &dest, kvImageNoFlags);286 } else {287 if (srcPixelFormat == PixelFormat::RGBA8)288 vImagePremultiplyData_RGBA8888(&src, &dest, kvImageNoFlags);289 else290 vImagePremultiplyData_BGRA8888(&src, &dest, kvImageNoFlags);291 }292 293 if (srcPixelFormat != destPixelFormat) {294 // Swap pixel channels BGRA <-> RGBA.295 const uint8_t map[4] = { 2, 1, 0, 3 };296 vImagePermuteChannels_ARGB8888(&dest, &dest, map, kvImageNoFlags);297 }298 }299 300 void ImageBufferCGBackend::copyImagePixels(301 AlphaPremultiplication srcAlphaFormat, PixelFormat srcPixelFormat, unsigned srcBytesPerRow, uint8_t* srcRows,302 AlphaPremultiplication destAlphaFormat, PixelFormat destPixelFormat, unsigned destBytesPerRow, uint8_t* destRows, const IntSize& size) const303 {304 // We don't currently support getting or putting pixel data with deep color buffers.305 ASSERT(srcPixelFormat == PixelFormat::RGBA8 || srcPixelFormat == PixelFormat::BGRA8);306 ASSERT(destPixelFormat == PixelFormat::RGBA8 || destPixelFormat == PixelFormat::BGRA8);307 308 if (srcAlphaFormat == destAlphaFormat && srcPixelFormat == destPixelFormat) {309 ImageBufferBackend::copyImagePixels(srcAlphaFormat, srcPixelFormat, srcBytesPerRow, srcRows, destAlphaFormat, destPixelFormat, destBytesPerRow, destRows, size);310 return;311 }312 313 vImage_Buffer src = makeVImageBuffer(srcBytesPerRow, srcRows, size);314 vImage_Buffer dest = makeVImageBuffer(destBytesPerRow, destRows, size);315 316 copyImagePixelsAccelerated(srcAlphaFormat, srcPixelFormat, src, destAlphaFormat, destPixelFormat, dest);317 }318 #endif319 320 249 } // namespace WebCore 321 250 -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h
r275905 r277369 55 55 void setupContext() const; 56 56 virtual RetainPtr<CFDataRef> toCFData(const String& mimeType, Optional<double> quality, PreserveResolution) const; 57 58 #if USE(ACCELERATE)59 void copyImagePixels(60 AlphaPremultiplication srcAlphaFormat, PixelFormat srcPixelFormat, unsigned srcBytesPerRow, uint8_t* srcRows,61 AlphaPremultiplication destAlphaFormat, PixelFormat destPixelFormat, unsigned destBytesPerRow, uint8_t* destRows, const IntSize&) const override;62 #endif63 57 }; 64 58 -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp
r277313 r277369 506 506 ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize)); 507 507 inputSize.scale(m_filter.filterScale()); 508 m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat:: BGRA8, inputSize);508 m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, inputSize); 509 509 if (!m_unmultipliedImageResult) 510 510 return; … … 539 539 ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize)); 540 540 inputSize.scale(m_filter.filterScale()); 541 m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat:: BGRA8, inputSize);541 m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, inputSize); 542 542 if (!m_premultipliedImageResult) 543 543 return; … … 581 581 ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize)); 582 582 resultSize.scale(m_filter.filterScale()); 583 m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat:: BGRA8, resultSize);583 m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, resultSize); 584 584 return m_unmultipliedImageResult; 585 585 } … … 599 599 ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize)); 600 600 resultSize.scale(m_filter.filterScale()); 601 m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat:: BGRA8, resultSize);601 m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, resultSize); 602 602 return m_premultipliedImageResult; 603 603 }
Note:
See TracChangeset
for help on using the changeset viewer.