Fix -Warray-parameter warnings
Clang recently added this warning which flags inconsistencies between
array parameters in function declarations.
Bug: chromium:1343303
Change-Id: Id0432e19f241abfb566787c440e01e185d7f17d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557336
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 592fd0e..399b405 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -727,7 +727,7 @@
C = d - 3c + 3b - a
(BxCy - ByCx)t^2 + (AxCy - AyCx)t + AxBy - AyBx == 0
*/
-int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) {
+int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[2]) {
SkScalar Ax = src[1].fX - src[0].fX;
SkScalar Ay = src[1].fY - src[0].fY;
SkScalar Bx = src[2].fX - 2 * src[1].fX + src[0].fX;
@@ -741,7 +741,7 @@
tValues);
}
-int SkChopCubicAtInflections(const SkPoint src[], SkPoint dst[10]) {
+int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10]) {
SkScalar tValues[2];
int count = SkFindCubicInflections(src, tValues);
@@ -1619,7 +1619,7 @@
}
#endif
-SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w, const SkMatrix& matrix) {
+SkScalar SkConic::TransformW(const SkPoint pts[3], SkScalar w, const SkMatrix& matrix) {
if (!matrix.hasPerspective()) {
return w;
}
diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h
index a9309e3..2915f20 100644
--- a/src/core/SkGeometry.h
+++ b/src/core/SkGeometry.h
@@ -75,7 +75,7 @@
/** Given a src quadratic bezier, returns the T value whose tangent angle is halfway between the
tangents at p0 and p3.
*/
-float SkFindQuadMidTangent(const SkPoint src[4]);
+float SkFindQuadMidTangent(const SkPoint src[3]);
/** Given a src quadratic bezier, chop it at the tangent whose angle is halfway between the
tangents at p0 and p2. The new quads are returned in dst[0..2] and dst[2..4].
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp
index c184d7b..baeab1b 100644
--- a/src/core/SkLineClipper.cpp
+++ b/src/core/SkLineClipper.cpp
@@ -172,7 +172,7 @@
}
#endif
-int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
+int SkLineClipper::ClipLine(const SkPoint pts[2], const SkRect& clip, SkPoint lines[kMaxPoints],
bool canCullToTheRight) {
int index0, index1;
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 85e3c17..08bee41 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -62,13 +62,13 @@
SkMatrix& SkMatrix::reset() { *this = SkMatrix(); return *this; }
-SkMatrix& SkMatrix::set9(const SkScalar buffer[]) {
+SkMatrix& SkMatrix::set9(const SkScalar buffer[9]) {
memcpy(fMat, buffer, 9 * sizeof(SkScalar));
this->setTypeMask(kUnknown_Mask);
return *this;
}
-SkMatrix& SkMatrix::setAffine(const SkScalar buffer[]) {
+SkMatrix& SkMatrix::setAffine(const SkScalar buffer[6]) {
fMat[kMScaleX] = buffer[kAScaleX];
fMat[kMSkewX] = buffer[kASkewX];
fMat[kMTransX] = buffer[kATransX];
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 4e9bbe5..6ec4220 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -87,7 +87,7 @@
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index 0db4f18..85e5223 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -55,7 +55,7 @@
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/src/image/SkImage_Lazy.h b/src/image/SkImage_Lazy.h
index c2883ff..c15ed17 100644
--- a/src/image/SkImage_Lazy.h
+++ b/src/image/SkImage_Lazy.h
@@ -73,7 +73,7 @@
GrImageTexGenPolicy) const override;
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index f6e9112..fcf7e1c 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -514,7 +514,7 @@
}
// OPTIMIZE? share code with formulate_F1DotF2
-int SkDCubic::findInflections(double tValues[]) const {
+int SkDCubic::findInflections(double tValues[2]) const {
double Ax = fPts[1].fX - fPts[0].fX;
double Ay = fPts[1].fY - fPts[0].fY;
double Bx = fPts[2].fX - 2 * fPts[1].fX + fPts[0].fX;
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
index 2c3a5ea..9702d8c 100644
--- a/src/utils/SkPaintFilterCanvas.cpp
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -165,8 +165,8 @@
}
}
-void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[], const SkColor colors[],
- const SkPoint texCoords[], SkBlendMode bmode,
+void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
+ const SkPoint texCoords[4], SkBlendMode bmode,
const SkPaint& paint) {
AutoPaintFilter apf(this, paint);
if (apf.shouldDraw()) {