| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "Test.h" | 9 #include "Test.h" |
| 10 // This is a GR test | 10 // This is a GR test |
| 11 #if SK_SUPPORT_GPU | 11 #if SK_SUPPORT_GPU |
| 12 #include "GrClipMaskManager.h" | 12 #include "GrClipMaskManager.h" |
| 13 #include "GrContextFactory.h" | 13 #include "GrContext.h" |
| 14 #include "SkGpuDevice.h" | |
| 15 | 14 |
| 16 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped | 15 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped |
| 17 // to the render target | 16 // to the render target |
| 18 static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { | 17 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, context) { |
| 19 | |
| 20 static const int kXSize = 100; | 18 static const int kXSize = 100; |
| 21 static const int kYSize = 100; | 19 static const int kYSize = 100; |
| 22 | 20 |
| 23 GrSurfaceDesc desc; | 21 GrSurfaceDesc desc; |
| 24 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 22 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 25 desc.fConfig = kAlpha_8_GrPixelConfig; | 23 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 26 desc.fWidth = kXSize; | 24 desc.fWidth = kXSize; |
| 27 desc.fHeight = kYSize; | 25 desc.fHeight = kYSize; |
| 28 | 26 |
| 29 SkAutoTUnref<GrTexture> texture( | 27 SkAutoTUnref<GrTexture> texture( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 SkIRect devGrClipBound; | 59 SkIRect devGrClipBound; |
| 62 clipData.getConservativeBounds(texture, | 60 clipData.getConservativeBounds(texture, |
| 63 &devGrClipBound, | 61 &devGrClipBound, |
| 64 &isIntersectionOfRects); | 62 &isIntersectionOfRects); |
| 65 | 63 |
| 66 // make sure that GrClip is behaving itself | 64 // make sure that GrClip is behaving itself |
| 67 REPORTER_ASSERT(reporter, intScreen == devGrClipBound); | 65 REPORTER_ASSERT(reporter, intScreen == devGrClipBound); |
| 68 REPORTER_ASSERT(reporter, isIntersectionOfRects); | 66 REPORTER_ASSERT(reporter, isIntersectionOfRects); |
| 69 } | 67 } |
| 70 | 68 |
| 71 DEF_GPUTEST(GrClipBounds, reporter, factory) { | |
| 72 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | |
| 73 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); | |
| 74 if (!GrContextFactory::IsRenderingGLContext(glType)) { | |
| 75 continue; | |
| 76 } | |
| 77 GrContext* context = factory->get(glType); | |
| 78 if (nullptr == context) { | |
| 79 continue; | |
| 80 } | |
| 81 test_clip_bounds(reporter, context); | |
| 82 } | |
| 83 } | |
| 84 | |
| 85 #endif | 69 #endif |
| OLD | NEW |