aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-10-05 17:33:02 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-05 17:33:03 -0700
commit374772bd61951f01bf84fe17bf53d8867681c9ae (patch)
treeade94be090be12f7503fd35e77c4dae2dc1f0a47 /src/utils
parent61c21cdcc31081a1bd4a3a7480b482d135f7df33 (diff)
Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints"
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/SkDumpCanvas.cpp8
-rw-r--r--src/utils/SkLua.cpp40
-rw-r--r--src/utils/SkRGBAToYUV.cpp2
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(