Changeset 268064 in webkit
- Timestamp:
- Oct 6, 2020, 12:36:02 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r268063 r268064 1 2020-10-06 Alex Christensen <achristensen@webkit.org> 2 3 Rename namespace Packed to namespace PackedColor 4 https://bugs.webkit.org/show_bug.cgi?id=217391 5 6 Reviewed by Simon Fraser. 7 8 Otherwise "using WTF::Packed;" in wtf/Packed.h causes problems if both headers are included in the same translation unit. 9 10 * css/StyleColor.cpp: 11 (WebCore::StyleColor::colorFromKeyword): 12 * css/parser/CSSParserFastPaths.cpp: 13 (WebCore::finishParsingHexColor): 14 (WebCore::finishParsingNamedColor): 15 * platform/graphics/Color.h: 16 (WebCore::Color::asInline const): 17 (WebCore::Color::setColor): 18 (WebCore::Color::encode const): 19 (WebCore::Color::decode): 20 * platform/graphics/ColorTypes.h: 21 (WebCore::asSRGBA): 22 (WebCore::Packed::RGBA::RGBA): Deleted. 23 (WebCore::Packed::ARGB::ARGB): Deleted. 24 * platform/graphics/ImageBackingStore.h: 25 (WebCore::ImageBackingStore::blendPixel): 26 (WebCore::ImageBackingStore::pixelValue const): 27 * platform/graphics/cg/ColorCG.cpp: 28 (WebCore::cachedCGColor): 29 * platform/graphics/mac/ColorMac.mm: 30 (WebCore::nsColor): 31 1 32 2020-10-06 Zalan Bujtas <zalan@apple.com> 2 33 -
trunk/Source/WebCore/css/StyleColor.cpp
r264311 r268064 42 42 if (const char* valueName = getValueName(keyword)) { 43 43 if (const NamedColor* namedColor = findColor(valueName, strlen(valueName))) 44 return asSRGBA(Packed ::ARGB { namedColor->ARGBValue });44 return asSRGBA(PackedColor::ARGB { namedColor->ARGBValue }); 45 45 } 46 46 -
trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp
r267940 r268064 415 415 case 3: 416 416 // #abc converts to #aabbcc 417 // FIXME: Replace conversion to Packed ::ARGB with simpler bit math to construct417 // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct 418 418 // the SRGBA<uint8_t> directly. 419 return asSRGBA(Packed ::ARGB {419 return asSRGBA(PackedColor::ARGB { 420 420 0xFF000000 421 421 | (value & 0xF00) << 12 | (value & 0xF00) << 8 … … 424 424 case 4: 425 425 // #abcd converts to ddaabbcc since alpha bytes are the high bytes. 426 // FIXME: Replace conversion to Packed ::ARGB with simpler bit math to construct426 // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct 427 427 // the SRGBA<uint8_t> directly. 428 return asSRGBA(Packed ::ARGB {428 return asSRGBA(PackedColor::ARGB { 429 429 (value & 0xF) << 28 | (value & 0xF) << 24 430 430 | (value & 0xF000) << 8 | (value & 0xF000) << 4 … … 432 432 | (value & 0xF0) | (value & 0xF0) >> 4 }); 433 433 case 6: 434 // FIXME: Replace conversion to Packed ::ARGB with simpler bit math to construct434 // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct 435 435 // the SRGBA<uint8_t> directly. 436 return asSRGBA(Packed ::ARGB { 0xFF000000 | value });436 return asSRGBA(PackedColor::ARGB { 0xFF000000 | value }); 437 437 case 8: 438 return asSRGBA(Packed ::RGBA { value });438 return asSRGBA(PackedColor::RGBA { value }); 439 439 } 440 440 return WTF::nullopt; … … 540 540 if (!namedColor) 541 541 return WTF::nullopt; 542 return asSRGBA(Packed ::ARGB { namedColor->ARGBValue });542 return asSRGBA(PackedColor::ARGB { namedColor->ARGBValue }); 543 543 } 544 544 -
trunk/Source/WebCore/platform/graphics/Color.h
r264585 r268064 394 394 { 395 395 ASSERT(isInline()); 396 return asSRGBA(Packed ::RGBA { static_cast<uint32_t>(m_colorData.inlineColorAndFlags >> 32) });396 return asSRGBA(PackedColor::RGBA { static_cast<uint32_t>(m_colorData.inlineColorAndFlags >> 32) }); 397 397 } 398 398 399 399 inline void Color::setColor(SRGBA<uint8_t> color) 400 400 { 401 m_colorData.inlineColorAndFlags = static_cast<uint64_t>(Packed ::RGBA { color }.value) << 32;401 m_colorData.inlineColorAndFlags = static_cast<uint64_t>(PackedColor::RGBA { color }.value) << 32; 402 402 tagAsValid(); 403 403 } … … 466 466 467 467 encoder << true; 468 encoder << Packed ::RGBA { asInline() }.value;468 encoder << PackedColor::RGBA { asInline() }.value; 469 469 } 470 470 … … 505 505 return WTF::nullopt; 506 506 507 return Color { asSRGBA(Packed ::RGBA { value }) };507 return Color { asSRGBA(PackedColor::RGBA { value }) }; 508 508 } 509 509 -
trunk/Source/WebCore/platform/graphics/ColorTypes.h
r264593 r268064 357 357 // Packed Color Formats 358 358 359 namespace Packed {359 namespace PackedColor { 360 360 361 361 struct RGBA { … … 389 389 } 390 390 391 constexpr SRGBA<uint8_t> asSRGBA(Packed ::RGBA color)391 constexpr SRGBA<uint8_t> asSRGBA(PackedColor::RGBA color) 392 392 { 393 393 return { static_cast<uint8_t>(color.value >> 24), static_cast<uint8_t>(color.value >> 16), static_cast<uint8_t>(color.value >> 8), static_cast<uint8_t>(color.value) }; 394 394 } 395 395 396 constexpr SRGBA<uint8_t> asSRGBA(Packed ::ARGB color)396 constexpr SRGBA<uint8_t> asSRGBA(PackedColor::ARGB color) 397 397 { 398 398 return { static_cast<uint8_t>(color.value >> 16), static_cast<uint8_t>(color.value >> 8), static_cast<uint8_t>(color.value), static_cast<uint8_t>(color.value >> 24) }; -
trunk/Source/WebCore/platform/graphics/ImageBackingStore.h
r264050 r268064 153 153 return; 154 154 155 auto pixel = asSRGBA(Packed ::ARGB { *dest });155 auto pixel = asSRGBA(PackedColor::ARGB { *dest }); 156 156 157 157 if (a >= 255 || !pixel.alpha) { … … 175 175 result = unpremultiplied(result); 176 176 177 *dest = Packed ::ARGB { result }.value;177 *dest = PackedColor::ARGB { result }.value; 178 178 } 179 179 … … 232 232 result = premultipliedFlooring(result); 233 233 234 return Packed ::ARGB { result }.value;234 return PackedColor::ARGB { result }.value; 235 235 } 236 236 -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp
r264645 r268064 82 82 for (int x = 0; x < m_logicalSize.width(); x++) { 83 83 unsigned* pixel = row + x; 84 auto pixelComponents = unpremultiplied(asSRGBA(Packed ::ARGB { *pixel }));84 auto pixelComponents = unpremultiplied(asSRGBA(PackedColor::ARGB { *pixel })); 85 85 pixelComponents = { lookUpTable[pixelComponents.red], lookUpTable[pixelComponents.green], lookUpTable[pixelComponents.blue], pixelComponents.alpha }; 86 *pixel = Packed ::ARGB { premultipliedCeiling(pixelComponents) }.value;86 *pixel = PackedColor::ARGB { premultipliedCeiling(pixelComponents) }.value; 87 87 } 88 88 } -
trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
r264311 r268064 55 55 56 56 unsigned* pixel = reinterpret_cast_ptr<unsigned*>(cairo_image_surface_get_data(image.get())); 57 return unpremultiplied(asSRGBA(Packed ::ARGB { *pixel }));57 return unpremultiplied(asSRGBA(PackedColor::ARGB { *pixel })); 58 58 } 59 59 -
trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp
r264585 r268064 118 118 { 119 119 if (color.isInline()) { 120 switch (Packed ::RGBA { color.asInline() }.value) {121 case Packed ::RGBA { Color::transparentBlack }.value: {120 switch (PackedColor::RGBA { color.asInline() }.value) { 121 case PackedColor::RGBA { Color::transparentBlack }.value: { 122 122 static CGColorRef transparentCGColor = leakCGColor(color); 123 123 return transparentCGColor; 124 124 } 125 case Packed ::RGBA { Color::black }.value: {125 case PackedColor::RGBA { Color::black }.value: { 126 126 static CGColorRef blackCGColor = leakCGColor(color); 127 127 return blackCGColor; 128 128 } 129 case Packed ::RGBA { Color::white }.value: {129 case PackedColor::RGBA { Color::white }.value: { 130 130 static CGColorRef whiteCGColor = leakCGColor(color); 131 131 return whiteCGColor; -
trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm
r264585 r268064 115 115 { 116 116 if (color.isInline()) { 117 switch (Packed ::RGBA { color.asInline() }.value) {118 case Packed ::RGBA { Color::transparentBlack }.value: {117 switch (PackedColor::RGBA { color.asInline() }.value) { 118 case PackedColor::RGBA { Color::transparentBlack }.value: { 119 119 static NSColor *clearColor = [[NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:0] retain]; 120 120 return clearColor; 121 121 } 122 case Packed ::RGBA { Color::black }.value: {122 case PackedColor::RGBA { Color::black }.value: { 123 123 static NSColor *blackColor = [[NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:1] retain]; 124 124 return blackColor; 125 125 } 126 case Packed ::RGBA { Color::white }.value: {126 case PackedColor::RGBA { Color::white }.value: { 127 127 static NSColor *whiteColor = [[NSColor colorWithSRGBRed:1 green:1 blue:1 alpha:1] retain]; 128 128 return whiteColor;
Note:
See TracChangeset
for help on using the changeset viewer.