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

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

Issue 13097006: Add interface to SkXfermode to return a GrEffect and blend coeffs. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add SkGpuDevice.cpp Created 7 years, 8 months 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 | Annotate | Revision Log
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 /////////////////////////////////////////////////////////////////////////////// 673 ///////////////////////////////////////////////////////////////////////////////
674 674
675 bool SkXfermode::asCoeff(Coeff* src, Coeff* dst) const { 675 bool SkXfermode::asCoeff(Coeff* src, Coeff* dst) const {
676 return false; 676 return false;
677 } 677 }
678 678
679 bool SkXfermode::asMode(Mode* mode) const { 679 bool SkXfermode::asMode(Mode* mode) const {
680 return false; 680 return false;
681 } 681 }
682 682
683 bool SkXfermode::asNewEffect(GrContext*, GrEffectRef**, Coeff*, Coeff*) const {
684 return false;
685 }
686
687 bool SkXfermode::AsNewEffect(SkXfermode* xfermode,
688 GrContext* context,
689 GrEffectRef** effect,
690 Coeff* src,
691 Coeff* dst) {
692 if (NULL == xfermode) {
robertphillips 2013/03/27 18:12:09 do we need to set 'effect' to be NULL as part of t
bsalomon 2013/03/27 18:39:42 Yes, will add that.
693 return ModeAsCoeff(kSrcOver_Mode, src, dst);
694 } else {
695 return xfermode->asNewEffect(context, effect, src, dst);
696 }
697 }
698
683 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ 699 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{
684 // no-op. subclasses should override this 700 // no-op. subclasses should override this
685 return dst; 701 return dst;
686 } 702 }
687 703
688 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 704 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
689 const SkPMColor* SK_RESTRICT src, int count, 705 const SkPMColor* SK_RESTRICT src, int count,
690 const SkAlpha* SK_RESTRICT aa) const { 706 const SkAlpha* SK_RESTRICT aa) const {
691 SkASSERT(dst && src && count >= 0); 707 SkASSERT(dst && src && count >= 0);
692 708
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 967
952 if (sc) { 968 if (sc) {
953 *sc = fSrcCoeff; 969 *sc = fSrcCoeff;
954 } 970 }
955 if (dc) { 971 if (dc) {
956 *dc = fDstCoeff; 972 *dc = fDstCoeff;
957 } 973 }
958 return true; 974 return true;
959 } 975 }
960 976
977 virtual bool asNewEffect(GrContext*, GrEffectRef**, Coeff* src, Coeff* dst) const SK_OVERRIDE {
978 return this->asCoeff(src, dst);
979 }
980
961 SK_DEVELOPER_TO_STRING() 981 SK_DEVELOPER_TO_STRING()
962 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) 982 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode)
963 983
964 protected: 984 protected:
965 SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { 985 SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
966 fMode = (SkXfermode::Mode)buffer.read32(); 986 fMode = (SkXfermode::Mode)buffer.read32();
967 987
968 const ProcCoeff& rec = gProcCoeffs[fMode]; 988 const ProcCoeff& rec = gProcCoeffs[fMode];
969 // these may be valid, or may be CANNOT_USE_COEFF 989 // these may be valid, or may be CANNOT_USE_COEFF
970 fSrcCoeff = rec.fSC; 990 fSrcCoeff = rec.fSC;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 return proc16; 1510 return proc16;
1491 } 1511 }
1492 1512
1493 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1513 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1494 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1514 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1495 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) 1515 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode)
1496 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) 1516 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode)
1497 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) 1517 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode)
1498 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) 1518 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode)
1499 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1519 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698