| OLD | NEW |
| 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 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
| 10 #include "SkXfermode_opts_SSE2.h" | 10 #include "SkXfermode_opts_SSE2.h" |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 } else { | 821 } else { |
| 822 return SkNEW_ARGS(XferEffect, (mode, background)); | 822 return SkNEW_ARGS(XferEffect, (mode, background)); |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 virtual void getGLProcessorKey(const GrGLCaps& caps, | 826 virtual void getGLProcessorKey(const GrGLCaps& caps, |
| 827 GrProcessorKeyBuilder* b) const SK_OVERRIDE { | 827 GrProcessorKeyBuilder* b) const SK_OVERRIDE { |
| 828 GLProcessor::GenKey(*this, caps, b); | 828 GLProcessor::GenKey(*this, caps, b); |
| 829 } | 829 } |
| 830 | 830 |
| 831 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { | 831 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { |
| 832 return SkNEW_ARGS(GLProcessor, (*this)); | 832 return SkNEW_ARGS(GLProcessor, (*this)); |
| 833 } | 833 } |
| 834 | 834 |
| 835 virtual const char* name() const SK_OVERRIDE { return "XferEffect"; } | 835 const char* name() const SK_OVERRIDE { return "XferEffect"; } |
| 836 | 836 |
| 837 SkXfermode::Mode mode() const { return fMode; } | 837 SkXfermode::Mode mode() const { return fMode; } |
| 838 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} | 838 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} |
| 839 | 839 |
| 840 class GLProcessor : public GrGLFragmentProcessor { | 840 class GLProcessor : public GrGLFragmentProcessor { |
| 841 public: | 841 public: |
| 842 GLProcessor(const GrFragmentProcessor&) {} | 842 GLProcessor(const GrFragmentProcessor&) {} |
| 843 | 843 |
| 844 virtual void emitCode(GrGLFPBuilder* builder, | 844 virtual void emitCode(GrGLFPBuilder* builder, |
| 845 const GrFragmentProcessor& fp, | 845 const GrFragmentProcessor& fp, |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 if (background) { | 1228 if (background) { |
| 1229 fBackgroundTransform.reset(kLocal_GrCoordSet, background, | 1229 fBackgroundTransform.reset(kLocal_GrCoordSet, background, |
| 1230 GrTextureParams::kNone_FilterMode); | 1230 GrTextureParams::kNone_FilterMode); |
| 1231 this->addCoordTransform(&fBackgroundTransform); | 1231 this->addCoordTransform(&fBackgroundTransform); |
| 1232 fBackgroundAccess.reset(background); | 1232 fBackgroundAccess.reset(background); |
| 1233 this->addTextureAccess(&fBackgroundAccess); | 1233 this->addTextureAccess(&fBackgroundAccess); |
| 1234 } else { | 1234 } else { |
| 1235 this->setWillReadDstColor(); | 1235 this->setWillReadDstColor(); |
| 1236 } | 1236 } |
| 1237 } | 1237 } |
| 1238 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE { | 1238 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE { |
| 1239 const XferEffect& s = other.cast<XferEffect>(); | 1239 const XferEffect& s = other.cast<XferEffect>(); |
| 1240 return fMode == s.fMode; | 1240 return fMode == s.fMode; |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { | 1243 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE { |
| 1244 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); | 1244 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 SkXfermode::Mode fMode; | 1247 SkXfermode::Mode fMode; |
| 1248 GrCoordTransform fBackgroundTransform; | 1248 GrCoordTransform fBackgroundTransform; |
| 1249 GrTextureAccess fBackgroundAccess; | 1249 GrTextureAccess fBackgroundAccess; |
| 1250 | 1250 |
| 1251 typedef GrFragmentProcessor INHERITED; | 1251 typedef GrFragmentProcessor INHERITED; |
| 1252 }; | 1252 }; |
| 1253 | 1253 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 #endif | 1441 #endif |
| 1442 | 1442 |
| 1443 /////////////////////////////////////////////////////////////////////////////// | 1443 /////////////////////////////////////////////////////////////////////////////// |
| 1444 | 1444 |
| 1445 class SkClearXfermode : public SkProcCoeffXfermode { | 1445 class SkClearXfermode : public SkProcCoeffXfermode { |
| 1446 public: | 1446 public: |
| 1447 static SkClearXfermode* Create(const ProcCoeff& rec) { | 1447 static SkClearXfermode* Create(const ProcCoeff& rec) { |
| 1448 return SkNEW_ARGS(SkClearXfermode, (rec)); | 1448 return SkNEW_ARGS(SkClearXfermode, (rec)); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const
SK_OVERRIDE; | 1451 void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVER
RIDE; |
| 1452 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S
K_OVERRIDE; | 1452 void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRI
DE; |
| 1453 | 1453 |
| 1454 SK_TO_STRING_OVERRIDE() | 1454 SK_TO_STRING_OVERRIDE() |
| 1455 | 1455 |
| 1456 private: | 1456 private: |
| 1457 SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode
) {} | 1457 SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode
) {} |
| 1458 | 1458 |
| 1459 typedef SkProcCoeffXfermode INHERITED; | 1459 typedef SkProcCoeffXfermode INHERITED; |
| 1460 }; | 1460 }; |
| 1461 | 1461 |
| 1462 void SkClearXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 1462 void SkClearXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 #endif | 1503 #endif |
| 1504 | 1504 |
| 1505 /////////////////////////////////////////////////////////////////////////////// | 1505 /////////////////////////////////////////////////////////////////////////////// |
| 1506 | 1506 |
| 1507 class SkSrcXfermode : public SkProcCoeffXfermode { | 1507 class SkSrcXfermode : public SkProcCoeffXfermode { |
| 1508 public: | 1508 public: |
| 1509 static SkSrcXfermode* Create(const ProcCoeff& rec) { | 1509 static SkSrcXfermode* Create(const ProcCoeff& rec) { |
| 1510 return SkNEW_ARGS(SkSrcXfermode, (rec)); | 1510 return SkNEW_ARGS(SkSrcXfermode, (rec)); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const
SK_OVERRIDE; | 1513 void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVER
RIDE; |
| 1514 virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const S
K_OVERRIDE; | 1514 void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRI
DE; |
| 1515 | 1515 |
| 1516 SK_TO_STRING_OVERRIDE() | 1516 SK_TO_STRING_OVERRIDE() |
| 1517 | 1517 |
| 1518 private: | 1518 private: |
| 1519 SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} | 1519 SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} |
| 1520 typedef SkProcCoeffXfermode INHERITED; | 1520 typedef SkProcCoeffXfermode INHERITED; |
| 1521 }; | 1521 }; |
| 1522 | 1522 |
| 1523 void SkSrcXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 1523 void SkSrcXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
| 1524 const SkPMColor* SK_RESTRICT src, int count, | 1524 const SkPMColor* SK_RESTRICT src, int count, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 #endif | 1569 #endif |
| 1570 | 1570 |
| 1571 /////////////////////////////////////////////////////////////////////////////// | 1571 /////////////////////////////////////////////////////////////////////////////// |
| 1572 | 1572 |
| 1573 class SkDstInXfermode : public SkProcCoeffXfermode { | 1573 class SkDstInXfermode : public SkProcCoeffXfermode { |
| 1574 public: | 1574 public: |
| 1575 static SkDstInXfermode* Create(const ProcCoeff& rec) { | 1575 static SkDstInXfermode* Create(const ProcCoeff& rec) { |
| 1576 return SkNEW_ARGS(SkDstInXfermode, (rec)); | 1576 return SkNEW_ARGS(SkDstInXfermode, (rec)); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const
SK_OVERRIDE; | 1579 void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVER
RIDE; |
| 1580 | 1580 |
| 1581 SK_TO_STRING_OVERRIDE() | 1581 SK_TO_STRING_OVERRIDE() |
| 1582 | 1582 |
| 1583 private: | 1583 private: |
| 1584 SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode
) {} | 1584 SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode
) {} |
| 1585 | 1585 |
| 1586 typedef SkProcCoeffXfermode INHERITED; | 1586 typedef SkProcCoeffXfermode INHERITED; |
| 1587 }; | 1587 }; |
| 1588 | 1588 |
| 1589 void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 1589 void SkDstInXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1613 #endif | 1613 #endif |
| 1614 | 1614 |
| 1615 /////////////////////////////////////////////////////////////////////////////// | 1615 /////////////////////////////////////////////////////////////////////////////// |
| 1616 | 1616 |
| 1617 class SkDstOutXfermode : public SkProcCoeffXfermode { | 1617 class SkDstOutXfermode : public SkProcCoeffXfermode { |
| 1618 public: | 1618 public: |
| 1619 static SkDstOutXfermode* Create(const ProcCoeff& rec) { | 1619 static SkDstOutXfermode* Create(const ProcCoeff& rec) { |
| 1620 return SkNEW_ARGS(SkDstOutXfermode, (rec)); | 1620 return SkNEW_ARGS(SkDstOutXfermode, (rec)); |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const
SK_OVERRIDE; | 1623 void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVER
RIDE; |
| 1624 | 1624 |
| 1625 SK_TO_STRING_OVERRIDE() | 1625 SK_TO_STRING_OVERRIDE() |
| 1626 | 1626 |
| 1627 private: | 1627 private: |
| 1628 SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mo
de) {} | 1628 SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mo
de) {} |
| 1629 | 1629 |
| 1630 typedef SkProcCoeffXfermode INHERITED; | 1630 typedef SkProcCoeffXfermode INHERITED; |
| 1631 }; | 1631 }; |
| 1632 | 1632 |
| 1633 void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 1633 void SkDstOutXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 } else { | 1953 } else { |
| 1954 proc16 = rec.fProc16_General; | 1954 proc16 = rec.fProc16_General; |
| 1955 } | 1955 } |
| 1956 } | 1956 } |
| 1957 return proc16; | 1957 return proc16; |
| 1958 } | 1958 } |
| 1959 | 1959 |
| 1960 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1960 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
| 1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
| 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |