| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 GrSurfaceDesc desc; | 25 GrSurfaceDesc desc; |
| 26 | 26 |
| 27 // let Skia know we will be using this texture as a render target | 27 // let Skia know we will be using this texture as a render target |
| 28 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 28 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 29 desc.fConfig = kSkia8888_GrPixelConfig; | 29 desc.fConfig = kSkia8888_GrPixelConfig; |
| 30 desc.fWidth = X_SIZE; | 30 desc.fWidth = X_SIZE; |
| 31 desc.fHeight = Y_SIZE; | 31 desc.fHeight = Y_SIZE; |
| 32 | 32 |
| 33 // We are initializing the texture with zeros here | 33 // We are initializing the texture with zeros here |
| 34 GrTexture* texture = context->createUncachedTexture(desc, textureData, 0); | 34 GrTexture* texture = context->createTexture(desc, false, textureData, 0); |
| 35 if (!texture) { | 35 if (!texture) { |
| 36 return NULL; | 36 return NULL; |
| 37 } | 37 } |
| 38 | 38 |
| 39 return texture; | 39 return texture; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped | 42 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped |
| 43 // to the render target | 43 // to the render target |
| 44 static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { | 44 static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { |
| 45 | 45 |
| 46 static const int kXSize = 100; | 46 static const int kXSize = 100; |
| 47 static const int kYSize = 100; | 47 static const int kYSize = 100; |
| 48 | 48 |
| 49 GrSurfaceDesc desc; | 49 GrSurfaceDesc desc; |
| 50 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 50 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 51 desc.fConfig = kAlpha_8_GrPixelConfig; | 51 desc.fConfig = kAlpha_8_GrPixelConfig; |
| 52 desc.fWidth = kXSize; | 52 desc.fWidth = kXSize; |
| 53 desc.fHeight = kYSize; | 53 desc.fHeight = kYSize; |
| 54 | 54 |
| 55 GrTexture* texture = context->createUncachedTexture(desc, NULL, 0); | 55 GrTexture* texture = context->createTexture(desc, false, NULL, 0); |
| 56 if (!texture) { | 56 if (!texture) { |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 SkAutoTUnref<GrTexture> au(texture); | 60 SkAutoTUnref<GrTexture> au(texture); |
| 61 | 61 |
| 62 SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize); | 62 SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize); |
| 63 SkRect screen; | 63 SkRect screen; |
| 64 | 64 |
| 65 screen = SkRect::MakeWH(SkIntToScalar(kXSize), | 65 screen = SkRect::MakeWH(SkIntToScalar(kXSize), |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (NULL == context) { | 224 if (NULL == context) { |
| 225 continue; | 225 continue; |
| 226 } | 226 } |
| 227 | 227 |
| 228 test_cache(reporter, context); | 228 test_cache(reporter, context); |
| 229 test_clip_bounds(reporter, context); | 229 test_clip_bounds(reporter, context); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 #endif | 233 #endif |
| OLD | NEW |