aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-03 12:57:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-03 17:17:10 +0000
commit0591897548c8fcb7d53cc94053e01702e58f1ac5 (patch)
tree099bf31c7bf4bd3062d2e7a8b4268a89f1fd61a2 /src/utils
parenta224bb7027f022cf78376cb7afa2fff83d59153e (diff)
replace SkXfermode obj with SkBlendMode enum in paints
BUG=skia:5814 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2714 Change-Id: I4fb489ba6b3f77b458f7e4a99f79c7ad10859135 Reviewed-on: https://skia-review.googlesource.com/2714 Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
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(