From ebfce6d9b42198e04288a15953f40c395a7b6139 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 12 Dec 2016 10:02:12 -0500 Subject: change SkClipOp to a class enum BUG=skia: Change-Id: I25dbe6d6b8666a2a0a7be7bdd2ae0b067868d14e Reviewed-on: https://skia-review.googlesource.com/5718 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- bench/AAClipBench.cpp | 1 + fuzz/FuzzDrawFunctions.cpp | 1 + gm/blurredclippedcircle.cpp | 1 + gm/complexclip.cpp | 3 +-- gm/complexclip_blur_tiled.cpp | 1 + gm/gm.h | 1 + gn/android_framework_defines.gni | 1 + include/core/SkCanvas.h | 14 ++++++++++---- include/core/SkClipOp.h | 21 ++++++++++++++++++++- include/core/SkClipStack.h | 11 +++++++++-- include/private/SkRecords.h | 11 ++++++++--- public.bzl | 1 + samplecode/SampleApp.cpp | 1 + samplecode/SampleClip.cpp | 1 + samplecode/SampleComplexClip.cpp | 2 ++ samplecode/SampleFatBits.cpp | 1 + samplecode/SampleIdentityScale.cpp | 1 + samplecode/SampleLayers.cpp | 1 + src/core/SkCanvas.cpp | 1 + src/core/SkClipOpPriv.h | 22 ++++++++++++++++++++++ src/core/SkClipStack.cpp | 15 ++++++++------- src/core/SkPictureCommon.h | 2 +- src/core/SkPictureFlat.h | 2 +- src/core/SkPictureRecord.cpp | 1 + src/core/SkRecordDraw.cpp | 6 +++--- src/effects/SkXfermodeImageFilter.cpp | 1 + src/gpu/GrClipStackClip.cpp | 7 ++++--- src/gpu/GrReducedClip.cpp | 9 +++++---- src/pdf/SkPDFDevice.cpp | 5 +++-- src/svg/SkSVGDevice.cpp | 1 + src/utils/SkCanvasStateUtils.cpp | 1 + src/utils/SkDeferredCanvas.cpp | 1 + src/utils/SkDumpCanvas.cpp | 2 +- tests/CanvasStateTest.cpp | 1 + tests/GrShapeTest.cpp | 1 + tests/Test.h | 1 + tools/debugger/SkDebugCanvas.cpp | 3 ++- tools/debugger/SkDrawCommand.cpp | 1 + tools/debugger/SkObjectParser.cpp | 1 + 39 files changed, 123 insertions(+), 35 deletions(-) create mode 100644 src/core/SkClipOpPriv.h diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp index f3159b6168..82e4e380b2 100644 --- a/bench/AAClipBench.cpp +++ b/bench/AAClipBench.cpp @@ -12,6 +12,7 @@ #include "SkRandom.h" #include "SkRegion.h" #include "SkString.h" +#include "SkClipOpPriv.h" //////////////////////////////////////////////////////////////////////////////// // This bench tests out AA/BW clipping via canvas' clipPath and clipRect calls diff --git a/fuzz/FuzzDrawFunctions.cpp b/fuzz/FuzzDrawFunctions.cpp index cee866c0c3..af4d09bd28 100644 --- a/fuzz/FuzzDrawFunctions.cpp +++ b/fuzz/FuzzDrawFunctions.cpp @@ -13,6 +13,7 @@ #include "SkPath.h" #include "SkSurface.h" #include "SkTypeface.h" +#include "SkClipOpPriv.h" static const int kBmpSize = 24; static const int kMaxX = 250; diff --git a/gm/blurredclippedcircle.cpp b/gm/blurredclippedcircle.cpp index e9640ec25e..9bc0acee4c 100644 --- a/gm/blurredclippedcircle.cpp +++ b/gm/blurredclippedcircle.cpp @@ -7,6 +7,7 @@ #include "gm.h" #include "SkBlurMaskFilter.h" +#include "SkClipOpPriv.h" #include "SkColorFilter.h" #include "SkPaint.h" #include "SkRRect.h" diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp index 2ae6a087c6..1fecd9487a 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -4,11 +4,10 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "gm.h" #include "SkCanvas.h" -//#include "SkParsePath.h" #include "SkPath.h" -//#include "SkRandom.h" namespace skiagm { diff --git a/gm/complexclip_blur_tiled.cpp b/gm/complexclip_blur_tiled.cpp index 3a0f0e0cb8..611212d450 100644 --- a/gm/complexclip_blur_tiled.cpp +++ b/gm/complexclip_blur_tiled.cpp @@ -9,6 +9,7 @@ #include "SkBlurImageFilter.h" #include "SkRRect.h" #include "SkSurface.h" +#include "SkClipOpPriv.h" #define WIDTH 512 #define HEIGHT 512 diff --git a/gm/gm.h b/gm/gm.h index ff033a88aa..0b26c16fb3 100644 --- a/gm/gm.h +++ b/gm/gm.h @@ -15,6 +15,7 @@ #include "SkString.h" #include "SkTRegistry.h" #include "sk_tool_utils.h" +#include "SkClipOpPriv.h" class SkAnimTimer; struct GrContextOptions; diff --git a/gn/android_framework_defines.gni b/gn/android_framework_defines.gni index 7ffd36d525..ea6358d557 100644 --- a/gn/android_framework_defines.gni +++ b/gn/android_framework_defines.gni @@ -15,4 +15,5 @@ android_framework_defines = [ "SK_SUPPORT_LEGACY_IMAGE_ENCODER_CLASS", "SK_SUPPORT_LEGACY_SHADER_ISABITMAP", "SK_SUPPORT_LEGACY_EMBOSSMASKFILTER", + "SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM", ] diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 3507786ab9..620c5820b9 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -42,6 +42,12 @@ class SkSurface; class SkSurface_Base; class SkTextBlob; +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + #define SkCanvasImpl_DefaultClipOp kIntersect_SkClipOp +#else + #define SkCanvasImpl_DefaultClipOp SkClipOp::kIntersect +#endif + /** \class SkCanvas A Canvas encapsulates all of the state about drawing into a device (bitmap). @@ -477,7 +483,7 @@ public: this->clipRect(rect, op, false); } void clipRect(const SkRect& rect, bool doAntiAlias = false) { - this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias); + this->clipRect(rect, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** @@ -491,7 +497,7 @@ public: this->clipRRect(rrect, op, false); } void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) { - this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias); + this->clipRRect(rrect, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** @@ -505,7 +511,7 @@ public: this->clipPath(path, op, false); } void clipPath(const SkPath& path, bool doAntiAlias = false) { - this->clipPath(path, kIntersect_SkClipOp, doAntiAlias); + this->clipPath(path, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** EXPERIMENTAL -- only used for testing @@ -522,7 +528,7 @@ public: @param deviceRgn The region to apply to the current clip @param op The region op to apply to the current clip */ - void clipRegion(const SkRegion& deviceRgn, SkClipOp op = kIntersect_SkClipOp); + void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkCanvasImpl_DefaultClipOp); /** Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call diff --git a/include/core/SkClipOp.h b/include/core/SkClipOp.h index 2e4fbbf868..4a69ef29d5 100644 --- a/include/core/SkClipOp.h +++ b/include/core/SkClipOp.h @@ -10,7 +10,10 @@ #include "SkTypes.h" -// these kept in SkRegion::Op order for now ... +// SkClipOp enum values always match the corresponding values in SkRegion::Op + +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + enum SkClipOp { kDifference_SkClipOp = 0, kIntersect_SkClipOp = 1, @@ -23,4 +26,20 @@ enum SkClipOp { kReplace_SkClipOp = 5, }; +#else + +enum class SkClipOp { + kDifference = 0, + kIntersect = 1, + + // Goal: remove these, since they can grow the current clip + + kUnion = 2, + kXOR = 3, + kReverseDifference = 4, + kReplace = 5, +}; + +#endif + #endif diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 98a3f7698b..64f462601f 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -18,6 +18,13 @@ class SkCanvasClipVisitor; + +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + #define SkClipStackImpl_ReplaceOp kReplace_SkClipOp +#else + #define SkClipStackImpl_ReplaceOp SkClipOp::kReplace +#endif + // Because a single save/restore state can have multiple clips, this class // stores the stack depth (fSaveCount) and clips (fDeque) separately. // Each clip in fDeque stores the stack state to which it belongs @@ -54,7 +61,7 @@ public: static const int kTypeCnt = kLastType + 1; Element() { - this->initCommon(0, kReplace_SkClipOp, false); + this->initCommon(0, SkClipStackImpl_ReplaceOp, false); this->setEmpty(); } @@ -226,7 +233,7 @@ public: int fGenID; Element(int saveCount) { - this->initCommon(saveCount, kReplace_SkClipOp, false); + this->initCommon(saveCount, SkClipStackImpl_ReplaceOp, false); this->setEmpty(); } diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index 54efab1891..d1fadc3395 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -192,9 +192,14 @@ RECORD(TranslateZ, 0, SkScalar z); struct ClipOpAndAA { ClipOpAndAA() {} - ClipOpAndAA(SkClipOp op, bool aa) : op(op), aa(aa) {} - SkClipOp op : 31; // This really only needs to be 3, but there's no win today to do so. - unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned. + ClipOpAndAA(SkClipOp op, bool aa) : fOp(static_cast(op)), fAA(aa) {} + + SkClipOp op() const { return static_cast(fOp); } + bool aa() const { return fAA != 0; } + +private: + unsigned fOp : 31; // This really only needs to be 3, but there's no win today to do so. + unsigned fAA : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned. }; static_assert(sizeof(ClipOpAndAA) == 4, "ClipOpAndAASize"); diff --git a/public.bzl b/public.bzl index e17352b0cf..666a598fb0 100644 --- a/public.bzl +++ b/public.bzl @@ -593,6 +593,7 @@ DEFINES_ALL = [ "SK_SUPPORT_LEGACY_IMAGE_ENCODER_CLASS", # Temporarily Disable analytic AA for Google3 "SK_NO_ANALYTIC_AA", + "SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM", ] ################################################################################ diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 1acd975989..8797c4d5ca 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -36,6 +36,7 @@ #include "SkWindow.h" #include "sk_tool_utils.h" #include "SkScan.h" +#include "SkClipOpPriv.h" #include "SkReadBuffer.h" #include "SkStream.h" diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp index 82466ba137..75367cc122 100644 --- a/samplecode/SampleClip.cpp +++ b/samplecode/SampleClip.cpp @@ -13,6 +13,7 @@ #include "SkPaint.h" #include "SkPath.h" #include "SkRandom.h" +#include "SkClipOpPriv.h" constexpr int W = 150; constexpr int H = 200; diff --git a/samplecode/SampleComplexClip.cpp b/samplecode/SampleComplexClip.cpp index ae8a20f6a5..b9c930742e 100644 --- a/samplecode/SampleComplexClip.cpp +++ b/samplecode/SampleComplexClip.cpp @@ -4,10 +4,12 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "SampleCode.h" #include "SkCanvas.h" #include "SkPath.h" #include "SkView.h" +#include "SkClipOpPriv.h" class ComplexClipView : public SampleView { public: diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp index 65c929c71a..c49cdadcb3 100644 --- a/samplecode/SampleFatBits.cpp +++ b/samplecode/SampleFatBits.cpp @@ -15,6 +15,7 @@ #include "SkUtils.h" #include "SkImage.h" #include "SkSurface.h" +#include "SkClipOpPriv.h" #define FAT_PIXEL_COLOR SK_ColorBLACK #define PIXEL_CENTER_SIZE 3 diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp index ae6092ac89..95970e7f45 100644 --- a/samplecode/SampleIdentityScale.cpp +++ b/samplecode/SampleIdentityScale.cpp @@ -17,6 +17,7 @@ #include "SkRandom.h" #include "SkStream.h" #include "SkTime.h" +#include "SkClipOpPriv.h" // Intended to exercise pixel snapping observed with scaled images (and // with non-scaled images, but for a different reason): Bug 1145 diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp index faf4fde02a..ab75ddb81a 100644 --- a/samplecode/SampleLayers.cpp +++ b/samplecode/SampleLayers.cpp @@ -24,6 +24,7 @@ #include "SkUtils.h" #include "SkKey.h" #include "SkDrawFilter.h" +#include "SkClipOpPriv.h" static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) { SkColor colors[] = { 0, SK_ColorWHITE }; diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 430556db7e..f8069ee2d3 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -48,6 +48,7 @@ #include "SkGrPriv.h" #endif +#include "SkClipOpPriv.h" #define RETURN_ON_NULL(ptr) do { if (nullptr == (ptr)) return; } while (0) diff --git a/src/core/SkClipOpPriv.h b/src/core/SkClipOpPriv.h new file mode 100644 index 0000000000..5de8449399 --- /dev/null +++ b/src/core/SkClipOpPriv.h @@ -0,0 +1,22 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkClipOpPriv_DEFINED +#define SkClipOpPriv_DEFINED + +#include "SkClipOp.h" + +#ifndef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM +const SkClipOp kDifference_SkClipOp = SkClipOp::kDifference; +const SkClipOp kIntersect_SkClipOp = SkClipOp::kIntersect; +const SkClipOp kUnion_SkClipOp = SkClipOp::kUnion; +const SkClipOp kXOR_SkClipOp = SkClipOp::kXOR; +const SkClipOp kReverseDifference_SkClipOp = SkClipOp::kReverseDifference; +const SkClipOp kReplace_SkClipOp = SkClipOp::kReplace; +#endif + +#endif diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index 1a1e85f4c5..c7d5359760 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -10,6 +10,7 @@ #include "SkClipStack.h" #include "SkPath.h" #include "SkPathOps.h" +#include "SkClipOpPriv.h" #include @@ -951,16 +952,16 @@ void SkClipStack::Element::dump() const { "reverse-difference", "replace", }; - static_assert(0 == kDifference_SkClipOp, "op_str"); - static_assert(1 == kIntersect_SkClipOp, "op_str"); - static_assert(2 == kUnion_SkClipOp, "op_str"); - static_assert(3 == kXOR_SkClipOp, "op_str"); - static_assert(4 == kReverseDifference_SkClipOp, "op_str"); - static_assert(5 == kReplace_SkClipOp, "op_str"); + static_assert(0 == static_cast(kDifference_SkClipOp), "op_str"); + static_assert(1 == static_cast(kIntersect_SkClipOp), "op_str"); + static_assert(2 == static_cast(kUnion_SkClipOp), "op_str"); + static_assert(3 == static_cast(kXOR_SkClipOp), "op_str"); + static_assert(4 == static_cast(kReverseDifference_SkClipOp), "op_str"); + static_assert(5 == static_cast(kReplace_SkClipOp), "op_str"); static_assert(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, "op_str"); SkDebugf("Type: %s, Op: %s, AA: %s, Save Count: %d\n", kTypeStrings[fType], - kOpStrings[fOp], (fDoAA ? "yes" : "no"), fSaveCount); + kOpStrings[static_cast(fOp)], (fDoAA ? "yes" : "no"), fSaveCount); switch (fType) { case kEmpty_Type: SkDebugf("\n"); diff --git a/src/core/SkPictureCommon.h b/src/core/SkPictureCommon.h index 9b0a2f7c04..51724afcb5 100644 --- a/src/core/SkPictureCommon.h +++ b/src/core/SkPictureCommon.h @@ -119,7 +119,7 @@ struct SkPathCounter { void operator()(const SkRecords::ClipPath& op) { // TODO: does the SkRegion op matter? - if (op.opAA.aa && !op.path.isConvex()) { + if (op.opAA.aa() && !op.path.isConvex()) { fNumSlowPathsAndDashEffects++; } } diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index d5263ca80b..1ac91b7ab5 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -130,7 +130,7 @@ enum SaveLayerRecFlatFlags { static inline uint32_t ClipParams_pack(SkClipOp op, bool doAA) { unsigned doAABit = doAA ? 1 : 0; - return (doAABit << 4) | op; + return (doAABit << 4) | static_cast(op); } static inline SkClipOp ClipParams_unpackRegionOp(uint32_t packed) { diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index a0ac76d7a6..98677dd5eb 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -13,6 +13,7 @@ #include "SkRSXform.h" #include "SkTextBlob.h" #include "SkTSearch.h" +#include "SkClipOpPriv.h" #define HEAP_BLOCK_SIZE 4096 diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index 05261bb59f..fe39cf2aeb 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -85,9 +85,9 @@ DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); DRAW(Concat, concat(r.matrix)); DRAW(Translate, translate(r.dx, r.dy)); -DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); -DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); -DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); +DRAW(ClipPath, clipPath(r.path, r.opAA.op(), r.opAA.aa())); +DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op(), r.opAA.aa())); +DRAW(ClipRect, clipRect(r.rect, r.opAA.op(), r.opAA.aa())); DRAW(ClipRegion, clipRegion(r.region, r.op)); #ifdef SK_EXPERIMENTAL_SHADOWING diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 3a1e6e28e3..8ecb8bee55 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -26,6 +26,7 @@ #include "SkGr.h" #include "SkGrPriv.h" #endif +#include "SkClipOpPriv.h" class SkXfermodeImageFilter_Base : public SkImageFilter { public: diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 1172bc6a7b..9fc218224e 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -19,6 +19,7 @@ #include "effects/GrConvexPolyEffect.h" #include "effects/GrRRectEffect.h" #include "effects/GrTextureDomain.h" +#include "SkClipOpPriv.h" typedef SkClipStack::Element Element; typedef GrReducedClip::InitialState InitialState; @@ -204,16 +205,16 @@ static bool get_analytic_clip_processor(const ElementList& elements, bool invert; bool skip = false; switch (op) { - case SkRegion::kReplace_Op: + case kReplace_SkClipOp: SkASSERT(iter.get() == elements.head()); // Fallthrough, handled same as intersect. - case SkRegion::kIntersect_Op: + case kIntersect_SkClipOp: invert = false; if (iter.get()->contains(boundsInClipSpace)) { skip = true; } break; - case SkRegion::kDifference_Op: + case kDifference_SkClipOp: invert = true; // We don't currently have a cheap test for whether a rect is fully outside an // element's primitive, so don't attempt to set skip. diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 8b9090f427..fd616866f0 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -19,6 +19,7 @@ #include "GrStencilSettings.h" #include "GrStyle.h" #include "GrUserStencilSettings.h" +#include "SkClipOpPriv.h" typedef SkClipStack::Element Element; @@ -432,11 +433,11 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound } static bool element_is_pure_subtract(SkClipOp op) { - SkASSERT(op >= 0); - return op <= kIntersect_SkClipOp; + SkASSERT(static_cast(op) >= 0); + return static_cast(op) <= static_cast(kIntersect_SkClipOp); - GR_STATIC_ASSERT(0 == kDifference_SkClipOp); - GR_STATIC_ASSERT(1 == kIntersect_SkClipOp); + GR_STATIC_ASSERT(0 == static_cast(kDifference_SkClipOp)); + GR_STATIC_ASSERT(1 == static_cast(kIntersect_SkClipOp)); } void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) { diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 5724b1af6e..4f214897a7 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -42,6 +42,7 @@ #include "SkTextFormatParams.h" #include "SkUtils.h" #include "SkXfermodeInterpretation.h" +#include "SkClipOpPriv.h" #define DPI_FOR_RASTER_SCALE_ONE 72 @@ -199,8 +200,8 @@ static_assert(SkRegion::kReverseDifference_Op == (int)kReverseDifference_SkPathO "region_pathop_mismatch"); static SkPathOp region_op_to_pathops_op(SkClipOp op) { - SkASSERT(op >= 0); - SkASSERT(op <= kReverseDifference_SkClipOp); + SkASSERT(static_cast(op) >= 0); + SkASSERT(static_cast(op) <= static_cast(kReverseDifference_SkClipOp)); return (SkPathOp)op; } diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index b8f8938a17..09bd09bf2e 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -22,6 +22,7 @@ #include "SkTypeface.h" #include "SkUtils.h" #include "SkXMLWriter.h" +#include "SkClipOpPriv.h" namespace { diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp index 19917273c7..6dd0ca337b 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -12,6 +12,7 @@ #include "SkDevice.h" #include "SkRasterClip.h" #include "SkWriter32.h" +#include "SkClipOpPriv.h" /* * WARNING: The structs below are part of a stable ABI and as such we explicitly diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 601f9c9a7a..bba864338a 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -11,6 +11,7 @@ #include "SkRRect.h" #include "SkSurface.h" #include "SkTextBlob.h" +#include "SkClipOpPriv.h" bool SkDeferredCanvas::Rec::isConcat(SkMatrix* m) const { switch (fType) { diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 658da8185e..85e02430de 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -108,7 +108,7 @@ static const char* toString(SkClipOp op) { static const char* gOpNames[] = { "DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE" }; - return gOpNames[op]; + return gOpNames[static_cast(op)]; } static void toString(const SkRegion& rgn, SkString* str) { diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp index a35fc080d2..9533474c56 100644 --- a/tests/CanvasStateTest.cpp +++ b/tests/CanvasStateTest.cpp @@ -7,6 +7,7 @@ #include "CanvasStateHelpers.h" #include "SkCanvas.h" +#include "SkClipOpPriv.h" #include "SkCanvasStateUtils.h" #include "SkCommandLineFlags.h" #include "SkDrawFilter.h" diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp index f13e6b3310..847e522881 100644 --- a/tests/GrShapeTest.cpp +++ b/tests/GrShapeTest.cpp @@ -15,6 +15,7 @@ #include "SkPath.h" #include "SkPathOps.h" #include "SkSurface.h" +#include "SkClipOpPriv.h" using Key = SkTArray; diff --git a/tests/Test.h b/tests/Test.h index 8b60039da0..5e6eb6d421 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -10,6 +10,7 @@ #include "SkString.h" #include "SkTRegistry.h" #include "SkTypes.h" +#include "SkClipOpPriv.h" #if SK_SUPPORT_GPU #include "GrContextFactory.h" diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp index b02ab59ee8..b42c529f03 100644 --- a/tools/debugger/SkDebugCanvas.cpp +++ b/tools/debugger/SkDebugCanvas.cpp @@ -11,6 +11,7 @@ #include "SkDrawCommand.h" #include "SkPaintFilterCanvas.h" #include "SkTextBlob.h" +#include "SkClipOpPriv.h" #if SK_SUPPORT_GPU #include "GrAuditTrail.h" @@ -812,7 +813,7 @@ void SkDebugCanvas::addClipStackData(const SkPath& devPath, const SkPath& operan addPathData(fCalledAddStackData ? devPath : fSaveDevPath, "path"); addPathData(operand, "pathB"); fClipStackData.appendf("%stestPathOp(reporter, path, pathB, %s, filename);
", - kHTML4SpaceIndent, gOpStrs[elementOp]); + kHTML4SpaceIndent, gOpStrs[static_cast(elementOp)]); fClipStackData.appendf("}
"); fCalledAddStackData = true; } diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp index 6cec6eb6b1..4eaf2ea84a 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -26,6 +26,7 @@ #include "SkValidatingReadBuffer.h" #include "SkWriteBuffer.h" #include "picture_utils.h" +#include "SkClipOpPriv.h" #define SKDEBUGCANVAS_ATTRIBUTE_COMMAND "command" #define SKDEBUGCANVAS_ATTRIBUTE_VISIBLE "visible" diff --git a/tools/debugger/SkObjectParser.cpp b/tools/debugger/SkObjectParser.cpp index 8e3f2390c0..e89e8c5e10 100644 --- a/tools/debugger/SkObjectParser.cpp +++ b/tools/debugger/SkObjectParser.cpp @@ -16,6 +16,7 @@ #include "SkStringUtils.h" #include "SkTypeface.h" #include "SkUtils.h" +#include "SkClipOpPriv.h" /* TODO(chudy): Replace all std::strings with char */ -- cgit v1.2.3