Rename methods and enum on SkClipStack::Element to indicate "device space"
Change-Id: I83056843b530f76590f755f97e3d0a5a58f371fa
Reviewed-on: https://skia-review.googlesource.com/39402
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index f7bb42a..ed5ce8a 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -171,8 +171,9 @@
} else if (GrClip::IsOutsideClip(element->getBounds(), queryBounds)) {
skippable = true;
} else if (fWindowRects.count() < maxWindowRectangles && !embiggens &&
- !element->isAA() && Element::kRect_Type == element->getType()) {
- this->addWindowRectangle(element->getRect(), false);
+ !element->isAA() &&
+ Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
+ this->addWindowRectangle(element->getDeviceSpaceRect(), false);
skippable = true;
}
}
@@ -198,11 +199,11 @@
initialTriState = InitialTriState::kAllOut;
skippable = true;
} else if (!embiggens && !element->isAA() &&
- Element::kRect_Type == element->getType()) {
+ Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
// fIBounds and queryBounds have already acccounted for this element via
// clip stack bounds; here we just apply the non-aa rounding effect.
SkIRect nonaaRect;
- element->getRect().round(&nonaaRect);
+ element->getDeviceSpaceRect().round(&nonaaRect);
if (!this->intersectIBounds(nonaaRect)) {
return;
}
@@ -304,11 +305,11 @@
initialTriState = InitialTriState::kAllOut;
skippable = true;
} else if (!embiggens && !element->isAA() &&
- Element::kRect_Type == element->getType()) {
+ Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
// fIBounds and queryBounds have already acccounted for this element via
// clip stack bounds; here we just apply the non-aa rounding effect.
SkIRect nonaaRect;
- element->getRect().round(&nonaaRect);
+ element->getDeviceSpaceRect().round(&nonaaRect);
if (!this->intersectIBounds(nonaaRect)) {
return;
}
@@ -458,18 +459,18 @@
continue;
}
- if (Element::kRect_Type == element->getType()) {
+ if (Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
SkASSERT(element->isAA());
- this->addWindowRectangle(element->getRect(), true);
+ this->addWindowRectangle(element->getDeviceSpaceRect(), true);
if (fWindowRects.count() >= maxWindowRectangles) {
return;
}
continue;
}
- if (Element::kRRect_Type == element->getType()) {
+ if (Element::DeviceSpaceType::kRRect == element->getDeviceSpaceType()) {
// For round rects we add two overlapping windows in the shape of a plus.
- const SkRRect& clipRRect = element->getRRect();
+ const SkRRect& clipRRect = element->getDeviceSpaceRRect();
SkVector insetTL = clipRRect.radii(SkRRect::kUpperLeft_Corner);
SkVector insetBR = clipRRect.radii(SkRRect::kLowerRight_Corner);
if (SkRRect::kComplex_Type == clipRRect.getType()) {
@@ -538,19 +539,18 @@
const SkMatrix& viewMatrix,
const SkClipStack::Element* element) {
GrAA aa = GrBoolToAA(element->isAA());
- switch (element->getType()) {
- case Element::kEmpty_Type:
+ switch (element->getDeviceSpaceType()) {
+ case Element::DeviceSpaceType::kEmpty:
SkDEBUGFAIL("Should never get here with an empty element.");
break;
- case Element::kRect_Type:
- return rtc->priv().drawAndStencilRect(clip, ss,
- (SkRegion::Op)element->getOp(),
+ case Element::DeviceSpaceType::kRect:
+ return rtc->priv().drawAndStencilRect(clip, ss, (SkRegion::Op)element->getOp(),
element->isInverseFilled(), aa, viewMatrix,
- element->getRect());
+ element->getDeviceSpaceRect());
break;
default: {
SkPath path;
- element->asPath(&path);
+ element->asDeviceSpacePath(&path);
if (path.isInverseFillType()) {
path.toggleInverseFillType();
}
@@ -571,16 +571,16 @@
const SkMatrix& viewMatrix,
const SkClipStack::Element* element) {
// TODO: Draw rrects directly here.
- switch (element->getType()) {
- case Element::kEmpty_Type:
+ switch (element->getDeviceSpaceType()) {
+ case Element::DeviceSpaceType::kEmpty:
SkDEBUGFAIL("Should never get here with an empty element.");
break;
- case Element::kRect_Type:
- rtc->drawRect(clip, std::move(paint), aa, viewMatrix, element->getRect());
+ case Element::DeviceSpaceType::kRect:
+ rtc->drawRect(clip, std::move(paint), aa, viewMatrix, element->getDeviceSpaceRect());
break;
default: {
SkPath path;
- element->asPath(&path);
+ element->asDeviceSpacePath(&path);
if (path.isInverseFillType()) {
path.toggleInverseFillType();
}
@@ -730,11 +730,11 @@
GrPathRenderer* pr = nullptr;
SkPath clipPath;
- if (Element::kRect_Type == element->getType()) {
+ if (Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
stencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
fillInverted = false;
} else {
- element->asPath(&clipPath);
+ element->asDeviceSpacePath(&clipPath);
fillInverted = clipPath.isInverseFillType();
if (fillInverted) {
clipPath.toggleInverseFillType();
@@ -777,9 +777,10 @@
GrUserStencilOp::kIncMaybeClamp,
0xffff>()
);
- if (Element::kRect_Type == element->getType()) {
+ if (Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
renderTargetContext->priv().stencilRect(stencilClip.fixedClip(), &kDrawToStencil,
- aaType, SkMatrix::I(), element->getRect());
+ aaType, SkMatrix::I(),
+ element->getDeviceSpaceRect());
} else {
if (!clipPath.isEmpty()) {
GrShape shape(clipPath, GrStyle::SimpleFill());
@@ -815,9 +816,10 @@
// element directly or a bounding rect of the entire clip.
for (GrUserStencilSettings const* const* pass = stencilPasses; *pass; ++pass) {
if (drawDirectToClip) {
- if (Element::kRect_Type == element->getType()) {
+ if (Element::DeviceSpaceType::kRect == element->getDeviceSpaceType()) {
renderTargetContext->priv().stencilRect(stencilClip, *pass, aaType,
- SkMatrix::I(), element->getRect());
+ SkMatrix::I(),
+ element->getDeviceSpaceRect());
} else {
GrShape shape(clipPath, GrStyle::SimpleFill());
GrPaint paint;