int width = random->nextRangeU(1, MAX_KERNEL_SIZE);
int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width);
SkISize kernelSize = SkISize::Make(width, height);
- SkScalar* kernel = new SkScalar[width * height];
+ SkAutoTDeleteArray<SkScalar> kernel(new SkScalar[width * height]);
for (int i = 0; i < width * height; i++) {
- kernel[i] = random->nextSScalar1();
+ kernel.get()[i] = random->nextSScalar1();
}
SkScalar gain = random->nextSScalar1();
SkScalar bias = random->nextSScalar1();
bool convolveAlpha = random->nextBool();
return GrMatrixConvolutionEffect::Create(textures[texIdx],
kernelSize,
- kernel,
+ kernel.get(),
gain,
bias,
target,
tileMode,
convolveAlpha);
-
}
bool SkMatrixConvolutionImageFilter::asNewEffect(GrEffectRef** effect,
static void test_constructor(skiatest::Reporter* reporter) {
// Allocate a matrix on the heap
SkMatrix44* placeholderMatrix = new SkMatrix44();
+ SkAutoTDelete<SkMatrix44> deleteMe(placeholderMatrix);
+
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
placeholderMatrix->setDouble(row, col, row * col);
// and there is no assert on input data in Debug mode.
static void test_issue1083() {
SkISize pageSize = SkISize::Make(100, 100);
- SkPDFDevice* dev = new SkPDFDevice(pageSize, pageSize, SkMatrix::I());
+ SkAutoTUnref<SkPDFDevice> dev(new SkPDFDevice(pageSize, pageSize, SkMatrix::I()));
SkCanvas c(dev);
SkPaint paint;