Address some more valgrind issues
R=borenet@google.com
Review URL: https://codereview.chromium.org/59713010
git-svn-id: http://skia.googlecode.com/svn/trunk@12286 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 97e267e..9c40aa7 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -273,13 +273,13 @@
}
#if SK_SUPPORT_GPU
-static void gpu_blur_path(GrContextFactory* factory, const SkPath& path,
+static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path,
SkScalar gaussianSigma,
int* result, int resultCount) {
GrContext* grContext = factory->get(GrContextFactory::kNative_GLContextType);
if (NULL == grContext) {
- return;
+ return false;
}
GrTextureDesc desc;
@@ -295,6 +295,7 @@
blur_path(&canvas, path, gaussianSigma);
readback(&canvas, result, resultCount);
+ return true;
}
#endif
@@ -355,7 +356,7 @@
cpu_blur_path(rectPath, sigma, rectSpecialCaseResult, kSize);
cpu_blur_path(polyPath, sigma, generalCaseResult, kSize);
#if SK_SUPPORT_GPU
- gpu_blur_path(factory, rectPath, sigma, gpuResult, kSize);
+ bool haveGPUResult = gpu_blur_path(factory, rectPath, sigma, gpuResult, kSize);
#endif
ground_truth_2d(100, 100, sigma, groundTruthResult, kSize);
brute_force_1d(-50.0f, 50.0f, sigma, bruteForce1DResult, kSize);
@@ -363,8 +364,10 @@
REPORTER_ASSERT(reporter, match(rectSpecialCaseResult, bruteForce1DResult, kSize, 5));
REPORTER_ASSERT(reporter, match(generalCaseResult, bruteForce1DResult, kSize, 15));
#if SK_SUPPORT_GPU
- // 1 works everywhere but: Ubuntu13 & Nexus4
- REPORTER_ASSERT(reporter, match(gpuResult, bruteForce1DResult, kSize, 10));
+ if (haveGPUResult) {
+ // 1 works everywhere but: Ubuntu13 & Nexus4
+ REPORTER_ASSERT(reporter, match(gpuResult, bruteForce1DResult, kSize, 10));
+ }
#endif
REPORTER_ASSERT(reporter, match(groundTruthResult, bruteForce1DResult, kSize, 1));
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp
index 30e469b..e15bd5a 100644
--- a/tests/FontHostStreamTest.cpp
+++ b/tests/FontHostStreamTest.cpp
@@ -15,6 +15,7 @@
#include "SkPaint.h"
#include "SkPoint.h"
#include "SkRect.h"
+#include "SkStream.h"
#include "SkTypeface.h"
///////////////////////////////////////////////////////////////////////////////
@@ -99,7 +100,7 @@
}
int ttcIndex;
- SkStream* fontData = origTypeface->openStream(&ttcIndex);
+ SkAutoTUnref<SkStream> fontData(origTypeface->openStream(&ttcIndex));
SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData);
SkSafeUnref(paint.setTypeface(streamTypeface));
drawBG(&streamCanvas);
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 0722d14..2328627 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -130,11 +130,12 @@
// 3 ) large negative specular exponent value
SkScalar specularExponent = SkFloatToScalar(-1000);
+ SkAutoTUnref<SkImageFilter> bmSrc(new SkBitmapSource(bitmap));
SkPaint paint;
paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(
location, target, specularExponent, SkFloatToScalar(180),
0xFFFFFFFF, SK_Scalar1, SK_Scalar1, SK_Scalar1,
- new SkBitmapSource(bitmap)))->unref();
+ bmSrc))->unref();
SkCanvas canvas(result);
SkRect r = SkRect::MakeWH(SkIntToScalar(kBitmapSize),
SkIntToScalar(kBitmapSize));
@@ -144,9 +145,9 @@
{
// This tests for scale bringing width to 0
SkSize scale = SkSize::Make(SkFloatToScalar(-0.001f), SK_Scalar1);
+ SkAutoTUnref<SkImageFilter> bmSrc(new SkBitmapSource(bitmap));
SkAutoTUnref<SkBicubicImageFilter> bicubic(
- SkBicubicImageFilter::CreateMitchell(
- scale, new SkBitmapSource(bitmap)));
+ SkBicubicImageFilter::CreateMitchell(scale, bmSrc));
SkBitmapDevice device(bitmap);
SkDeviceImageFilterProxy proxy(&device);
SkIPoint loc = SkIPoint::Make(0, 0);
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
index 4e13e97..075134a 100644
--- a/tests/valgrind.supp
+++ b/tests/valgrind.supp
@@ -60,10 +60,19 @@
fun:_mesa_ReadnPixelsARB
fun:_mesa_ReadPixels
}
-{
- XOpenDisplay_Leak
+{
+ XOpenDisplay_Leak
+ Memcheck:Leak
+ fun:calloc
+ fun:_XConnectXCB
+ fun:XOpenDisplay
+}
+{
+ XOpenDisplay_Leak2
Memcheck:Leak
fun:calloc
+ fun:xcb_connect_to_fd
+ fun:xcb_connect_to_display_with_auth_info
fun:_XConnectXCB
- fun:XOpenDisplay
-}
+ fun:XOpenDisplay
+}