Fix clang-tidy performance warnings.
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1
Change-Id: I7c19a10f0ae0b4784851bedbcaf1c4565c6616d1
diff --git a/cpp/Sampler.cpp b/cpp/Sampler.cpp
index e2e8fac..5aebd86 100644
--- a/cpp/Sampler.cpp
+++ b/cpp/Sampler.cpp
@@ -61,7 +61,7 @@
return mAniso;
}
-sp<Sampler> Sampler::create(sp<RS> rs, RsSamplerValue min, RsSamplerValue mag,
+sp<Sampler> Sampler::create(const sp<RS>& rs, RsSamplerValue min, RsSamplerValue mag,
RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy) {
// We aren't supporting wrapR in C++ API atm, so always pass wrap for that.
void* id = RS::dispatch->SamplerCreate(rs->getContext(), min, mag, wrapS, wrapT,
@@ -69,7 +69,7 @@
return new Sampler(rs, id, min, mag, wrapS, wrapT, anisotropy);
}
-#define CREATE_SAMPLER(N, MIN, MAG, WRAPS, WRAPT) sp<const Sampler> Sampler::N(sp<RS> rs) { \
+#define CREATE_SAMPLER(N, MIN, MAG, WRAPS, WRAPT) sp<const Sampler> Sampler::N(const sp<RS> &rs) { \
if (rs->mSamplers.N == nullptr) { \
rs->mSamplers.N = (create(rs, MIN, MAG, WRAPS, WRAPT, 0.f)); \
} \