Remove GrSharedEnums.h

Change-Id: I3f2e927001da10652b2965687e31aa8452c9dfc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425997
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2021-07-08 13:47:25 -04:00 committed by Skia Commit-Bot
parent b7df41828a
commit 50f0dadb7f
9 changed files with 24 additions and 46 deletions

View File

@ -16,7 +16,6 @@
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkTLList.h"
#include "src/gpu/GrFragmentProcessor.h"

View File

@ -21,7 +21,6 @@
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h"
#include "include/utils/SkRandom.h"

View File

@ -17,7 +17,6 @@
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFragmentProcessor.h"

View File

@ -18,7 +18,6 @@
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkTLList.h"
#include "src/gpu/GrFragmentProcessor.h"

View File

@ -17,7 +17,6 @@
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/GrCaps.h"

View File

@ -1,29 +0,0 @@
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrSharedEnums_DEFINED
#define GrSharedEnums_DEFINED
/*************************************************************************************************/
/* This file is used from both C++ and SkSL, so we need to stick to syntax compatible with both. */
/*************************************************************************************************/
/**
* We have coverage effects that clip rendering to the edge of some geometric primitive.
* This enum specifies how that clipping is performed. Not all factories that take a
* GrProcessorEdgeType will succeed with all values and it is up to the caller to verify success.
*/
enum class GrClipEdgeType {
kFillBW,
kFillAA,
kInverseFillBW,
kInverseFillAA,
kLast = kInverseFillAA
};
#endif

View File

@ -14,7 +14,6 @@
#include "include/core/SkPath.h"
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrSharedEnums.h"
#include "include/private/SkImageInfoPriv.h"
class GrBackendFormat;
@ -695,23 +694,36 @@ static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
//////////////////////////////////////////////////////////////////////////////
/**
* We have coverage effects that clip rendering to the edge of some geometric primitive.
* This enum specifies how that clipping is performed. Not all factories that take a
* GrClipEdgeType will succeed with all values and it is up to the caller to verify success.
*/
enum class GrClipEdgeType {
kFillBW,
kFillAA,
kInverseFillBW,
kInverseFillAA,
kLast = kInverseFillAA
};
static const int kGrClipEdgeTypeCnt = (int) GrClipEdgeType::kLast + 1;
static constexpr bool GrProcessorEdgeTypeIsFill(const GrClipEdgeType edgeType) {
static constexpr bool GrClipEdgeTypeIsFill(const GrClipEdgeType edgeType) {
return (GrClipEdgeType::kFillAA == edgeType || GrClipEdgeType::kFillBW == edgeType);
}
static constexpr bool GrProcessorEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) {
static constexpr bool GrClipEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) {
return (GrClipEdgeType::kInverseFillAA == edgeType ||
GrClipEdgeType::kInverseFillBW == edgeType);
}
static constexpr bool GrProcessorEdgeTypeIsAA(const GrClipEdgeType edgeType) {
static constexpr bool GrClipEdgeTypeIsAA(const GrClipEdgeType edgeType) {
return (GrClipEdgeType::kFillBW != edgeType &&
GrClipEdgeType::kInverseFillBW != edgeType);
}
static inline GrClipEdgeType GrInvertProcessorEdgeType(const GrClipEdgeType edgeType) {
static inline GrClipEdgeType GrInvertClipEdgeType(const GrClipEdgeType edgeType) {
switch (edgeType) {
case GrClipEdgeType::kFillBW:
return GrClipEdgeType::kInverseFillBW;

View File

@ -703,7 +703,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Rect(
SkASSERT(rect.isSorted());
// The AA math in the shader evaluates to 0 at the uploaded coordinates, so outset by 0.5
// to interpolate from 0 at a half pixel inset and 1 at a half pixel outset of rect.
SkRect rectUniform = GrProcessorEdgeTypeIsAA(edgeType) ? rect.makeOutset(.5f, .5f) : rect;
SkRect rectUniform = GrClipEdgeTypeIsAA(edgeType) ? rect.makeOutset(.5f, .5f) : rect;
return GrSkSLFP::Make(effect, "Rect", std::move(inputFP),
GrSkSLFP::OptFlags::kCompatibleWithCoverageAsAlpha,
@ -717,7 +717,7 @@ GrFPResult GrFragmentProcessor::Circle(std::unique_ptr<GrFragmentProcessor> inpu
float radius) {
// A radius below half causes the implicit insetting done by this processor to become
// inverted. We could handle this case by making the processor code more complicated.
if (radius < .5f && GrProcessorEdgeTypeIsInverseFill(edgeType)) {
if (radius < .5f && GrClipEdgeTypeIsInverseFill(edgeType)) {
return GrFPFailure(std::move(inputFP));
}
@ -746,7 +746,7 @@ GrFPResult GrFragmentProcessor::Circle(std::unique_ptr<GrFragmentProcessor> inpu
)");
SkScalar effectiveRadius = radius;
if (GrProcessorEdgeTypeIsInverseFill(edgeType)) {
if (GrClipEdgeTypeIsInverseFill(edgeType)) {
effectiveRadius -= 0.5f;
// When the radius is 0.5 effectiveRadius is 0 which causes an inf * 0 in the shader.
effectiveRadius = std::max(0.001f, effectiveRadius);

View File

@ -50,7 +50,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
Declare(edge);
for (int i = 0; i < cpe.getEdgeCount(); ++i) {
edge = Dot(edgeArray[i], Half3(Swizzle(sk_FragCoord(), X, Y, ONE)));
if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) {
if (GrClipEdgeTypeIsAA(cpe.getEdgeType())) {
edge = Saturate(edge);
} else {
edge = Select(edge >= 0.5, 1.0, 0.0);
@ -58,7 +58,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
alpha *= edge;
}
if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) {
if (GrClipEdgeTypeIsInverseFill(cpe.getEdgeType())) {
alpha = 1.0 - alpha;
}
@ -97,7 +97,7 @@ GrFPResult GrConvexPolyEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP
// case nothing is inside the clip. It'd be nice to detect this at a higher level and either
// skip the draw or omit the clip element.
if (dir == SkPathFirstDirection::kUnknown) {
if (GrProcessorEdgeTypeIsInverseFill(type)) {
if (GrClipEdgeTypeIsInverseFill(type)) {
return GrFPSuccess(
GrFragmentProcessor::ModulateRGBA(std::move(inputFP), SK_PMColor4fWHITE));
}
@ -150,7 +150,7 @@ GrFPResult GrConvexPolyEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP
}
if (path.isInverseFillType()) {
type = GrInvertProcessorEdgeType(type);
type = GrInvertClipEdgeType(type);
}
return GrConvexPolyEffect::Make(std::move(inputFP), type, n, edges);
}