Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: src/core/SkXfermode.cpp

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkXfermode.h" 10 #include "SkXfermode.h"
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 1230 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
1231 1231
1232 return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL)); 1232 return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL));
1233 } 1233 }
1234 1234
1235 #endif 1235 #endif
1236 1236
1237 /////////////////////////////////////////////////////////////////////////////// 1237 ///////////////////////////////////////////////////////////////////////////////
1238 /////////////////////////////////////////////////////////////////////////////// 1238 ///////////////////////////////////////////////////////////////////////////////
1239 1239
1240 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1241 SkProcCoeffXfermode::SkProcCoeffXfermode(SkReadBuffer& buffer) : INHERITED(buffe r) {
1242 uint32_t mode32 = buffer.read32() % SK_ARRAY_COUNT(gProcCoeffs);
1243 if (mode32 >= SK_ARRAY_COUNT(gProcCoeffs)) {
1244 // out of range, just set to something harmless
1245 mode32 = SkXfermode::kSrcOut_Mode;
1246 }
1247 fMode = (SkXfermode::Mode)mode32;
1248
1249 const ProcCoeff& rec = gProcCoeffs[fMode];
1250 fProc = rec.fProc;
1251 // these may be valid, or may be CANNOT_USE_COEFF
1252 fSrcCoeff = rec.fSC;
1253 fDstCoeff = rec.fDC;
1254 }
1255 #endif
1256
1257 SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) { 1240 SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) {
1258 uint32_t mode32 = buffer.read32(); 1241 uint32_t mode32 = buffer.read32();
1259 if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) { 1242 if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) {
1260 return NULL; 1243 return NULL;
1261 } 1244 }
1262 return SkXfermode::Create((SkXfermode::Mode)mode32); 1245 return SkXfermode::Create((SkXfermode::Mode)mode32);
1263 } 1246 }
1264 1247
1265 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const { 1248 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const {
1266 buffer.write32(fMode); 1249 buffer.write32(fMode);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 return SkNEW_ARGS(SkClearXfermode, (rec)); 1419 return SkNEW_ARGS(SkClearXfermode, (rec));
1437 } 1420 }
1438 1421
1439 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; 1422 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE;
1440 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S K_OVERRIDE; 1423 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S K_OVERRIDE;
1441 1424
1442 SK_TO_STRING_OVERRIDE() 1425 SK_TO_STRING_OVERRIDE()
1443 1426
1444 private: 1427 private:
1445 SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode ) {} 1428 SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode ) {}
1446 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1447 SkClearXfermode(SkReadBuffer& buffer) : SkProcCoeffXfermode(buffer) {}
1448 #endif
1449 1429
1450 typedef SkProcCoeffXfermode INHERITED; 1430 typedef SkProcCoeffXfermode INHERITED;
1451 }; 1431 };
1452 1432
1453 void SkClearXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 1433 void SkClearXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
1454 const SkPMColor* SK_RESTRICT, int count, 1434 const SkPMColor* SK_RESTRICT, int count,
1455 const SkAlpha* SK_RESTRICT aa) const { 1435 const SkAlpha* SK_RESTRICT aa) const {
1456 SkASSERT(dst && count >= 0); 1436 SkASSERT(dst && count >= 0);
1457 1437
1458 if (NULL == aa) { 1438 if (NULL == aa) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 return SkNEW_ARGS(SkSrcXfermode, (rec)); 1481 return SkNEW_ARGS(SkSrcXfermode, (rec));
1502 } 1482 }
1503 1483
1504 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; 1484 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE;
1505 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S K_OVERRIDE; 1485 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S K_OVERRIDE;
1506 1486
1507 SK_TO_STRING_OVERRIDE() 1487 SK_TO_STRING_OVERRIDE()
1508 1488
1509 private: 1489 private:
1510 SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} 1490 SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {}
1511 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1512 SkSrcXfermode(SkReadBuffer& buffer) : SkProcCoeffXfermode(buffer) {}
1513 #endif
1514 typedef SkProcCoeffXfermode INHERITED; 1491 typedef SkProcCoeffXfermode INHERITED;
1515 }; 1492 };
1516 1493
1517 void SkSrcXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 1494 void SkSrcXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
1518 const SkPMColor* SK_RESTRICT src, int count, 1495 const SkPMColor* SK_RESTRICT src, int count,
1519 const SkAlpha* SK_RESTRICT aa) const { 1496 const SkAlpha* SK_RESTRICT aa) const {
1520 SkASSERT(dst && src && count >= 0); 1497 SkASSERT(dst && src && count >= 0);
1521 1498
1522 if (NULL == aa) { 1499 if (NULL == aa) {
1523 memcpy(dst, src, count << 2); 1500 memcpy(dst, src, count << 2);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 static SkDstInXfermode* Create(const ProcCoeff& rec) { 1546 static SkDstInXfermode* Create(const ProcCoeff& rec) {
1570 return SkNEW_ARGS(SkDstInXfermode, (rec)); 1547 return SkNEW_ARGS(SkDstInXfermode, (rec));
1571 } 1548 }
1572 1549
1573 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; 1550 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE;
1574 1551
1575 SK_TO_STRING_OVERRIDE() 1552 SK_TO_STRING_OVERRIDE()
1576 1553
1577 private: 1554 private:
1578 SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode ) {} 1555 SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode ) {}
1579 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1580 SkDstInXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {}
1581 #endif
1582 1556
1583 typedef SkProcCoeffXfermode INHERITED; 1557 typedef SkProcCoeffXfermode INHERITED;
1584 }; 1558 };
1585 1559
1586 void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 1560 void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
1587 const SkPMColor* SK_RESTRICT src, int count, 1561 const SkPMColor* SK_RESTRICT src, int count,
1588 const SkAlpha* SK_RESTRICT aa) const { 1562 const SkAlpha* SK_RESTRICT aa) const {
1589 SkASSERT(dst && src); 1563 SkASSERT(dst && src);
1590 1564
1591 if (count <= 0) { 1565 if (count <= 0) {
(...skipping 24 matching lines...) Expand all
1616 static SkDstOutXfermode* Create(const ProcCoeff& rec) { 1590 static SkDstOutXfermode* Create(const ProcCoeff& rec) {
1617 return SkNEW_ARGS(SkDstOutXfermode, (rec)); 1591 return SkNEW_ARGS(SkDstOutXfermode, (rec));
1618 } 1592 }
1619 1593
1620 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; 1594 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE;
1621 1595
1622 SK_TO_STRING_OVERRIDE() 1596 SK_TO_STRING_OVERRIDE()
1623 1597
1624 private: 1598 private:
1625 SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mo de) {} 1599 SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mo de) {}
1626 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1627 SkDstOutXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {}
1628 #endif
1629 1600
1630 typedef SkProcCoeffXfermode INHERITED; 1601 typedef SkProcCoeffXfermode INHERITED;
1631 }; 1602 };
1632 1603
1633 void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 1604 void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
1634 const SkPMColor* SK_RESTRICT src, int count, 1605 const SkPMColor* SK_RESTRICT src, int count,
1635 const SkAlpha* SK_RESTRICT aa) const { 1606 const SkAlpha* SK_RESTRICT aa) const {
1636 SkASSERT(dst && src); 1607 SkASSERT(dst && src);
1637 1608
1638 if (count <= 0) { 1609 if (count <= 0) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 } else { 1924 } else {
1954 proc16 = rec.fProc16_General; 1925 proc16 = rec.fProc16_General;
1955 } 1926 }
1956 } 1927 }
1957 return proc16; 1928 return proc16;
1958 } 1929 }
1959 1930
1960 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1931 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1932 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1933 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698