Revert "replace SkXfermode obj with SkBlendMode enum in paints"
This reverts commit I4fb489ba6b3f77b458f7e4a99f79c7ad10859135.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> 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>
>
TBR=bsalomon@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I3e43f79ef5c1709929663fe63cc1f67cd78270b7
Reviewed-on: https://skia-review.googlesource.com/2871
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 1da995b..f15c68c 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -42,8 +42,7 @@
if (*paint) {
if (nullptr != fOverdrawXfermode.get()) {
paint->writable()->setAntiAlias(false);
- // TODO: replace overdraw mode with something else
-// paint->writable()->setXfermode(fOverdrawXfermode);
+ paint->writable()->setXfermode(fOverdrawXfermode);
}
if (fOverrideFilterQuality) {
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 156ca4f7..ba6302c 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -1116,6 +1116,16 @@
}
}
+static void apply_paint_xfermode(const SkPaint& paint, Json::Value* target,
+ UrlDataManager& urlDataManager) {
+ SkFlattenable* xfermode = paint.getXfermode();
+ if (xfermode != nullptr) {
+ Json::Value jsonXfermode;
+ SkDrawCommand::flatten(xfermode, &jsonXfermode, urlDataManager);
+ (*target)[SKDEBUGCANVAS_ATTRIBUTE_XFERMODE] = jsonXfermode;
+ }
+}
+
static void apply_paint_imagefilter(const SkPaint& paint, Json::Value* target,
UrlDataManager& urlDataManager) {
SkFlattenable* imageFilter = paint.getImageFilter();
@@ -1167,6 +1177,7 @@
apply_paint_patheffect(paint, &result, urlDataManager);
apply_paint_maskfilter(paint, &result, urlDataManager);
apply_paint_shader(paint, &result, urlDataManager);
+ apply_paint_xfermode(paint, &result, urlDataManager);
apply_paint_looper(paint, &result, urlDataManager);
apply_paint_imagefilter(paint, &result, urlDataManager);
apply_paint_colorfilter(paint, &result, urlDataManager);
@@ -1235,6 +1246,17 @@
}
}
+static void extract_json_paint_xfermode(Json::Value& jsonPaint, UrlDataManager& urlDataManager,
+ SkPaint* target) {
+ if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_XFERMODE)) {
+ Json::Value jsonXfermode = jsonPaint[SKDEBUGCANVAS_ATTRIBUTE_XFERMODE];
+ sk_sp<SkXfermode> xfermode((SkXfermode*) load_flattenable(jsonXfermode, urlDataManager));
+ if (xfermode != nullptr) {
+ target->setXfermode(xfermode);
+ }
+ }
+}
+
static void extract_json_paint_looper(Json::Value& jsonPaint, UrlDataManager& urlDataManager,
SkPaint* target) {
if (jsonPaint.isMember(SKDEBUGCANVAS_ATTRIBUTE_LOOPER)) {
@@ -1481,6 +1503,7 @@
extract_json_paint_patheffect(paint, urlDataManager, result);
extract_json_paint_maskfilter(paint, urlDataManager, result);
extract_json_paint_colorfilter(paint, urlDataManager, result);
+ extract_json_paint_xfermode(paint, urlDataManager, result);
extract_json_paint_looper(paint, urlDataManager, result);
extract_json_paint_imagefilter(paint, urlDataManager, result);
extract_json_paint_typeface(paint, urlDataManager, result);