aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-11-27 14:33:06 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-27 22:40:27 +0000
commit3b51df12119d82661ed64efa87d5ccfe2d32f625 (patch)
tree14e9d374b599621722c102cd61a382715ed75a03 /src/gpu
parent4b9506bc3c6e06958d1c38abe56b034777d48d5c (diff)
Cleanup yes/no enums in Ganesh
Yes/no enums should have a base type of bool, and kYes should always be true. Also, there is no need for a "GrEnumToBool()" function, as we can just use the enum itself directly: e.g. "GrAA(bool)". Bug: skia: Change-Id: I7bb3c2983f717f3467fca4ce6b32920d71026894 Reviewed-on: https://skia-review.googlesource.com/74860 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBackendSurface.cpp2
-rw-r--r--src/gpu/GrBlurUtils.cpp2
-rw-r--r--src/gpu/GrClipStackClip.cpp6
-rw-r--r--src/gpu/GrReducedClip.cpp25
-rw-r--r--src/gpu/GrReducedClip.h6
-rw-r--r--src/gpu/SkGpuDevice.cpp35
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp2
-rw-r--r--src/gpu/ops/GrOp.h12
8 files changed, 45 insertions, 45 deletions
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 67cc634ce0..02e909b118 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -19,7 +19,7 @@ GrBackendTexture::GrBackendTexture(int width,
: fWidth(width)
, fHeight(height)
, fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
- , fMipMapped(GrBoolToMipMapped(vkInfo.fLevelCount > 1))
+ , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1))
, fBackend(kVulkan_GrBackend)
, fVkInfo(vkInfo) {}
#endif
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 9760205de2..dcd4a99ece 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -296,7 +296,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
&grPaint)) {
return;
}
- GrAA aa = GrBoolToAA(paint.isAntiAlias());
+ GrAA aa = GrAA(paint.isAntiAlias());
SkMaskFilter* mf = paint.getMaskFilter();
if (mf && !mf->asFragmentProcessor(nullptr)) {
// The MaskFilter wasn't already handled in SkPaintToGrPaint
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 52fab72476..684a52d216 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -53,7 +53,7 @@ bool GrClipStackClip::isRRect(const SkRect& origRTBounds, SkRRect* rr, GrAA* aa)
const SkRect* rtBounds = &origRTBounds;
bool isAA;
if (fStack->isRRect(*rtBounds, rr, &isAA)) {
- *aa = GrBoolToAA(isAA);
+ *aa = GrAA(isAA);
return true;
}
return false;
@@ -121,7 +121,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
canDrawArgs.fClipConservativeBounds = &scissorRect;
canDrawArgs.fViewMatrix = &viewMatrix;
canDrawArgs.fShape = &shape;
- canDrawArgs.fAAType = GrChooseAAType(GrBoolToAA(element->isAA()),
+ canDrawArgs.fAAType = GrChooseAAType(GrAA(element->isAA()),
renderTargetContext->fsaaType(),
GrAllowMixedSamples::kYes,
*context->caps());
@@ -383,7 +383,7 @@ static void draw_clip_elements_to_mask_helper(GrSWMaskHelper& helper, const Elem
for (ElementList::Iter iter(elements); iter.get(); iter.next()) {
const Element* element = iter.get();
SkClipOp op = element->getOp();
- GrAA aa = GrBoolToAA(element->isAA());
+ GrAA aa = GrAA(element->isAA());
if (kIntersect_SkClipOp == op || kReverseDifference_SkClipOp == op) {
// Intersect and reverse difference require modifying pixels outside of the geometry
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 992411a4a2..883ed5d956 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -108,7 +108,7 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds
}
if (SK_InvalidGenID != fAAClipRectGenID && // Is there an AA clip rect?
- ClipResult::kNotClipped == this->addAnalyticFP(fAAClipRect, Invert::kNo, true)) {
+ ClipResult::kNotClipped == this->addAnalyticFP(fAAClipRect, Invert::kNo, GrAA::kYes)) {
if (fMaskElements.isEmpty()) {
// Use a replace since it is faster than intersect.
fMaskElements.addToHead(fAAClipRect, SkMatrix::I(), kReplace_SkClipOp, true /*doAA*/);
@@ -485,10 +485,11 @@ GrReducedClip::ClipResult GrReducedClip::clipInsideElement(const Element* elemen
case Element::DeviceSpaceType::kRRect:
return this->addAnalyticFP(element->getDeviceSpaceRRect(), Invert::kNo,
- element->isAA());
+ GrAA(element->isAA()));
case Element::DeviceSpaceType::kPath:
- return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kNo, element->isAA());
+ return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kNo,
+ GrAA(element->isAA()));
}
SK_ABORT("Unexpected DeviceSpaceType");
@@ -510,11 +511,12 @@ GrReducedClip::ClipResult GrReducedClip::clipOutsideElement(const Element* eleme
}
}
return this->addAnalyticFP(element->getDeviceSpaceRect(), Invert::kYes,
- element->isAA());
+ GrAA(element->isAA()));
case Element::DeviceSpaceType::kRRect: {
const SkRRect& clipRRect = element->getDeviceSpaceRRect();
- ClipResult clipResult = this->addAnalyticFP(clipRRect, Invert::kYes, element->isAA());
+ ClipResult clipResult = this->addAnalyticFP(clipRRect, Invert::kYes,
+ GrAA(element->isAA()));
if (fWindowRects.count() >= fMaxWindowRectangles) {
return clipResult;
}
@@ -552,7 +554,7 @@ GrReducedClip::ClipResult GrReducedClip::clipOutsideElement(const Element* eleme
case Element::DeviceSpaceType::kPath:
return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kYes,
- element->isAA());
+ GrAA(element->isAA()));
}
SK_ABORT("Unexpected DeviceSpaceType");
@@ -573,16 +575,17 @@ inline void GrReducedClip::addWindowRectangle(const SkRect& elementInteriorRect,
template<typename T>
inline GrReducedClip::ClipResult GrReducedClip::addAnalyticFP(const T& deviceSpaceShape,
- Invert invert, bool aa) {
+ Invert invert, GrAA aa) {
if (fAnalyticFPs.count() >= fMaxAnalyticFPs) {
return ClipResult::kNotClipped;
}
GrClipEdgeType edgeType;
if (Invert::kNo == invert) {
- edgeType = aa ? GrClipEdgeType::kFillAA : GrClipEdgeType::kFillBW;
+ edgeType = (GrAA::kYes == aa) ? GrClipEdgeType::kFillAA : GrClipEdgeType::kFillBW;
} else {
- edgeType = aa ? GrClipEdgeType::kInverseFillAA : GrClipEdgeType::kInverseFillBW;
+ edgeType = (GrAA::kYes == aa) ? GrClipEdgeType::kInverseFillAA
+ : GrClipEdgeType::kInverseFillBW;
}
if (auto fp = make_analytic_clip_fp(edgeType, deviceSpaceShape)) {
@@ -624,7 +627,7 @@ static bool stencil_element(GrRenderTargetContext* rtc,
const GrUserStencilSettings* ss,
const SkMatrix& viewMatrix,
const SkClipStack::Element* element) {
- GrAA aa = GrBoolToAA(element->isAA());
+ GrAA aa = GrAA(element->isAA());
switch (element->getDeviceSpaceType()) {
case SkClipStack::Element::DeviceSpaceType::kEmpty:
SkDEBUGFAIL("Should never get here with an empty element.");
@@ -700,7 +703,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
for (ElementList::Iter iter(fMaskElements); iter.get(); iter.next()) {
const Element* element = iter.get();
SkRegion::Op op = (SkRegion::Op)element->getOp();
- GrAA aa = GrBoolToAA(element->isAA());
+ GrAA aa = GrAA(element->isAA());
bool invert = element->isInverseFilled();
if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) {
// draw directly into the result with the stencil set to make the pixels affected
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index 3ad2ab9971..22387d7962 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -109,11 +109,11 @@ private:
void addWindowRectangle(const SkRect& elementInteriorRect, bool elementIsAA);
enum class Invert : bool {
- kNo,
- kYes
+ kNo = false,
+ kYes = true
};
- template<typename T> ClipResult addAnalyticFP(const T& deviceSpaceShape, Invert, bool aa);
+ template<typename T> ClipResult addAnalyticFP(const T& deviceSpaceShape, Invert, GrAA);
void makeEmpty();
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 33837d391c..3e165582d6 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -307,8 +307,8 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
path.setIsVolatile(true);
path.moveTo(pts[0]);
path.lineTo(pts[1]);
- fRenderTargetContext->drawPath(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), path, style);
+ fRenderTargetContext->drawPath(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+ this->ctm(), path, style);
return;
}
@@ -380,8 +380,8 @@ void SkGpuDevice::drawRect(const SkRect& rect, const SkPaint& paint) {
}
GrStyle style(paint);
- fRenderTargetContext->drawRect(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), rect, &style);
+ fRenderTargetContext->drawRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+ this->ctm(), rect, &style);
}
///////////////////////////////////////////////////////////////////////////////
@@ -434,8 +434,8 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
SkASSERT(!style.pathEffect());
- fRenderTargetContext->drawRRect(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), rrect, style);
+ fRenderTargetContext->drawRRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+ this->ctm(), rrect, style);
}
@@ -461,8 +461,7 @@ void SkGpuDevice::drawDRRect(const SkRRect& outer,
}
fRenderTargetContext->drawDRRect(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), outer,
- inner);
+ GrAA(paint.isAntiAlias()), this->ctm(), outer, inner);
return;
}
@@ -493,9 +492,8 @@ void SkGpuDevice::drawRegion(const SkRegion& region, const SkPaint& paint) {
return;
}
- fRenderTargetContext->drawRegion(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), region,
- GrStyle(paint));
+ fRenderTargetContext->drawRegion(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+ this->ctm(), region, GrStyle(paint));
}
void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
@@ -522,9 +520,8 @@ void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
return;
}
- fRenderTargetContext->drawOval(this->clip(), std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()), this->ctm(), oval,
- GrStyle(paint));
+ fRenderTargetContext->drawOval(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+ this->ctm(), oval, GrStyle(paint));
}
void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle,
@@ -541,7 +538,7 @@ void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle,
return;
}
- fRenderTargetContext->drawArc(this->clip(), std::move(grPaint), GrBoolToAA(paint.isAntiAlias()),
+ fRenderTargetContext->drawArc(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
this->ctm(), oval, startAngle, sweepAngle, useCenter,
GrStyle(paint));
}
@@ -598,7 +595,7 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2],
}
fRenderTargetContext->fillRectWithLocalMatrix(
- this->clip(), std::move(grPaint), GrBoolToAA(newPaint.isAntiAlias()), m, rect, local);
+ this->clip(), std::move(grPaint), GrAA(newPaint.isAntiAlias()), m, rect, local);
}
void SkGpuDevice::drawPath(const SkPath& origSrcPath,
@@ -1033,8 +1030,8 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
}
// Coverage-based AA would cause seams between tiles.
- GrAA aa = GrBoolToAA(paint.isAntiAlias() &&
- GrFSAAType::kNone != fRenderTargetContext->fsaaType());
+ GrAA aa = GrAA(paint.isAntiAlias() &&
+ GrFSAAType::kNone != fRenderTargetContext->fsaaType());
fRenderTargetContext->drawRect(this->clip(), std::move(grPaint), aa, viewMatrix, dstRect);
}
@@ -1108,7 +1105,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, int left, int top, const
fRenderTargetContext->fillRectToRect(
this->clip(),
std::move(grPaint),
- GrBoolToAA(paint.isAntiAlias()),
+ GrAA(paint.isAntiAlias()),
SkMatrix::I(),
SkRect::Make(SkIRect::MakeXYWH(left + offset.fX, top + offset.fY, subset.width(),
subset.height())),
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index c823ebd082..bedd292a58 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -297,7 +297,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
&grPaint)) {
return;
}
- GrAA aa = GrBoolToAA(paint.isAntiAlias());
+ GrAA aa = GrAA(paint.isAntiAlias());
if (canUseTextureCoordsAsLocalCoords) {
fRenderTargetContext->fillRectToRect(this->clip(), std::move(grPaint), aa, viewMatrix,
clippedDstRect, clippedSrcRect);
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index ece868fd44..5f6177009a 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -164,17 +164,17 @@ protected:
* purpose of ensuring that the fragment shader runs on partially covered pixels for
* non-MSAA antialiasing.
*/
- enum class HasAABloat {
- kYes,
- kNo
+ enum class HasAABloat : bool {
+ kNo = false,
+ kYes = true
};
/**
* Indicates that the geometry represented by the op has zero area (e.g. it is hairline or
* points).
*/
- enum class IsZeroArea {
- kYes,
- kNo
+ enum class IsZeroArea : bool {
+ kNo = false,
+ kYes = true
};
void setBounds(const SkRect& newBounds, HasAABloat aabloat, IsZeroArea zeroArea) {