aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/BlurTest.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-12-01 04:35:26 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-01 04:35:26 -0800
commit1530283c483cb88aa725bce50a6d193dd00ee570 (patch)
treec34d73ac28d83690a4cbf1196854176677e07366 /tests/BlurTest.cpp
parent362c900625dc2ece854678455776b711c1e44c04 (diff)
Generate list of GPU contexts outside tests
Use DEF_GPUTEST_FOR_*_CONTEXT macros to obtain the test GPU context. Makes changing the context -related classes easier, since not all tests need to be changed. BUG=skia:2992 Review URL: https://codereview.chromium.org/1448873002
Diffstat (limited to 'tests/BlurTest.cpp')
-rw-r--r--tests/BlurTest.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 89f3a0a5cf..f5bb215065 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -99,8 +99,7 @@ static bool compare(const SkBitmap& ref, const SkIRect& iref,
return true;
}
-static void test_blur_drawing(skiatest::Reporter* reporter) {
-
+DEF_TEST(BlurDrawing, reporter) {
SkPaint paint;
paint.setColor(SK_ColorGRAY);
paint.setStyle(SkPaint::kStroke_Style);
@@ -276,15 +275,9 @@ static void cpu_blur_path(const SkPath& path, SkScalar gaussianSigma,
#if SK_SUPPORT_GPU
#if 0
// temporary disable; see below for explanation
-static bool gpu_blur_path(GrContextFactory* factory, const SkPath& path,
+static bool gpu_blur_path(GrContext* context, const SkPath& path,
SkScalar gaussianSigma,
int* result, int resultCount) {
-
- GrContext* grContext = factory->get(GrContextFactory::kNative_GLContextType);
- if (nullptr == grContext) {
- return false;
- }
-
GrSurfaceDesc desc;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
@@ -326,8 +319,7 @@ static bool match(int* first, int* second, int count, int tol) {
}
// Test out the normal blur style with a wide range of sigmas
-static void test_sigma_range(skiatest::Reporter* reporter, GrContextFactory* factory) {
-
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurSigmaRange, reporter, context) {
static const int kSize = 100;
// The geometry is offset a smidge to trigger:
@@ -365,7 +357,7 @@ static void test_sigma_range(skiatest::Reporter* reporter, GrContextFactory* fac
#if SK_SUPPORT_GPU
#if 0
int gpuResult[kSize];
- bool haveGPUResult = gpu_blur_path(factory, rectPath, sigma, gpuResult, kSize);
+ bool haveGPUResult = gpu_blur_path(context, rectPath, sigma, gpuResult, kSize);
// Disabling this test for now -- I don't think it's a legit comparison.
// Will continue to investigate this.
if (haveGPUResult) {
@@ -507,7 +499,7 @@ static void test_layerDrawLooper(skiatest::Reporter* reporter, SkMaskFilter* mf,
test_delete_looper(reporter, builder.detachLooper(), sigma, style, quality, false);
}
-static void test_asABlur(skiatest::Reporter* reporter) {
+DEF_TEST(BlurAsABlur, reporter) {
const SkBlurStyle styles[] = {
kNormal_SkBlurStyle, kSolid_SkBlurStyle, kOuter_SkBlurStyle, kInner_SkBlurStyle
};
@@ -566,9 +558,3 @@ static void test_asABlur(skiatest::Reporter* reporter) {
}
///////////////////////////////////////////////////////////////////////////////////////////
-
-DEF_GPUTEST(Blur, reporter, factory) {
- test_blur_drawing(reporter);
- test_sigma_range(reporter, factory);
- test_asABlur(reporter);
-}