Index: tools/skpdiff/SkPMetric.cpp |
diff --git a/tools/skpdiff/SkPMetric.cpp b/tools/skpdiff/SkPMetric.cpp |
index 392a3422157ef99cda75b8104f7539662865c8a2..3563642880f08edd9662eba29dbb46ebf72fc38e 100644 |
--- a/tools/skpdiff/SkPMetric.cpp |
+++ b/tools/skpdiff/SkPMetric.cpp |
@@ -1,3 +1,9 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
#include <cmath> |
#include <math.h> |
@@ -25,12 +31,10 @@ struct Image2D { |
height(h) { |
SkASSERT(w > 0); |
SkASSERT(h > 0); |
- image = SkNEW_ARRAY(T, w * h); |
+ image = new T[w * h]; |
} |
- ~Image2D() { |
- SkDELETE_ARRAY(image); |
- } |
+ ~Image2D() { delete[] image; } |
void readPixel(int x, int y, T* pixel) const { |
SkASSERT(x >= 0); |
@@ -66,17 +70,17 @@ struct ImageArray |
ImageArray(int w, int h, int s) |
: slices(s) { |
SkASSERT(s > 0); |
- image = SkNEW_ARRAY(Image2D<T>*, s); |
+ image = new Image2D<T>* [s]; |
for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) { |
- image[sliceIndex] = SkNEW_ARGS(Image2D<T>, (w, h)); |
+ image[sliceIndex] = new Image2D<T>(w, h); |
} |
} |
~ImageArray() { |
for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) { |
- SkDELETE(image[sliceIndex]); |
+ delete image[sliceIndex]; |
} |
- SkDELETE_ARRAY(image); |
+ delete[] image; |
} |
Image2D<T>* getLayer(int z) const { |
@@ -296,9 +300,9 @@ static double pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB, int* |
ImageL3D baselineL(width, height, maxLevels); |
ImageL3D testL(width, height, maxLevels); |
ImageL scratchImageL(width, height); |
- float* cyclesPerDegree = SkNEW_ARRAY(float, maxLevels); |
- float* thresholdFactorFrequency = SkNEW_ARRAY(float, maxLevels - 2); |
- float* contrast = SkNEW_ARRAY(float, maxLevels - 2); |
+ float* cyclesPerDegree = new float[maxLevels]; |
+ float* thresholdFactorFrequency = new float[maxLevels - 2]; |
+ float* contrast = new float[maxLevels - 2]; |
lab_to_l(baselineLAB, baselineL.getLayer(0)); |
lab_to_l(testLAB, testL.getLayer(0)); |
@@ -311,7 +315,7 @@ static double pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB, int* |
// Contrast sensitivity is based on image dimensions. Therefore it cannot be statically |
// generated. |
- float* contrastSensitivityTable = SkNEW_ARRAY(float, maxLevels * 1000); |
+ float* contrastSensitivityTable = new float[maxLevels * 1000]; |
for (int levelIndex = 0; levelIndex < maxLevels; levelIndex++) { |
for (int csLum = 0; csLum < 1000; csLum++) { |
contrastSensitivityTable[levelIndex * 1000 + csLum] = |
@@ -435,10 +439,10 @@ static double pmetric(const ImageLAB* baselineLAB, const ImageLAB* testLAB, int* |
} |
} |
- SkDELETE_ARRAY(cyclesPerDegree); |
- SkDELETE_ARRAY(contrast); |
- SkDELETE_ARRAY(thresholdFactorFrequency); |
- SkDELETE_ARRAY(contrastSensitivityTable); |
+ delete[] cyclesPerDegree; |
+ delete[] contrast; |
+ delete[] thresholdFactorFrequency; |
+ delete[] contrastSensitivityTable; |
return 1.0 - (double)(*poiCount) / (width * height); |
} |