From 9ed02e40d1069a99c89013b2d442d20e07913206 Mon Sep 17 00:00:00 2001 From: tfarina Date: Wed, 3 Dec 2014 13:13:02 -0800 Subject: [PATCH] Add SK_SUPPORT_LEGACY_PORTER_DUFF macro. This trick will be used to remove deprecated SkPorterDuff API. But first we need to add it so Android can be updated later. BUG=skia:3178 R=scroggo@google.com Review URL: https://codereview.chromium.org/758133004 --- gyp/skia_for_android_framework_defines.gypi | 2 ++ include/effects/SkPorterDuff.h | 8 ++++++++ src/effects/SkPorterDuff.cpp | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi index f10f3e6..ee0e1f3 100644 --- a/gyp/skia_for_android_framework_defines.gypi +++ b/gyp/skia_for_android_framework_defines.gypi @@ -20,6 +20,8 @@ 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG', 'SK_LEGACY_PICTURE_SIZE_API', 'SK_LEGACY_PICTURE_DRAW_API', + # TODO(tfarina): Remove this when Android is fixed. skbug.com/3178 + 'SK_SUPPORT_LEGACY_PORTER_DUFF', ], }, } diff --git a/include/effects/SkPorterDuff.h b/include/effects/SkPorterDuff.h index e984e8e..7a62e47 100644 --- a/include/effects/SkPorterDuff.h +++ b/include/effects/SkPorterDuff.h @@ -11,6 +11,12 @@ #include "SkColor.h" #include "SkXfermode.h" +//#define SK_SUPPORT_LEGACY_PORTER_DUFF + +// Temporary guard until we can remove the dependencies in android. Then we +// plan to remove this entirely. +#ifdef SK_SUPPORT_LEGACY_PORTER_DUFF + class SkXfermode; class SK_API SkPorterDuff { @@ -77,3 +83,5 @@ public: } SK_ATTR_DEPRECATED("use SkXfermode::Mode"); #endif + +#endif diff --git a/src/effects/SkPorterDuff.cpp b/src/effects/SkPorterDuff.cpp index 4cdcf79..5564ca7 100644 --- a/src/effects/SkPorterDuff.cpp +++ b/src/effects/SkPorterDuff.cpp @@ -10,6 +10,8 @@ #include "SkPorterDuff.h" #include "SkXfermode.h" +#ifdef SK_SUPPORT_LEGACY_PORTER_DUFF + /* This file just exists as a compatibility layer, gluing the PorterDuff API into the (extended) SkXfermode API */ @@ -85,3 +87,5 @@ SkXfermodeProc SkPorterDuff::GetXfermodeProc(Mode mode) { SkXfermodeProc16 SkPorterDuff::GetXfermodeProc16(Mode mode, SkColor srcColor) { return SkXfermode::GetProc16(gPairs[mode].fXF, srcColor); } + +#endif -- 2.7.4