| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 // This is a GR test | 9 // This is a GR test |
| 10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
| 11 #include "GrClipMaskManager.h" | 11 #include "GrClipMaskManager.h" |
| 12 #include "GrContext.h" | 12 #include "GrContext.h" |
| 13 | 13 |
| 14 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped | 14 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped |
| 15 // to the render target | 15 // to the render target |
| 16 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, context) { | 16 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) { |
| 17 static const int kXSize = 100; | 17 static const int kXSize = 100; |
| 18 static const int kYSize = 100; | 18 static const int kYSize = 100; |
| 19 | 19 |
| 20 GrSurfaceDesc desc; | 20 GrSurfaceDesc desc; |
| 21 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 21 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 22 desc.fConfig = kAlpha_8_GrPixelConfig; | 22 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 23 desc.fWidth = kXSize; | 23 desc.fWidth = kXSize; |
| 24 desc.fHeight = kYSize; | 24 desc.fHeight = kYSize; |
| 25 | 25 |
| 26 SkAutoTUnref<GrTexture> texture( | 26 SkAutoTUnref<GrTexture> texture( |
| 27 context->textureProvider()->createTexture(desc, SkBudgeted::kYes, nullpt
r, 0)); | 27 ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::k
Yes, nullptr, 0)); |
| 28 if (!texture) { | 28 if (!texture) { |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 | 31 |
| 32 SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize); | 32 SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize); |
| 33 SkRect screen = SkRect::Make(intScreen); | 33 SkRect screen = SkRect::Make(intScreen); |
| 34 | 34 |
| 35 SkRect clipRect(screen); | 35 SkRect clipRect(screen); |
| 36 clipRect.outset(10, 10); | 36 clipRect.outset(10, 10); |
| 37 | 37 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 clipData.getConservativeBounds(texture->width(), texture->height(), | 59 clipData.getConservativeBounds(texture->width(), texture->height(), |
| 60 &devGrClipBound, | 60 &devGrClipBound, |
| 61 &isIntersectionOfRects); | 61 &isIntersectionOfRects); |
| 62 | 62 |
| 63 // make sure that GrClip is behaving itself | 63 // make sure that GrClip is behaving itself |
| 64 REPORTER_ASSERT(reporter, intScreen == devGrClipBound); | 64 REPORTER_ASSERT(reporter, intScreen == devGrClipBound); |
| 65 REPORTER_ASSERT(reporter, isIntersectionOfRects); | 65 REPORTER_ASSERT(reporter, isIntersectionOfRects); |
| 66 } | 66 } |
| 67 | 67 |
| 68 #endif | 68 #endif |
| OLD | NEW |