diff options
author | Greg Daniel <egdaniel@google.com> | 2016-11-23 16:47:38 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-23 16:47:49 +0000 |
commit | e9d1b299ccbf8017ba57040986ded638f954684a (patch) | |
tree | f35cd6bbf36dd058a71db44ce5d47039e5bbf013 | |
parent | db6830162eca5b94e61d9825ec93306fc615d204 (diff) |
Revert "make it illegal to include SkXfermode.h"
This reverts commit 07764cefbb18041a77897df3453903b0a2016583.
Reason for revert: breaking google3
Original change's description:
> make it illegal to include SkXfermode.h
>
> BUG=skia:
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5133
>
> Change-Id: I6e8596dcb17cd7e8efa67859bb682bf9bfcac4db
> Reviewed-on: https://skia-review.googlesource.com/5133
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
>
TBR=reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I136f9e533eb60633c49dffa19b5747d50b6d98a8
Reviewed-on: https://skia-review.googlesource.com/5196
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
70 files changed, 385 insertions, 6 deletions
diff --git a/bench/BlurRoundRectBench.cpp b/bench/BlurRoundRectBench.cpp index 6ebc641fd9..6aaa11f9d4 100644 --- a/bench/BlurRoundRectBench.cpp +++ b/bench/BlurRoundRectBench.cpp @@ -17,6 +17,7 @@ #include "SkRRect.h" #include "SkRect.h" #include "SkString.h" +#include "SkXfermode.h" // Large blurred RR appear frequently on web pages. This benchmark measures our // performance in this case. diff --git a/gm/aaxfermodes.cpp b/gm/aaxfermodes.cpp index dcb9cb7e1b..df09a0bc9d 100644 --- a/gm/aaxfermodes.cpp +++ b/gm/aaxfermodes.cpp @@ -6,6 +6,7 @@ */ #include "gm.h" +#include "SkArithmeticMode.h" #include "SkBlendModePriv.h" #include "SkPath.h" #include "SkShader.h" diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp index 608649ecfc..80bf6cce8a 100644 --- a/gm/blurroundrect.cpp +++ b/gm/blurroundrect.cpp @@ -17,6 +17,7 @@ #include "SkRect.h" #include "SkRRect.h" #include "SkString.h" +#include "SkXfermode.h" // This GM mimics a blurred RR seen in the wild. class BlurRoundRectGM : public skiagm::GM { diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp index 9541e08258..9b715ef78c 100644 --- a/gm/colortypexfermode.cpp +++ b/gm/colortypexfermode.cpp @@ -8,6 +8,7 @@ #include "SkBitmap.h" #include "SkGradientShader.h" #include "SkShader.h" +#include "SkXfermode.h" #include "../src/fonts/SkGScalerContext.h" namespace skiagm { diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp index 7a8540bc33..785f2bf4a5 100644 --- a/gm/composeshader.cpp +++ b/gm/composeshader.cpp @@ -12,6 +12,7 @@ #include "SkGraphics.h" #include "SkShader.h" #include "SkString.h" +#include "SkXfermode.h" static sk_sp<SkShader> make_shader(SkBlendMode mode) { SkPoint pts[2]; diff --git a/gm/dstreadshuffle.cpp b/gm/dstreadshuffle.cpp index b038fdb1f7..2c3cbc87f9 100644 --- a/gm/dstreadshuffle.cpp +++ b/gm/dstreadshuffle.cpp @@ -9,6 +9,7 @@ #include "SkPath.h" #include "SkRandom.h" #include "SkShader.h" +#include "SkXfermode.h" namespace skiagm { diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp index c4c389a065..453a555a6f 100644 --- a/gm/texteffects.cpp +++ b/gm/texteffects.cpp @@ -150,6 +150,8 @@ constexpr raster_proc gRastProcs[] = { r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 }; +#include "SkXfermode.h" + static void apply_shader(SkPaint* paint, int index) { raster_proc proc = gRastProcs[index]; if (proc) { diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp index fb318dd529..604a767a4f 100644 --- a/gm/xfermodes.cpp +++ b/gm/xfermodes.cpp @@ -8,6 +8,7 @@ #include "gm.h" #include "SkBitmap.h" #include "SkShader.h" +#include "SkXfermode.h" #include "SkPM4f.h" enum SrcType { diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h index 199dff28f1..59f205848a 100644 --- a/include/core/SkXfermode.h +++ b/include/core/SkXfermode.h @@ -8,6 +8,302 @@ #ifndef SkXfermode_DEFINED #define SkXfermode_DEFINED -//#error "SkXfermode.h is deprecated" +#include "SkBlendMode.h" +#include "SkColor.h" +#include "SkFlattenable.h" + +#ifdef SK_SUPPORT_LEGACY_XFERMODE_IS_PUBLIC + +class GrFragmentProcessor; +class GrTexture; +class GrXPFactory; +class SkRasterPipeline; +class SkString; + +struct SkArithmeticParams; + +struct SkPM4f; +typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst); + +/** \class SkXfermode + * + * SkXfermode is the base class for objects that are called to implement custom + * "transfer-modes" in the drawing pipeline. The static function Create(Modes) + * can be called to return an instance of any of the predefined subclasses as + * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, + * then objects drawn with that paint have the xfermode applied. + * + * All subclasses are required to be reentrant-safe : it must be legal to share + * the same instance between several threads. + */ +class SK_API SkXfermode : public SkFlattenable { +public: + virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, + const SkAlpha aa[]) const; + virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, + const SkAlpha aa[]) const; + virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, + const SkAlpha aa[]) const; + + /** Enum of possible coefficients to describe some xfermodes + */ + enum Coeff { + kZero_Coeff, /** 0 */ + kOne_Coeff, /** 1 */ + kSC_Coeff, /** src color */ + kISC_Coeff, /** inverse src color (i.e. 1 - sc) */ + kDC_Coeff, /** dst color */ + kIDC_Coeff, /** inverse dst color (i.e. 1 - dc) */ + kSA_Coeff, /** src alpha */ + kISA_Coeff, /** inverse src alpha (i.e. 1 - sa) */ + kDA_Coeff, /** dst alpha */ + kIDA_Coeff, /** inverse dst alpha (i.e. 1 - da) */ + + kCoeffCount + }; + + /** List of predefined xfermodes. + The algebra for the modes uses the following symbols: + Sa, Sc - source alpha and color + Da, Dc - destination alpha and color (before compositing) + [a, c] - Resulting (alpha, color) values + For these equations, the colors are in premultiplied state. + If no xfermode is specified, kSrcOver is assumed. + The modes are ordered by those that can be expressed as a pair of Coeffs, followed by those + that aren't Coeffs but have separable r,g,b computations, and finally + those that are not separable. + */ + enum Mode { + kClear_Mode, //!< [0, 0] + kSrc_Mode, //!< [Sa, Sc] + kDst_Mode, //!< [Da, Dc] + kSrcOver_Mode, //!< [Sa + Da * (1 - Sa), Sc + Dc * (1 - Sa)] + kDstOver_Mode, //!< [Da + Sa * (1 - Da), Dc + Sc * (1 - Da)] + kSrcIn_Mode, //!< [Sa * Da, Sc * Da] + kDstIn_Mode, //!< [Da * Sa, Dc * Sa] + kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)] + kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)] + kSrcATop_Mode, //!< [Da, Sc * Da + Dc * (1 - Sa)] + kDstATop_Mode, //!< [Sa, Dc * Sa + Sc * (1 - Da)] + kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa)] + kPlus_Mode, //!< [Sa + Da, Sc + Dc] + kModulate_Mode, // multiplies all components (= alpha and color) + + // Following blend modes are defined in the CSS Compositing standard: + // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending + kScreen_Mode, + kLastCoeffMode = kScreen_Mode, + + kOverlay_Mode, + kDarken_Mode, + kLighten_Mode, + kColorDodge_Mode, + kColorBurn_Mode, + kHardLight_Mode, + kSoftLight_Mode, + kDifference_Mode, + kExclusion_Mode, + kMultiply_Mode, + kLastSeparableMode = kMultiply_Mode, + + kHue_Mode, + kSaturation_Mode, + kColor_Mode, + kLuminosity_Mode, + kLastMode = kLuminosity_Mode + }; + + /** + * Gets the name of the Mode as a string. + */ + static const char* ModeName(Mode); + static const char* ModeName(SkBlendMode mode) { + return ModeName(Mode(mode)); + } + + /** + * If the xfermode is one of the modes in the Mode enum, then asMode() + * returns true and sets (if not null) mode accordingly. Otherwise it + * returns false and ignores the mode parameter. + */ + virtual bool asMode(Mode* mode) const; + + /** + * The same as calling xfermode->asMode(mode), except that this also checks + * if the xfermode is NULL, and if so, treats it as kSrcOver_Mode. + */ + static bool AsMode(const SkXfermode*, Mode* mode); + static bool AsMode(const sk_sp<SkXfermode>& xfer, Mode* mode) { + return AsMode(xfer.get(), mode); + } + + /** + * Returns true if the xfermode claims to be the specified Mode. This works + * correctly even if the xfermode is NULL (which equates to kSrcOver.) Thus + * you can say this without checking for a null... + * + * If (SkXfermode::IsMode(paint.getXfermode(), + * SkXfermode::kDstOver_Mode)) { + * ... + * } + */ + static bool IsMode(const SkXfermode* xfer, Mode mode); + static bool IsMode(const sk_sp<SkXfermode>& xfer, Mode mode) { + return IsMode(xfer.get(), mode); + } + + /** Return an SkXfermode object for the specified mode. + */ + static sk_sp<SkXfermode> Make(SkBlendMode); + static sk_sp<SkXfermode> Make(Mode m) { return Make((SkBlendMode)m); } + + /** + * Skia maintains global xfermode objects corresponding to each BlendMode. This returns a + * ptr to that global xfermode (or null if the mode is srcover). Thus the caller may use + * the returned ptr, but it should leave its refcnt untouched. + */ + static SkXfermode* Peek(SkBlendMode mode) { + sk_sp<SkXfermode> xfer = Make(mode); + if (!xfer) { + SkASSERT(SkBlendMode::kSrcOver == mode); + return nullptr; + } + SkASSERT(!xfer->unique()); + return xfer.get(); + } + + SkBlendMode blend() const { + Mode mode; + SkAssertResult(this->asMode(&mode)); + return (SkBlendMode)mode; + } + + static SkXfermodeProc GetProc(SkBlendMode); + static SkXfermodeProc4f GetProc4f(SkBlendMode); + + /** + * If the specified mode can be represented by a pair of Coeff, then return + * true and set (if not NULL) the corresponding coeffs. If the mode is + * not representable as a pair of Coeffs, return false and ignore the + * src and dst parameters. + */ + static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); + static bool ModeAsCoeff(SkBlendMode mode, Coeff* src, Coeff* dst) { + return ModeAsCoeff((Mode)mode, src, dst); + } + + /** + * Returns whether or not the xfer mode can support treating coverage as alpha + */ + virtual bool supportsCoverageAsAlpha() const; + + /** + * The same as calling xfermode->supportsCoverageAsAlpha(), except that this also checks if + * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. + */ + static bool SupportsCoverageAsAlpha(const SkXfermode* xfer); + static bool SupportsCoverageAsAlpha(const sk_sp<SkXfermode>& xfer) { + return SupportsCoverageAsAlpha(xfer.get()); + } + + enum SrcColorOpacity { + // The src color is known to be opaque (alpha == 255) + kOpaque_SrcColorOpacity = 0, + // The src color is known to be fully transparent (color == 0) + kTransparentBlack_SrcColorOpacity = 1, + // The src alpha is known to be fully transparent (alpha == 0) + kTransparentAlpha_SrcColorOpacity = 2, + // The src color opacity is unknown + kUnknown_SrcColorOpacity = 3 + }; + + /** + * Returns whether or not the result of the draw with the xfer mode will be opaque or not. The + * input to this call is an enum describing known information about the opacity of the src color + * that will be given to the xfer mode. + */ + virtual bool isOpaque(SrcColorOpacity opacityType) const; + + /** + * The same as calling xfermode->isOpaque(...), except that this also checks if + * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. + */ + static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); + static bool IsOpaque(const sk_sp<SkXfermode>& xfer, SrcColorOpacity opacityType) { + return IsOpaque(xfer.get(), opacityType); + } + static bool IsOpaque(SkBlendMode, SrcColorOpacity); + +#if SK_SUPPORT_GPU + /** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentProcessor. + The input to the returned FP is the src color. The dst color is + provided by the dst param which becomes a child FP of the returned FP. + It is legal for the function to return a null output. This indicates that + the output of the blend is simply the src color. + */ + virtual sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter( + sk_sp<GrFragmentProcessor> dst) const; + + /** A subclass must implement this factory function to work with the GPU backend. + The xfermode will return a factory for which the caller will get a ref. It is up + to the caller to install it. XferProcessors cannot use a background texture. + */ + virtual sk_sp<GrXPFactory> asXPFactory() const; +#endif + + SK_TO_STRING_PUREVIRT() + SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() + SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) + + enum D32Flags { + kSrcIsOpaque_D32Flag = 1 << 0, + kSrcIsSingle_D32Flag = 1 << 1, + kDstIsSRGB_D32Flag = 1 << 2, + }; + typedef void (*D32Proc)(SkBlendMode, uint32_t dst[], const SkPM4f src[], + int count, const SkAlpha coverage[]); + static D32Proc GetD32Proc(SkBlendMode, uint32_t flags); + + enum F16Flags { + kSrcIsOpaque_F16Flag = 1 << 0, + kSrcIsSingle_F16Flag = 1 << 1, + }; + typedef void (*F16Proc)(SkBlendMode, uint64_t dst[], const SkPM4f src[], int count, + const SkAlpha coverage[]); + static F16Proc GetF16Proc(SkBlendMode, uint32_t flags); + + enum LCDFlags { + kSrcIsOpaque_LCDFlag = 1 << 0, // else src(s) may have alpha < 1 + kSrcIsSingle_LCDFlag = 1 << 1, // else src[count] + kDstIsSRGB_LCDFlag = 1 << 2, // else l32 or f16 + }; + typedef void (*LCD32Proc)(uint32_t* dst, const SkPM4f* src, int count, const uint16_t lcd[]); + typedef void (*LCDF16Proc)(uint64_t* dst, const SkPM4f* src, int count, const uint16_t lcd[]); + static LCD32Proc GetLCD32Proc(uint32_t flags); + static LCDF16Proc GetLCDF16Proc(uint32_t) { return nullptr; } + + virtual bool isArithmetic(SkArithmeticParams*) const { return false; } + +protected: + SkXfermode() {} + /** The default implementation of xfer32/xfer16/xferA8 in turn call this + method, 1 color at a time (upscaled to a SkPMColor). The default + implementation of this method just returns dst. If performance is + important, your subclass should override xfer32/xfer16/xferA8 directly. + + This method will not be called directly by the client, so it need not + be implemented if your subclass has overridden xfer32/xfer16/xferA8 + */ + virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; + +private: + enum { + kModeCount = kLastMode + 1 + }; + + typedef SkFlattenable INHERITED; +}; + +#endif #endif diff --git a/include/effects/SkArithmeticMode.h b/include/effects/SkArithmeticMode.h index e48d4ca2d5..89cca92c55 100644 --- a/include/effects/SkArithmeticMode.h +++ b/include/effects/SkArithmeticMode.h @@ -8,6 +8,10 @@ #ifndef SkArithmeticMode_DEFINED #define SkArithmeticMode_DEFINED -//#error "SkArithmeticMode.h is deprecated" +#include "SkFlattenable.h" +#include "SkScalar.h" +#include "SkXfermode.h" + +// TODO : remove this header from public #endif diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp index 2721a5bd18..9cee95b84c 100644 --- a/samplecode/ClockFaceView.cpp +++ b/samplecode/ClockFaceView.cpp @@ -164,7 +164,10 @@ static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar int typedef void (*raster_proc)(SkLayerRasterizer*, SkPaint&); -static void apply_shader(SkPaint* paint, float scale) { +#include "SkXfermode.h" + +static void apply_shader(SkPaint* paint, float scale) +{ SkPaint p; SkLayerRasterizer::Builder rastBuilder; diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp index fc3a95ab88..94c12cd727 100644 --- a/samplecode/SampleAll.cpp +++ b/samplecode/SampleAll.cpp @@ -32,6 +32,7 @@ #include "SkRandom.h" #include "SkTypeface.h" #include "SkUtils.h" +#include "SkXfermode.h" #include <math.h> #include "DecodeFile.h" diff --git a/samplecode/SampleAnimatedText.cpp b/samplecode/SampleAnimatedText.cpp index dec8f8f49d..6bd6d82e8c 100644 --- a/samplecode/SampleAnimatedText.cpp +++ b/samplecode/SampleAnimatedText.cpp @@ -15,6 +15,7 @@ #include "SkSystemEventTypes.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" #include "Timer.h" #if SK_SUPPORT_GPU diff --git a/samplecode/SampleBitmapRect.cpp b/samplecode/SampleBitmapRect.cpp index ebfe3bbc6d..24c3efff79 100644 --- a/samplecode/SampleBitmapRect.cpp +++ b/samplecode/SampleBitmapRect.cpp @@ -15,6 +15,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleConcavePaths.cpp b/samplecode/SampleConcavePaths.cpp index 7ff6819ac4..d75ec4c4be 100644 --- a/samplecode/SampleConcavePaths.cpp +++ b/samplecode/SampleConcavePaths.cpp @@ -14,6 +14,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkParsePath.h" diff --git a/samplecode/SampleEmboss.cpp b/samplecode/SampleEmboss.cpp index 4aba6fd157..f1ea1fe547 100644 --- a/samplecode/SampleEmboss.cpp +++ b/samplecode/SampleEmboss.cpp @@ -21,6 +21,7 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" class EmbossView : public SampleView { SkEmbossMaskFilter::Light fLight; diff --git a/samplecode/SampleFilter2.cpp b/samplecode/SampleFilter2.cpp index 9b2298a0b4..8c93563c40 100644 --- a/samplecode/SampleFilter2.cpp +++ b/samplecode/SampleFilter2.cpp @@ -15,6 +15,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp index a0cb0e02ba..c7d05782e3 100644 --- a/samplecode/SampleFuzz.cpp +++ b/samplecode/SampleFuzz.cpp @@ -10,6 +10,7 @@ #include "SkBlurMaskFilter.h" #include "SkPaint.h" #include "SkPath.h" +#include "SkXfermode.h" #include "SkMatrix.h" #include "SkColor.h" #include "SkRandom.h" diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp index 169804ddfa..fef44f53ce 100644 --- a/samplecode/SampleHairline.cpp +++ b/samplecode/SampleHairline.cpp @@ -21,6 +21,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkStream.h" #include "SkColorPriv.h" diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp index c086eb0480..71b2e8ba66 100644 --- a/samplecode/SampleLayers.cpp +++ b/samplecode/SampleLayers.cpp @@ -23,6 +23,7 @@ #include "SkTypeface.h" #include "SkUtils.h" #include "SkKey.h" +#include "SkXfermode.h" #include "SkDrawFilter.h" static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) { diff --git a/samplecode/SampleLines.cpp b/samplecode/SampleLines.cpp index bf43e8b9c4..08a9e86c4b 100644 --- a/samplecode/SampleLines.cpp +++ b/samplecode/SampleLines.cpp @@ -21,6 +21,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkStream.h" #include "SkColorPriv.h" diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp index b105090db2..243d106784 100644 --- a/samplecode/SamplePatch.cpp +++ b/samplecode/SamplePatch.cpp @@ -17,6 +17,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp index 40c350fbd2..f0bdf8d684 100644 --- a/samplecode/SamplePath.cpp +++ b/samplecode/SamplePath.cpp @@ -15,6 +15,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkParsePath.h" diff --git a/samplecode/SamplePathClip.cpp b/samplecode/SamplePathClip.cpp index b425884ebe..af9608f0eb 100644 --- a/samplecode/SamplePathClip.cpp +++ b/samplecode/SamplePathClip.cpp @@ -13,6 +13,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SamplePdfFileViewer.cpp b/samplecode/SamplePdfFileViewer.cpp index ab5a73e824..110aa5876c 100644 --- a/samplecode/SamplePdfFileViewer.cpp +++ b/samplecode/SamplePdfFileViewer.cpp @@ -26,6 +26,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkPdfRenderer.h" class PdfFileViewer : public SampleView { diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp index 32cc723d9d..83912a5e2f 100644 --- a/samplecode/SamplePictFile.cpp +++ b/samplecode/SamplePictFile.cpp @@ -25,6 +25,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkStream.h" #include "SkSurface.h" diff --git a/samplecode/SamplePoints.cpp b/samplecode/SamplePoints.cpp index 13b98972d3..0bfe28f850 100644 --- a/samplecode/SamplePoints.cpp +++ b/samplecode/SamplePoints.cpp @@ -19,6 +19,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkStream.h" class PointsView : public SampleView { diff --git a/samplecode/SampleShaders.cpp b/samplecode/SampleShaders.cpp index f9926ebf3f..ba3b80d7f8 100644 --- a/samplecode/SampleShaders.cpp +++ b/samplecode/SampleShaders.cpp @@ -15,6 +15,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index 8325cd7755..730c47ce98 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -21,6 +21,8 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" + #include "SkStream.h" static const struct { diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp index 8286177ae7..48625ad79a 100644 --- a/samplecode/SampleTextAlpha.cpp +++ b/samplecode/SampleTextAlpha.cpp @@ -15,6 +15,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleTextBox.cpp b/samplecode/SampleTextBox.cpp index 947ed8ec1e..8540ca456f 100644 --- a/samplecode/SampleTextBox.cpp +++ b/samplecode/SampleTextBox.cpp @@ -16,6 +16,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp index d08726c027..3ba98bb919 100644 --- a/samplecode/SampleVertices.cpp +++ b/samplecode/SampleVertices.cpp @@ -14,6 +14,7 @@ #include "SkRegion.h" #include "SkShader.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkColorPriv.h" #include "SkColorFilter.h" #include "SkTime.h" diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp index 2169ffde53..fe07c9b567 100644 --- a/samplecode/SampleXfermodesBlur.cpp +++ b/samplecode/SampleXfermodesBlur.cpp @@ -21,6 +21,7 @@ #include "SkColorFilter.h" #include "SkTime.h" #include "SkTypeface.h" +#include "SkXfermode.h" #include "SkStream.h" #include "SkColorPriv.h" diff --git a/src/animator/SkDrawPaint.h b/src/animator/SkDrawPaint.h index b252a4d11a..bef52527b1 100644 --- a/src/animator/SkDrawPaint.h +++ b/src/animator/SkDrawPaint.h @@ -14,6 +14,7 @@ #include "SkIntArray.h" #include "SkMemberInfo.h" #include "SkPaint.h" +#include "SkXfermode.h" class SkDrawMaskFilter; class SkDrawPathEffect; diff --git a/src/animator/SkPaintPart.h b/src/animator/SkPaintPart.h index 14d24f5f55..5d94f049e8 100644 --- a/src/animator/SkPaintPart.h +++ b/src/animator/SkPaintPart.h @@ -13,6 +13,7 @@ #include "SkPaint.h" #include "SkShader.h" #include "SkTypeface.h" +#include "SkXfermode.h" class SkDrawPaint; class SkDrawMatrix; diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index f5e2c3210a..1e618accb0 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -20,6 +20,7 @@ #include "SkShader.h" #include "SkSpecialImage.h" #include "SkSurface.h" +#include "SkXfermode.h" class SkColorTable; diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index a05c176bcd..731d0d3cb7 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -16,6 +16,7 @@ #include "SkString.h" #include "SkTLazy.h" #include "SkUtils.h" +#include "SkXfermode.h" #include "SkXfermodeInterpretation.h" // define this for testing srgb blits diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp index 5cbd23eb08..f04527b273 100644 --- a/src/core/SkComposeShader.cpp +++ b/src/core/SkComposeShader.cpp @@ -11,6 +11,7 @@ #include "SkColorShader.h" #include "SkReadBuffer.h" #include "SkWriteBuffer.h" +#include "SkXfermode.h" #include "SkString.h" sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index a2d7a51dff..856207da78 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -33,6 +33,7 @@ #include "SkTLazy.h" #include "SkUtils.h" #include "SkVertState.h" +#include "SkXfermode.h" #include "SkBitmapProcShader.h" #include "SkDrawProcs.h" diff --git a/src/core/SkGlobalInitialization_core.cpp b/src/core/SkGlobalInitialization_core.cpp index 6f8f8d67b2..21c4d16c4a 100644 --- a/src/core/SkGlobalInitialization_core.cpp +++ b/src/core/SkGlobalInitialization_core.cpp @@ -19,6 +19,7 @@ #include "SkPathEffect.h" #include "SkPictureShader.h" #include "SkRecordedDrawable.h" +#include "SkXfermode.h" /* * Registers all of the required effects subclasses for picture deserialization. diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 803b7435bb..01b1432ef0 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -28,6 +28,7 @@ #include "SkTSearch.h" #include "SkTime.h" #include "SkUtils.h" +#include "SkXfermode.h" #include <stdlib.h> diff --git a/src/core/SkModeColorFilter.h b/src/core/SkModeColorFilter.h index 8e0374495f..2586c29d9f 100644 --- a/src/core/SkModeColorFilter.h +++ b/src/core/SkModeColorFilter.h @@ -7,6 +7,7 @@ #include "SkColorFilter.h" #include "SkPM4f.h" +#include "SkXfermode.h" #ifndef SkModeColorFilter_DEFINED #define SkModeColorFilter_DEFINED diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index a5df8dd145..82f1c827a7 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -35,6 +35,7 @@ #include "SkTextToPathIter.h" #include "SkTLazy.h" #include "SkTypeface.h" +#include "SkXfermode.h" static inline uint32_t set_clear_mask(uint32_t bits, bool cond, uint32_t mask) { return cond ? bits | mask : bits & ~mask; diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp index 6078cb6293..013bc7f98e 100644 --- a/src/core/SkPictureFlat.cpp +++ b/src/core/SkPictureFlat.cpp @@ -13,6 +13,7 @@ #include "SkRasterizer.h" #include "SkShader.h" #include "SkTypeface.h" +#include "SkXfermode.h" /////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 0a1a24f8bf..7f933a75d2 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -241,6 +241,7 @@ bool SkPixmap::erase(const SkColor4f& origColor, const SkIRect* subset) const { #include "SkBitmap.h" #include "SkCanvas.h" #include "SkSurface.h" +#include "SkXfermode.h" bool SkPixmap::scalePixels(const SkPixmap& dst, SkFilterQuality quality) const { // Can't do anthing with empty src or dst diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index ca6313eccd..90910eaa92 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -15,6 +15,7 @@ #include "SkPM4fPriv.h" #include "SkRasterPipeline.h" #include "SkShader.h" +#include "SkXfermode.h" class SkRasterPipelineBlitter : public SkBlitter { diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp index 605caa3b06..a7feec1fb3 100644 --- a/src/core/SkRecordOpts.cpp +++ b/src/core/SkRecordOpts.cpp @@ -10,6 +10,7 @@ #include "SkRecordPattern.h" #include "SkRecords.h" #include "SkTDArray.h" +#include "SkXfermode.h" using namespace SkRecords; diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index eb27f69d26..3f3927e742 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkXfermode.h" #include "SkXfermode_proccoeff.h" #include "SkColorPriv.h" #include "SkMathPriv.h" diff --git a/src/core/SkXfermodePriv.h b/src/core/SkXfermodePriv.h index 208925ed18..b7d85ea98f 100644 --- a/src/core/SkXfermodePriv.h +++ b/src/core/SkXfermodePriv.h @@ -12,6 +12,10 @@ #include "SkColor.h" #include "SkFlattenable.h" +#ifdef SK_SUPPORT_LEGACY_XFERMODE_IS_PUBLIC +#include "SkXfermode.h" +#else + class GrFragmentProcessor; class GrTexture; class GrXPFactory; @@ -303,3 +307,5 @@ private: }; #endif + +#endif diff --git a/src/core/SkXfermode_proccoeff.h b/src/core/SkXfermode_proccoeff.h index 8a7b62f0a2..8d70957b94 100644 --- a/src/core/SkXfermode_proccoeff.h +++ b/src/core/SkXfermode_proccoeff.h @@ -8,6 +8,7 @@ #ifndef SkXfermode_proccoeff_DEFINED #define SkXfermode_proccoeff_DEFINED +#include "SkXfermode.h" #include "SkReadBuffer.h" #include "SkWriteBuffer.h" diff --git a/src/effects/SkArithmeticModePriv.h b/src/effects/SkArithmeticModePriv.h index ff7f357189..5cb1093434 100644 --- a/src/effects/SkArithmeticModePriv.h +++ b/src/effects/SkArithmeticModePriv.h @@ -8,8 +8,7 @@ #ifndef SkArithmeticModePriv_DEFINED #define SkArithmeticModePriv_DEFINED -#include "SkScalar.h" -#include "SkXfermodePriv.h" +#include "SkArithmeticMode.h" class SkXfermode; diff --git a/src/effects/SkLayerRasterizer.cpp b/src/effects/SkLayerRasterizer.cpp index b3e84593bd..71d7fb63c5 100644 --- a/src/effects/SkLayerRasterizer.cpp +++ b/src/effects/SkLayerRasterizer.cpp @@ -17,6 +17,7 @@ #include "SkPathEffect.h" #include "../core/SkRasterClip.h" #include "../core/SkStrokeRec.h" +#include "SkXfermode.h" #include <new> struct SkLayerRasterizer_Rec { diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 0987266bbc..a396b3e690 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -14,6 +14,7 @@ #include "SkSpecialImage.h" #include "SkSpecialSurface.h" #include "SkWriteBuffer.h" +#include "SkXfermode.h" #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrRenderTargetContext.h" diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp index 229bf8212f..45083f725c 100644 --- a/src/effects/gradients/Sk4fLinearGradient.cpp +++ b/src/effects/gradients/Sk4fLinearGradient.cpp @@ -7,6 +7,7 @@ #include "Sk4fLinearGradient.h" #include "Sk4x4f.h" +#include "SkXfermode.h" #include <cmath> diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h index d96f83d21a..9f9a52a02d 100644 --- a/src/gpu/GrRenderTargetOpList.h +++ b/src/gpu/GrRenderTargetOpList.h @@ -26,6 +26,7 @@ #include "SkTArray.h" #include "SkTLazy.h" #include "SkTypes.h" +#include "SkXfermode.h" class GrAuditTrail; class GrBatch; diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 04147f6870..cc2cd2fd50 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -39,6 +39,7 @@ #include "SkTLazy.h" #include "SkUtils.h" #include "SkVertState.h" +#include "SkXfermode.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrBicubicEffect.h" #include "effects/GrDashingEffect.h" diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 7303fd49e5..8d5c5008d2 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -14,6 +14,7 @@ #include "GrPipeline.h" #include "GrProcessor.h" #include "GrTexture.h" +#include "SkXfermode.h" #include "glsl/GrGLSLBlend.h" #include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 820b55c7fe..1f2e1c8446 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -19,6 +19,7 @@ #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLXferProcessor.h" +#include "SkXfermode.h" #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index d129ddaa3d..3b0940e0d2 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -17,6 +17,7 @@ #include "glsl/GrGLSLUniformHandler.h" #include "SkString.h" +#include "SkXfermode.h" #include "builders/GrGLProgramBuilder.h" diff --git a/src/gpu/glsl/GrGLSLBlend.h b/src/gpu/glsl/GrGLSLBlend.h index fb0fb0b935..63d6762444 100644 --- a/src/gpu/glsl/GrGLSLBlend.h +++ b/src/gpu/glsl/GrGLSLBlend.h @@ -8,8 +8,8 @@ #ifndef GrGLBlend_DEFINED #define GrGLBlend_DEFINED -#include "SkBlendMode.h" #include "SkRegion.h" +#include "SkXfermode.h" class GrGLSLFragmentBuilder; diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 9542c9e0ae..efaca333af 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -19,6 +19,7 @@ // needed just to know that these are all subclassed from SkFlattenable #include "SkShader.h" #include "SkPathEffect.h" +#include "SkXfermode.h" #include "SkColorFilter.h" #include "SkPathEffect.h" #include "SkMaskFilter.h" diff --git a/src/utils/SkPatchGrid.h b/src/utils/SkPatchGrid.h index 97a6cb3f01..dbb6138220 100644 --- a/src/utils/SkPatchGrid.h +++ b/src/utils/SkPatchGrid.h @@ -10,6 +10,7 @@ #include "SkCanvas.h" #include "SkPatchUtils.h" +#include "SkXfermode.h" /** * Class that represents a grid of patches. Adjacent patches share their corners and a color is diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp index 785acb8681..cd5e8efba7 100644 --- a/tests/BlendTest.cpp +++ b/tests/BlendTest.cpp @@ -9,6 +9,7 @@ #include "SkColor.h" #include "SkColorPriv.h" #include "SkTaskGroup.h" +#include "SkXfermode.h" #include <functional> struct Results { int diffs, diffs_0x00, diffs_0xff, diffs_by_1; }; diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp index ad2dd0fc35..ec34a151be 100644 --- a/tests/ColorFilterTest.cpp +++ b/tests/ColorFilterTest.cpp @@ -12,6 +12,7 @@ #include "SkReadBuffer.h" #include "SkWriteBuffer.h" #include "SkRandom.h" +#include "SkXfermode.h" #include "Test.h" static sk_sp<SkColorFilter> reincarnate_colorfilter(SkFlattenable* obj) { diff --git a/tests/GrGetCoeffBlendKnownComponentsTest.cpp b/tests/GrGetCoeffBlendKnownComponentsTest.cpp index 31a41943d9..38dfb30c56 100644 --- a/tests/GrGetCoeffBlendKnownComponentsTest.cpp +++ b/tests/GrGetCoeffBlendKnownComponentsTest.cpp @@ -13,6 +13,7 @@ #include "SkGr.h" #include "SkGrPriv.h" #include "SkRandom.h" +#include "SkXfermode.h" static GrColor make_baseline_color(GrColor src, GrColor dst, const SkXfermode* xm) { SkPMColor skSrc = GrColorToSkPMColor(src); diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 53aeb9a1ca..eb3c9bc186 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkXfermode.h" #include "Test.h" #if SK_SUPPORT_GPU diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp index 8fcbf1615c..7b3aa29883 100644 --- a/tests/LayerDrawLooperTest.cpp +++ b/tests/LayerDrawLooperTest.cpp @@ -16,6 +16,7 @@ #include "SkRefCnt.h" #include "SkScalar.h" #include "SkSmallAllocator.h" +#include "SkXfermode.h" #include "Test.h" static SkBitmap make_bm(int w, int h) { diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index 76bfb02923..9cd9cfc63c 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -15,6 +15,7 @@ #include "SkTypeface.h" #include "SkUtils.h" #include "SkWriteBuffer.h" +#include "SkXfermode.h" #include "Test.h" static size_t uni_to_utf8(const SkUnichar src[], void* dst, int count) { diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp index f5f18f3b1c..b7c9ae96c6 100644 --- a/tests/RecordOptsTest.cpp +++ b/tests/RecordOptsTest.cpp @@ -13,6 +13,7 @@ #include "SkRecordOpts.h" #include "SkRecorder.h" #include "SkRecords.h" +#include "SkXfermode.h" #include "SkPictureRecorder.h" #include "SkPictureImageFilter.h" #include "SkSurface.h" diff --git a/tests/SrcOverTest.cpp b/tests/SrcOverTest.cpp index df315983ea..7789fbdd50 100644 --- a/tests/SrcOverTest.cpp +++ b/tests/SrcOverTest.cpp @@ -6,6 +6,7 @@ */ #include "SkColorPriv.h" +#include "SkXfermode.h" #include "Test.h" // our std SkAlpha255To256 |