Skip to content

Commit

Permalink
[svg] Conditional debugging
Browse files Browse the repository at this point in the history
Use SkDEBUGF, which can be disabled, instead of always-on SkDebugf.

Bug: b/374627499
Change-Id: I6852357935cfe3c0058f5b23f7362b97235bc404
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/912956
Reviewed-by: Nicolette Prevost <[email protected]>
Reviewed-by: Florin Malita <[email protected]>
Commit-Queue: Florin Malita <[email protected]>
  • Loading branch information
fmalita authored and SkCQ committed Dec 4, 2024
1 parent c9647f1 commit 1150377
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion modules/svg/include/SkSVGFeLightSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class SK_API SkSVGFeLightSource : public SkSVGHiddenContainer {
public:
void appendChild(sk_sp<SkSVGNode>) final {
SkDebugf("cannot append child nodes to an SVG light source.\n");
SkDEBUGF("cannot append child nodes to an SVG light source.\n");
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion modules/svg/include/SkSVGImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SK_API SkSVGImage final : public SkSVGTransformableNode {
}

void appendChild(sk_sp<SkSVGNode>) override {
SkDebugf("cannot append child nodes to this element.\n");
SkDEBUGF("cannot append child nodes to this element.\n");
}

bool onPrepareToRender(SkSVGRenderContext*) const override;
Expand Down
2 changes: 1 addition & 1 deletion modules/svg/src/SkSVGFeFlood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SkColor SkSVGFeFlood::resolveFloodColor(const SkSVGRenderContext& ctx) const {
const auto floodOpacity = this->getFloodOpacity();
// Uninherited presentation attributes should have a concrete value by now.
if (!floodColor.isValue() || !floodOpacity.isValue()) {
SkDebugf("unhandled: flood-color or flood-opacity has no value\n");
SkDEBUGF("unhandled: flood-color or flood-opacity has no value\n");
return SK_ColorBLACK;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/svg/src/SkSVGFeLighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ sk_sp<SkImageFilter> SkSVGFeLighting::onMakeImageFilter(const SkSVGRenderContext
}
}

SkDebugf("lighting filter effect needs exactly one light source\n");
SkDEBUGF("lighting filter effect needs exactly one light source\n");
return nullptr;
}

SkColor SkSVGFeLighting::resolveLightingColor(const SkSVGRenderContext& ctx) const {
const auto color = this->getLightingColor();
if (!color.isValue()) {
// Uninherited presentation attributes should have a concrete value by now.
SkDebugf("unhandled: lighting-color has no value\n");
SkDEBUGF("unhandled: lighting-color has no value\n");
return SK_ColorWHITE;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/svg/src/SkSVGFilterContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ std::tuple<sk_sp<SkImageFilter>, SkSVGColorspace> SkSVGFilterContext::getInput(
break;
}
default:
SkDebugf("unhandled filter input type %d\n", (int)inputType.type());
SkDEBUGF("unhandled filter input type %d\n", (int)inputType.type());
break;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/svg/src/SkSVGGradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SkColor4f SkSVGGradient::resolveStopColor(const SkSVGRenderContext& ctx,
const auto& stopOpacity = stop.getStopOpacity();
// Uninherited presentation attrs should have a concrete value at this point.
if (!stopColor.isValue() || !stopOpacity.isValue()) {
SkDebugf("unhandled: stop-color or stop-opacity has no value\n");
SkDEBUGF("unhandled: stop-color or stop-opacity has no value\n");
return SkColors::kBlack;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/svg/src/SkSVGImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static sk_sp<SkImage> LoadImage(const sk_sp<skresources::ResourceProvider>& rp,
break;
}
default:
SkDebugf("error loading image: unhandled iri type %d\n", (int)href.type());
SkDEBUGF("error loading image: unhandled iri type %d\n", (int)href.type());
return nullptr;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ void SkSVGImage::onRender(const SkSVGRenderContext& ctx) const {

const auto imgInfo = LoadImage(ctx.resourceProvider(), fHref, viewPort, fPreserveAspectRatio);
if (!imgInfo.fImage) {
SkDebugf("can't render image: load image failed\n");
SkDEBUGF("can't render image: load image failed\n");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/svg/src/SkSVGRenderContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SkScalar SkSVGLengthContext::resolve(const SkSVGLength& l, LengthType t) const {
case SkSVGLength::Unit::kPC:
return l.value() * fDPI * kPCMultiplier;
default:
SkDebugf("unsupported unit type: <%d>\n", (int)l.unit());
SkDEBUGF("unsupported unit type: <%d>\n", (int)l.unit());
return 0;
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ SkSVGRenderContext::~SkSVGRenderContext() {

SkSVGRenderContext::BorrowedNode SkSVGRenderContext::findNodeById(const SkSVGIRI& iri) const {
if (iri.type() != SkSVGIRI::Type::kLocal) {
SkDebugf("non-local iri references not currently supported");
SkDEBUGF("non-local iri references not currently supported");
return BorrowedNode(nullptr);
}
return BorrowedNode(fIDMapper.find(iri.iri()));
Expand Down Expand Up @@ -493,7 +493,7 @@ SkSVGColorType SkSVGRenderContext::resolveSvgColor(const SkSVGColor& color) cons
case SkSVGColor::Type::kCurrentColor:
return *fPresentationContext->fInherited.fColor;
case SkSVGColor::Type::kICCColor:
SkDebugf("ICC color unimplemented");
SkDEBUGF("ICC color unimplemented");
return SK_ColorBLACK;
}
SkUNREACHABLE;
Expand Down
2 changes: 1 addition & 1 deletion modules/svg/src/SkSVGShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const {
}

void SkSVGShape::appendChild(sk_sp<SkSVGNode>) {
SkDebugf("cannot append child nodes to an SVG shape.\n");
SkDEBUGF("cannot append child nodes to an SVG shape.\n");
}
2 changes: 1 addition & 1 deletion modules/svg/src/SkSVGUse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SkSVGUse::SkSVGUse() : INHERITED(SkSVGTag::kUse) {}

void SkSVGUse::appendChild(sk_sp<SkSVGNode>) {
SkDebugf("cannot append child nodes to this element.\n");
SkDEBUGF("cannot append child nodes to this element.\n");
}

bool SkSVGUse::parseAndSetAttribute(const char* n, const char* v) {
Expand Down

0 comments on commit 1150377

Please sign in to comment.