| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/gpu/WebGLImageConversion.h" | 6 #include "platform/graphics/gpu/WebGLImageConversion.h" |
| 7 | 7 |
| 8 #include "platform/CheckedInt.h" | 8 #include "platform/CheckedInt.h" |
| 9 #include "platform/graphics/ImageObserver.h" | 9 #include "platform/graphics/ImageObserver.h" |
| 10 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" | 10 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 || format == WebGLImageConversion::DataFormatRG32F | 1422 || format == WebGLImageConversion::DataFormatRG32F |
| 1423 || format == WebGLImageConversion::DataFormatR8_S | 1423 || format == WebGLImageConversion::DataFormatR8_S |
| 1424 || format == WebGLImageConversion::DataFormatR16 | 1424 || format == WebGLImageConversion::DataFormatR16 |
| 1425 || format == WebGLImageConversion::DataFormatR16_S | 1425 || format == WebGLImageConversion::DataFormatR16_S |
| 1426 || format == WebGLImageConversion::DataFormatR32 | 1426 || format == WebGLImageConversion::DataFormatR32 |
| 1427 || format == WebGLImageConversion::DataFormatR32_S; | 1427 || format == WebGLImageConversion::DataFormatR32_S; |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 template<int Format> | 1430 template<int Format> |
| 1431 struct IsInt8Format { | 1431 struct IsInt8Format { |
| 1432 STATIC_ONLY(IsInt8Format); |
| 1432 static const bool Value = | 1433 static const bool Value = |
| 1433 Format == WebGLImageConversion::DataFormatRGBA8_S | 1434 Format == WebGLImageConversion::DataFormatRGBA8_S |
| 1434 || Format == WebGLImageConversion::DataFormatRGB8_S | 1435 || Format == WebGLImageConversion::DataFormatRGB8_S |
| 1435 || Format == WebGLImageConversion::DataFormatRG8_S | 1436 || Format == WebGLImageConversion::DataFormatRG8_S |
| 1436 || Format == WebGLImageConversion::DataFormatR8_S; | 1437 || Format == WebGLImageConversion::DataFormatR8_S; |
| 1437 }; | 1438 }; |
| 1438 | 1439 |
| 1439 template<int Format> | 1440 template<int Format> |
| 1440 struct IsInt16Format { | 1441 struct IsInt16Format { |
| 1442 STATIC_ONLY(IsInt16Format); |
| 1441 static const bool Value = | 1443 static const bool Value = |
| 1442 Format == WebGLImageConversion::DataFormatRGBA16_S | 1444 Format == WebGLImageConversion::DataFormatRGBA16_S |
| 1443 || Format == WebGLImageConversion::DataFormatRGB16_S | 1445 || Format == WebGLImageConversion::DataFormatRGB16_S |
| 1444 || Format == WebGLImageConversion::DataFormatRG16_S | 1446 || Format == WebGLImageConversion::DataFormatRG16_S |
| 1445 || Format == WebGLImageConversion::DataFormatR16_S; | 1447 || Format == WebGLImageConversion::DataFormatR16_S; |
| 1446 }; | 1448 }; |
| 1447 | 1449 |
| 1448 template<int Format> | 1450 template<int Format> |
| 1449 struct IsInt32Format { | 1451 struct IsInt32Format { |
| 1452 STATIC_ONLY(IsInt32Format); |
| 1450 static const bool Value = | 1453 static const bool Value = |
| 1451 Format == WebGLImageConversion::DataFormatRGBA32_S | 1454 Format == WebGLImageConversion::DataFormatRGBA32_S |
| 1452 || Format == WebGLImageConversion::DataFormatRGB32_S | 1455 || Format == WebGLImageConversion::DataFormatRGB32_S |
| 1453 || Format == WebGLImageConversion::DataFormatRG32_S | 1456 || Format == WebGLImageConversion::DataFormatRG32_S |
| 1454 || Format == WebGLImageConversion::DataFormatR32_S; | 1457 || Format == WebGLImageConversion::DataFormatR32_S; |
| 1455 }; | 1458 }; |
| 1456 | 1459 |
| 1457 template<int Format> | 1460 template<int Format> |
| 1458 struct IsUInt8Format { | 1461 struct IsUInt8Format { |
| 1462 STATIC_ONLY(IsUInt8Format); |
| 1459 static const bool Value = | 1463 static const bool Value = |
| 1460 Format == WebGLImageConversion::DataFormatRGBA8 | 1464 Format == WebGLImageConversion::DataFormatRGBA8 |
| 1461 || Format == WebGLImageConversion::DataFormatRGB8 | 1465 || Format == WebGLImageConversion::DataFormatRGB8 |
| 1462 || Format == WebGLImageConversion::DataFormatRG8 | 1466 || Format == WebGLImageConversion::DataFormatRG8 |
| 1463 || Format == WebGLImageConversion::DataFormatR8 | 1467 || Format == WebGLImageConversion::DataFormatR8 |
| 1464 || Format == WebGLImageConversion::DataFormatBGRA8 | 1468 || Format == WebGLImageConversion::DataFormatBGRA8 |
| 1465 || Format == WebGLImageConversion::DataFormatBGR8 | 1469 || Format == WebGLImageConversion::DataFormatBGR8 |
| 1466 || Format == WebGLImageConversion::DataFormatARGB8 | 1470 || Format == WebGLImageConversion::DataFormatARGB8 |
| 1467 || Format == WebGLImageConversion::DataFormatABGR8 | 1471 || Format == WebGLImageConversion::DataFormatABGR8 |
| 1468 || Format == WebGLImageConversion::DataFormatRA8 | 1472 || Format == WebGLImageConversion::DataFormatRA8 |
| 1469 || Format == WebGLImageConversion::DataFormatAR8 | 1473 || Format == WebGLImageConversion::DataFormatAR8 |
| 1470 || Format == WebGLImageConversion::DataFormatA8; | 1474 || Format == WebGLImageConversion::DataFormatA8; |
| 1471 }; | 1475 }; |
| 1472 | 1476 |
| 1473 template<int Format> | 1477 template<int Format> |
| 1474 struct IsUInt16Format { | 1478 struct IsUInt16Format { |
| 1479 STATIC_ONLY(IsUInt16Format); |
| 1475 static const bool Value = | 1480 static const bool Value = |
| 1476 Format == WebGLImageConversion::DataFormatRGBA16 | 1481 Format == WebGLImageConversion::DataFormatRGBA16 |
| 1477 || Format == WebGLImageConversion::DataFormatRGB16 | 1482 || Format == WebGLImageConversion::DataFormatRGB16 |
| 1478 || Format == WebGLImageConversion::DataFormatRG16 | 1483 || Format == WebGLImageConversion::DataFormatRG16 |
| 1479 || Format == WebGLImageConversion::DataFormatR16; | 1484 || Format == WebGLImageConversion::DataFormatR16; |
| 1480 }; | 1485 }; |
| 1481 | 1486 |
| 1482 template<int Format> | 1487 template<int Format> |
| 1483 struct IsUInt32Format { | 1488 struct IsUInt32Format { |
| 1489 STATIC_ONLY(IsUInt32Format); |
| 1484 static const bool Value = | 1490 static const bool Value = |
| 1485 Format == WebGLImageConversion::DataFormatRGBA32 | 1491 Format == WebGLImageConversion::DataFormatRGBA32 |
| 1486 || Format == WebGLImageConversion::DataFormatRGB32 | 1492 || Format == WebGLImageConversion::DataFormatRGB32 |
| 1487 || Format == WebGLImageConversion::DataFormatRG32 | 1493 || Format == WebGLImageConversion::DataFormatRG32 |
| 1488 || Format == WebGLImageConversion::DataFormatR32; | 1494 || Format == WebGLImageConversion::DataFormatR32; |
| 1489 }; | 1495 }; |
| 1490 | 1496 |
| 1491 template<int Format> | 1497 template<int Format> |
| 1492 struct IsFloatFormat { | 1498 struct IsFloatFormat { |
| 1499 STATIC_ONLY(IsFloatFormat); |
| 1493 static const bool Value = | 1500 static const bool Value = |
| 1494 Format == WebGLImageConversion::DataFormatRGBA32F | 1501 Format == WebGLImageConversion::DataFormatRGBA32F |
| 1495 || Format == WebGLImageConversion::DataFormatRGB32F | 1502 || Format == WebGLImageConversion::DataFormatRGB32F |
| 1496 || Format == WebGLImageConversion::DataFormatRA32F | 1503 || Format == WebGLImageConversion::DataFormatRA32F |
| 1497 || Format == WebGLImageConversion::DataFormatR32F | 1504 || Format == WebGLImageConversion::DataFormatR32F |
| 1498 || Format == WebGLImageConversion::DataFormatA32F | 1505 || Format == WebGLImageConversion::DataFormatA32F |
| 1499 || Format == WebGLImageConversion::DataFormatRG32F; | 1506 || Format == WebGLImageConversion::DataFormatRG32F; |
| 1500 }; | 1507 }; |
| 1501 | 1508 |
| 1502 template<int Format> | 1509 template<int Format> |
| 1503 struct IsHalfFloatFormat { | 1510 struct IsHalfFloatFormat { |
| 1511 STATIC_ONLY(IsHalfFloatFormat); |
| 1504 static const bool Value = | 1512 static const bool Value = |
| 1505 Format == WebGLImageConversion::DataFormatRGBA16F | 1513 Format == WebGLImageConversion::DataFormatRGBA16F |
| 1506 || Format == WebGLImageConversion::DataFormatRGB16F | 1514 || Format == WebGLImageConversion::DataFormatRGB16F |
| 1507 || Format == WebGLImageConversion::DataFormatRA16F | 1515 || Format == WebGLImageConversion::DataFormatRA16F |
| 1508 || Format == WebGLImageConversion::DataFormatR16F | 1516 || Format == WebGLImageConversion::DataFormatR16F |
| 1509 || Format == WebGLImageConversion::DataFormatA16F | 1517 || Format == WebGLImageConversion::DataFormatA16F |
| 1510 || Format == WebGLImageConversion::DataFormatRG16F; | 1518 || Format == WebGLImageConversion::DataFormatRG16F; |
| 1511 }; | 1519 }; |
| 1512 | 1520 |
| 1513 template<int Format> | 1521 template<int Format> |
| 1514 struct Is32bppFormat { | 1522 struct Is32bppFormat { |
| 1523 STATIC_ONLY(Is32bppFormat); |
| 1515 static const bool Value = | 1524 static const bool Value = |
| 1516 Format == WebGLImageConversion::DataFormatRGBA2_10_10_10 | 1525 Format == WebGLImageConversion::DataFormatRGBA2_10_10_10 |
| 1517 || Format == WebGLImageConversion::DataFormatRGB5999 | 1526 || Format == WebGLImageConversion::DataFormatRGB5999 |
| 1518 || Format == WebGLImageConversion::DataFormatRGB10F11F11F; | 1527 || Format == WebGLImageConversion::DataFormatRGB10F11F11F; |
| 1519 }; | 1528 }; |
| 1520 | 1529 |
| 1521 template<int Format> | 1530 template<int Format> |
| 1522 struct Is16bppFormat { | 1531 struct Is16bppFormat { |
| 1532 STATIC_ONLY(Is16bppFormat); |
| 1523 static const bool Value = | 1533 static const bool Value = |
| 1524 Format == WebGLImageConversion::DataFormatRGBA5551 | 1534 Format == WebGLImageConversion::DataFormatRGBA5551 |
| 1525 || Format == WebGLImageConversion::DataFormatRGBA4444 | 1535 || Format == WebGLImageConversion::DataFormatRGBA4444 |
| 1526 || Format == WebGLImageConversion::DataFormatRGB565; | 1536 || Format == WebGLImageConversion::DataFormatRGB565; |
| 1527 }; | 1537 }; |
| 1528 | 1538 |
| 1529 template<int Format, | 1539 template<int Format, |
| 1530 bool IsInt8Format = IsInt8Format<Format>::Value, | 1540 bool IsInt8Format = IsInt8Format<Format>::Value, |
| 1531 bool IsUInt8Format = IsUInt8Format<Format>::Value, | 1541 bool IsUInt8Format = IsUInt8Format<Format>::Value, |
| 1532 bool IsInt16Format = IsInt16Format<Format>::Value, | 1542 bool IsInt16Format = IsInt16Format<Format>::Value, |
| 1533 bool IsUInt16Format = IsUInt16Format<Format>::Value, | 1543 bool IsUInt16Format = IsUInt16Format<Format>::Value, |
| 1534 bool IsInt32Format = IsInt32Format<Format>::Value, | 1544 bool IsInt32Format = IsInt32Format<Format>::Value, |
| 1535 bool IsUInt32Format = IsUInt32Format<Format>::Value, | 1545 bool IsUInt32Format = IsUInt32Format<Format>::Value, |
| 1536 bool IsFloat = IsFloatFormat<Format>::Value, | 1546 bool IsFloat = IsFloatFormat<Format>::Value, |
| 1537 bool IsHalfFloat = IsHalfFloatFormat<Format>::Value, | 1547 bool IsHalfFloat = IsHalfFloatFormat<Format>::Value, |
| 1538 bool Is16bpp = Is16bppFormat<Format>::Value, | 1548 bool Is16bpp = Is16bppFormat<Format>::Value, |
| 1539 bool Is32bpp = Is32bppFormat<Format>::Value> | 1549 bool Is32bpp = Is32bppFormat<Format>::Value> |
| 1540 struct DataTypeForFormat { | 1550 struct DataTypeForFormat { |
| 1551 STATIC_ONLY(DataTypeForFormat); |
| 1541 typedef double Type; // Use a type that's not used in unpack/pack. | 1552 typedef double Type; // Use a type that's not used in unpack/pack. |
| 1542 }; | 1553 }; |
| 1543 | 1554 |
| 1544 template<int Format> | 1555 template<int Format> |
| 1545 struct DataTypeForFormat<Format, true, false, false, false, false, false, false,
false, false, false> { | 1556 struct DataTypeForFormat<Format, true, false, false, false, false, false, false,
false, false, false> { |
| 1557 STATIC_ONLY(DataTypeForFormat); |
| 1546 typedef int8_t Type; | 1558 typedef int8_t Type; |
| 1547 }; | 1559 }; |
| 1548 | 1560 |
| 1549 template<int Format> | 1561 template<int Format> |
| 1550 struct DataTypeForFormat<Format, false, true, false, false, false, false, false,
false, false, false> { | 1562 struct DataTypeForFormat<Format, false, true, false, false, false, false, false,
false, false, false> { |
| 1563 STATIC_ONLY(DataTypeForFormat); |
| 1551 typedef uint8_t Type; | 1564 typedef uint8_t Type; |
| 1552 }; | 1565 }; |
| 1553 | 1566 |
| 1554 template<int Format> | 1567 template<int Format> |
| 1555 struct DataTypeForFormat<Format, false, false, true, false, false, false, false,
false, false, false> { | 1568 struct DataTypeForFormat<Format, false, false, true, false, false, false, false,
false, false, false> { |
| 1569 STATIC_ONLY(DataTypeForFormat); |
| 1556 typedef int16_t Type; | 1570 typedef int16_t Type; |
| 1557 }; | 1571 }; |
| 1558 | 1572 |
| 1559 template<int Format> | 1573 template<int Format> |
| 1560 struct DataTypeForFormat<Format, false, false, false, true, false, false, false,
false, false, false> { | 1574 struct DataTypeForFormat<Format, false, false, false, true, false, false, false,
false, false, false> { |
| 1575 STATIC_ONLY(DataTypeForFormat); |
| 1561 typedef uint16_t Type; | 1576 typedef uint16_t Type; |
| 1562 }; | 1577 }; |
| 1563 | 1578 |
| 1564 template<int Format> | 1579 template<int Format> |
| 1565 struct DataTypeForFormat<Format, false, false, false, false, true, false, false,
false, false, false> { | 1580 struct DataTypeForFormat<Format, false, false, false, false, true, false, false,
false, false, false> { |
| 1581 STATIC_ONLY(DataTypeForFormat); |
| 1566 typedef int32_t Type; | 1582 typedef int32_t Type; |
| 1567 }; | 1583 }; |
| 1568 | 1584 |
| 1569 template<int Format> | 1585 template<int Format> |
| 1570 struct DataTypeForFormat<Format, false, false, false, false, false, true, false,
false, false, false> { | 1586 struct DataTypeForFormat<Format, false, false, false, false, false, true, false,
false, false, false> { |
| 1587 STATIC_ONLY(DataTypeForFormat); |
| 1571 typedef uint32_t Type; | 1588 typedef uint32_t Type; |
| 1572 }; | 1589 }; |
| 1573 | 1590 |
| 1574 template<int Format> | 1591 template<int Format> |
| 1575 struct DataTypeForFormat<Format, false, false, false, false, false, false, true,
false, false, false> { | 1592 struct DataTypeForFormat<Format, false, false, false, false, false, false, true,
false, false, false> { |
| 1593 STATIC_ONLY(DataTypeForFormat); |
| 1576 typedef float Type; | 1594 typedef float Type; |
| 1577 }; | 1595 }; |
| 1578 | 1596 |
| 1579 template<int Format> | 1597 template<int Format> |
| 1580 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, true, false, false> { | 1598 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, true, false, false> { |
| 1599 STATIC_ONLY(DataTypeForFormat); |
| 1581 typedef uint16_t Type; | 1600 typedef uint16_t Type; |
| 1582 }; | 1601 }; |
| 1583 | 1602 |
| 1584 template<int Format> | 1603 template<int Format> |
| 1585 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, false, true, false> { | 1604 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, false, true, false> { |
| 1605 STATIC_ONLY(DataTypeForFormat); |
| 1586 typedef uint16_t Type; | 1606 typedef uint16_t Type; |
| 1587 }; | 1607 }; |
| 1588 | 1608 |
| 1589 template<int Format> | 1609 template<int Format> |
| 1590 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, false, false, true> { | 1610 struct DataTypeForFormat<Format, false, false, false, false, false, false, false
, false, false, true> { |
| 1611 STATIC_ONLY(DataTypeForFormat); |
| 1591 typedef uint32_t Type; | 1612 typedef uint32_t Type; |
| 1592 }; | 1613 }; |
| 1593 | 1614 |
| 1594 template<int Format> | 1615 template<int Format> |
| 1595 struct UsesFloatIntermediateFormat { | 1616 struct UsesFloatIntermediateFormat { |
| 1617 STATIC_ONLY(UsesFloatIntermediateFormat); |
| 1596 static const bool Value = | 1618 static const bool Value = |
| 1597 IsFloatFormat<Format>::Value | 1619 IsFloatFormat<Format>::Value |
| 1598 || IsHalfFloatFormat<Format>::Value | 1620 || IsHalfFloatFormat<Format>::Value |
| 1599 || Format == WebGLImageConversion::DataFormatRGBA2_10_10_10 | 1621 || Format == WebGLImageConversion::DataFormatRGBA2_10_10_10 |
| 1600 || Format == WebGLImageConversion::DataFormatRGB10F11F11F | 1622 || Format == WebGLImageConversion::DataFormatRGB10F11F11F |
| 1601 || Format == WebGLImageConversion::DataFormatRGB5999; | 1623 || Format == WebGLImageConversion::DataFormatRGB5999; |
| 1602 }; | 1624 }; |
| 1603 | 1625 |
| 1604 template<int Format> | 1626 template<int Format> |
| 1605 struct IntermediateFormat { | 1627 struct IntermediateFormat { |
| 1628 STATIC_ONLY(IntermediateFormat); |
| 1606 static const int Value = | 1629 static const int Value = |
| 1607 UsesFloatIntermediateFormat<Format>::Value ? WebGLImageConversion::DataF
ormatRGBA32F | 1630 UsesFloatIntermediateFormat<Format>::Value ? WebGLImageConversion::DataF
ormatRGBA32F |
| 1608 : IsInt32Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA32_
S | 1631 : IsInt32Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA32_
S |
| 1609 : IsUInt32Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA32 | 1632 : IsUInt32Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA32 |
| 1610 : IsInt16Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA16_
S | 1633 : IsInt16Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA16_
S |
| 1611 : (IsUInt16Format<Format>::Value || Is32bppFormat<Format>::Value) ? WebG
LImageConversion::DataFormatRGBA16 | 1634 : (IsUInt16Format<Format>::Value || Is32bppFormat<Format>::Value) ? WebG
LImageConversion::DataFormatRGBA16 |
| 1612 : IsInt8Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA8_S
: WebGLImageConversion::DataFormatRGBA8; | 1635 : IsInt8Format<Format>::Value ? WebGLImageConversion::DataFormatRGBA8_S
: WebGLImageConversion::DataFormatRGBA8; |
| 1613 }; | 1636 }; |
| 1614 | 1637 |
| 1615 unsigned TexelBytesForFormat(WebGLImageConversion::DataFormat format) | 1638 unsigned TexelBytesForFormat(WebGLImageConversion::DataFormat format) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 case WebGLImageConversion::DataFormatRGBA32F: | 1700 case WebGLImageConversion::DataFormatRGBA32F: |
| 1678 return 16; | 1701 return 16; |
| 1679 default: | 1702 default: |
| 1680 return 0; | 1703 return 0; |
| 1681 } | 1704 } |
| 1682 } | 1705 } |
| 1683 | 1706 |
| 1684 /* END CODE SHARED WITH MOZILLA FIREFOX */ | 1707 /* END CODE SHARED WITH MOZILLA FIREFOX */ |
| 1685 | 1708 |
| 1686 class FormatConverter { | 1709 class FormatConverter { |
| 1710 STACK_ALLOCATED(); |
| 1687 public: | 1711 public: |
| 1688 FormatConverter(unsigned width, unsigned height, | 1712 FormatConverter(unsigned width, unsigned height, |
| 1689 const void* srcStart, void* dstStart, int srcStride, int dstStride) | 1713 const void* srcStart, void* dstStart, int srcStride, int dstStride) |
| 1690 : m_width(width), m_height(height), m_srcStart(srcStart), m_dstStart(dst
Start), m_srcStride(srcStride), m_dstStride(dstStride), m_success(false) | 1714 : m_width(width), m_height(height), m_srcStart(srcStart), m_dstStart(dst
Start), m_srcStride(srcStride), m_dstStride(dstStride), m_success(false) |
| 1691 { | 1715 { |
| 1692 const unsigned MaxNumberOfComponents = 4; | 1716 const unsigned MaxNumberOfComponents = 4; |
| 1693 const unsigned MaxBytesPerComponent = 4; | 1717 const unsigned MaxBytesPerComponent = 4; |
| 1694 m_unpackedIntermediateSrcData = adoptArrayPtr(new uint8_t[m_width * MaxN
umberOfComponents *MaxBytesPerComponent]); | 1718 m_unpackedIntermediateSrcData = adoptArrayPtr(new uint8_t[m_width * MaxN
umberOfComponents *MaxBytesPerComponent]); |
| 1695 ASSERT(m_unpackedIntermediateSrcData.get()); | 1719 ASSERT(m_unpackedIntermediateSrcData.get()); |
| 1696 } | 1720 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 FORMATCONVERTER_CASE_ALPHAOP(WebGLImageConversion::AlphaDoPremultipl
y) | 1818 FORMATCONVERTER_CASE_ALPHAOP(WebGLImageConversion::AlphaDoPremultipl
y) |
| 1795 FORMATCONVERTER_CASE_ALPHAOP(WebGLImageConversion::AlphaDoUnmultiply
) | 1819 FORMATCONVERTER_CASE_ALPHAOP(WebGLImageConversion::AlphaDoUnmultiply
) |
| 1796 default: | 1820 default: |
| 1797 ASSERT_NOT_REACHED(); | 1821 ASSERT_NOT_REACHED(); |
| 1798 } | 1822 } |
| 1799 #undef FORMATCONVERTER_CASE_ALPHAOP | 1823 #undef FORMATCONVERTER_CASE_ALPHAOP |
| 1800 } | 1824 } |
| 1801 | 1825 |
| 1802 template<int Format> | 1826 template<int Format> |
| 1803 struct SupportsConversionFromDomElements { | 1827 struct SupportsConversionFromDomElements { |
| 1828 STATIC_ONLY(SupportsConversionFromDomElements); |
| 1804 static const bool Value = | 1829 static const bool Value = |
| 1805 Format == WebGLImageConversion::DataFormatRGBA8 | 1830 Format == WebGLImageConversion::DataFormatRGBA8 |
| 1806 || Format == WebGLImageConversion::DataFormatRGB8 | 1831 || Format == WebGLImageConversion::DataFormatRGB8 |
| 1807 || Format == WebGLImageConversion::DataFormatRG8 | 1832 || Format == WebGLImageConversion::DataFormatRG8 |
| 1808 || Format == WebGLImageConversion::DataFormatRA8 | 1833 || Format == WebGLImageConversion::DataFormatRA8 |
| 1809 || Format == WebGLImageConversion::DataFormatR8 | 1834 || Format == WebGLImageConversion::DataFormatR8 |
| 1810 || Format == WebGLImageConversion::DataFormatRGBA32F | 1835 || Format == WebGLImageConversion::DataFormatRGBA32F |
| 1811 || Format == WebGLImageConversion::DataFormatRGB32F | 1836 || Format == WebGLImageConversion::DataFormatRGB32F |
| 1812 || Format == WebGLImageConversion::DataFormatRG32F | 1837 || Format == WebGLImageConversion::DataFormatRG32F |
| 1813 || Format == WebGLImageConversion::DataFormatRA32F | 1838 || Format == WebGLImageConversion::DataFormatRA32F |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 } | 2332 } |
| 2308 | 2333 |
| 2309 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); | 2334 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); |
| 2310 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); | 2335 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); |
| 2311 if (!converter.Success()) | 2336 if (!converter.Success()) |
| 2312 return false; | 2337 return false; |
| 2313 return true; | 2338 return true; |
| 2314 } | 2339 } |
| 2315 | 2340 |
| 2316 } // namespace blink | 2341 } // namespace blink |
| OLD | NEW |