aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-14 14:47:56 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-14 14:47:56 +0000
commitcb3b615af712fc71b19b86211c1d083430114d7e (patch)
tree221396d3d49027b45482dfd7cb4bea980c87de53 /tests
parent983c022bffd27f1c30d365f7f34c3e7c152fcfd9 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/BlurTest.cpp13
-rw-r--r--tests/FontHostStreamTest.cpp3
-rw-r--r--tests/ImageFilterTest.cpp7
-rw-r--r--tests/valgrind.supp17
4 files changed, 27 insertions, 13 deletions
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 97e267e5b2..9c40aa791c 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -273,13 +273,13 @@ static void cpu_blur_path(const SkPath& path, SkScalar gaussianSigma,
}
#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 @@ static void gpu_blur_path(GrContextFactory* factory, const SkPath& path,
blur_path(&canvas, path, gaussianSigma);
readback(&canvas, result, resultCount);
+ return true;
}
#endif
@@ -355,7 +356,7 @@ static void test_sigma_range(skiatest::Reporter* reporter, GrContextFactory* fac
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 @@ static void test_sigma_range(skiatest::Reporter* reporter, GrContextFactory* fac
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 30e469b410..e15bd5a355 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 @@ static void test_fontHostStream(skiatest::Reporter* reporter) {
}
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 0722d14153..2328627d7c 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -130,11 +130,12 @@ public:
// 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 @@ public:
{
// 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 4e13e97236..075134a960 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
+}