diff options
author | Mike Reed <reed@google.com> | 2016-10-04 10:06:20 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-04 20:09:34 +0000 |
commit | 1834242ec6e3cd62669227d394bc79e1cd66dcfb (patch) | |
tree | c956e75f272619b5901ca0beab31dbf4a50d9974 /src/utils | |
parent | 6942442ef7cc018ac136dd379ad6a30902a060e5 (diff) |
Revert[4] "replace SkXfermode obj with SkBlendMode enum in paints"
This reverts commit 2cbcd12281ee807214df094964c584c78932e10b.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2924
Change-Id: I0fa5c58af428f3da8565465d1219a34ef8417d9a
Reviewed-on: https://skia-review.googlesource.com/2924
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkLua.cpp | 40 | ||||
-rw-r--r-- | src/utils/SkRGBAToYUV.cpp | 2 |
3 files changed, 6 insertions, 44 deletions
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index fcb24d28c4..68bd13eccb 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -209,8 +209,8 @@ SkCanvas::SaveLayerStrategy SkDumpCanvas::getSaveLayerStrategy(const SaveLayerRe if (paint->getAlpha() != 0xFF) { str.appendf(" alpha:0x%02X", paint->getAlpha()); } - if (paint->getXfermode()) { - str.appendf(" xfermode:%p", paint->getXfermode()); + if (!paint->isSrcOver()) { + str.appendf(" blendmode:%d", paint->getBlendMode()); } } this->dump(kSave_Verb, paint, str.c_str()); @@ -540,8 +540,10 @@ void SkFormatDumper::dump(SkDumpCanvas* canvas, SkDumpCanvas::Verb verb, if (p) { msg.appendf(" color:0x%08X flags:%X", p->getColor(), p->getFlags()); + if (!p->isSrcOver()) { + msg.appendf(" blendmode:%d", p->getBlendMode()); + } appendFlattenable(&msg, p->getShader(), "shader"); - appendFlattenable(&msg, p->getXfermode(), "xfermode"); appendFlattenable(&msg, p->getPathEffect(), "pathEffect"); appendFlattenable(&msg, p->getMaskFilter(), "maskFilter"); appendFlattenable(&msg, p->getPathEffect(), "pathEffect"); diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp index e80708c71c..ba311af61c 100644 --- a/src/utils/SkLua.cpp +++ b/src/utils/SkLua.cpp @@ -28,7 +28,6 @@ #include "SkSurface.h" #include "SkTextBlob.h" #include "SkTypeface.h" -#include "SkXfermode.h" extern "C" { #include "lua.h" @@ -59,7 +58,6 @@ DEF_MTNAME(SkShader) DEF_MTNAME(SkSurface) DEF_MTNAME(SkTextBlob) DEF_MTNAME(SkTypeface) -DEF_MTNAME(SkXfermode) template <typename T> T* push_new(lua_State* L) { T* addr = (T*)lua_newuserdata(L, sizeof(T)); @@ -1073,26 +1071,9 @@ static int lpaint_getEffects(lua_State* L) { setfield_bool_if(L, "shader", !!paint->getShader()); setfield_bool_if(L, "colorFilter", !!paint->getColorFilter()); setfield_bool_if(L, "imageFilter", !!paint->getImageFilter()); - setfield_bool_if(L, "xfermode", !!paint->getXfermode()); return 1; } -static int lpaint_getXfermode(lua_State* L) { - const SkPaint* paint = get_obj<SkPaint>(L, 1); - SkXfermode* xfermode = paint->getXfermode(); - if (xfermode) { - push_ref(L, xfermode); - return 1; - } - return 0; -} - -static int lpaint_setXfermode(lua_State* L) { - SkPaint* paint = get_obj<SkPaint>(L, 1); - paint->setXfermode(sk_ref_sp(get_ref<SkXfermode>(L, 2))); - return 0; -} - static int lpaint_getColorFilter(lua_State* L) { const SkPaint* paint = get_obj<SkPaint>(L, 1); SkColorFilter* cf = paint->getColorFilter(); @@ -1217,8 +1198,6 @@ static const struct luaL_Reg gSkPaint_Methods[] = { { "setColorFilter", lpaint_setColorFilter }, { "getImageFilter", lpaint_getImageFilter }, { "setImageFilter", lpaint_setImageFilter }, - { "getXfermode", lpaint_getXfermode }, - { "setXfermode", lpaint_setXfermode }, { "getShader", lpaint_getShader }, { "setShader", lpaint_setShader }, { "getPathEffect", lpaint_getPathEffect }, @@ -1341,24 +1320,6 @@ static const struct luaL_Reg gSkPathEffect_Methods[] = { /////////////////////////////////////////////////////////////////////////////// -static int lpxfermode_getTypeName(lua_State* L) { - lua_pushstring(L, get_ref<SkXfermode>(L, 1)->getTypeName()); - return 1; -} - -static int lpxfermode_gc(lua_State* L) { - get_ref<SkXfermode>(L, 1)->unref(); - return 0; -} - -static const struct luaL_Reg gSkXfermode_Methods[] = { - { "getTypeName", lpxfermode_getTypeName }, - { "__gc", lpxfermode_gc }, - { nullptr, nullptr } -}; - -/////////////////////////////////////////////////////////////////////////////// - static int lpcolorfilter_gc(lua_State* L) { get_ref<SkColorFilter>(L, 1)->unref(); return 0; @@ -2178,7 +2139,6 @@ void SkLua::Load(lua_State* L) { REG_CLASS(L, SkSurface); REG_CLASS(L, SkTextBlob); REG_CLASS(L, SkTypeface); - REG_CLASS(L, SkXfermode); } extern "C" int luaopen_skia(lua_State* L); diff --git a/src/utils/SkRGBAToYUV.cpp b/src/utils/SkRGBAToYUV.cpp index 63d9152362..0528b144f0 100644 --- a/src/utils/SkRGBAToYUV.cpp +++ b/src/utils/SkRGBAToYUV.cpp @@ -45,7 +45,7 @@ bool SkRGBAToYUV(const SkImage* image, const SkISize sizes[3], void* const plane } SkPaint paint; paint.setFilterQuality(kLow_SkFilterQuality); - paint.setXfermodeMode(SkXfermode::kSrc_Mode); + paint.setBlendMode(SkBlendMode::kSrc); int rowStartIdx = 5 * i; const SkScalar* row = kYUVColorSpaceInvMatrices[colorSpace] + rowStartIdx; paint.setColorFilter( |