| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 526 } |
| 527 | 527 |
| 528 GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect); | 528 GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect); |
| 529 | 529 |
| 530 // A little bit less than the minimum # uniforms required by DX9SM2 (32). | 530 // A little bit less than the minimum # uniforms required by DX9SM2 (32). |
| 531 // Allows for a 5x5 kernel (or 25x1, for that matter). | 531 // Allows for a 5x5 kernel (or 25x1, for that matter). |
| 532 #define MAX_KERNEL_SIZE 25 | 532 #define MAX_KERNEL_SIZE 25 |
| 533 | 533 |
| 534 GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random, | 534 GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random, |
| 535 GrContext* context, | 535 GrContext* context, |
| 536 const GrDrawTargetCaps&, |
| 536 GrTexture* textures[]) { | 537 GrTexture* textures[]) { |
| 537 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 538 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
| 538 GrEffectUnitTest::kAlphaTextureIdx; | 539 GrEffectUnitTest::kAlphaTextureIdx; |
| 539 int width = random->nextRangeU(1, MAX_KERNEL_SIZE); | 540 int width = random->nextRangeU(1, MAX_KERNEL_SIZE); |
| 540 int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width); | 541 int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width); |
| 541 SkISize kernelSize = SkISize::Make(width, height); | 542 SkISize kernelSize = SkISize::Make(width, height); |
| 542 SkAutoTDeleteArray<SkScalar> kernel(new SkScalar[width * height]); | 543 SkAutoTDeleteArray<SkScalar> kernel(new SkScalar[width * height]); |
| 543 for (int i = 0; i < width * height; i++) { | 544 for (int i = 0; i < width * height; i++) { |
| 544 kernel.get()[i] = random->nextSScalar1(); | 545 kernel.get()[i] = random->nextSScalar1(); |
| 545 } | 546 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 571 fTarget, | 572 fTarget, |
| 572 fTileMode, | 573 fTileMode, |
| 573 fConvolveAlpha); | 574 fConvolveAlpha); |
| 574 } | 575 } |
| 575 return ok; | 576 return ok; |
| 576 } | 577 } |
| 577 | 578 |
| 578 /////////////////////////////////////////////////////////////////////////////// | 579 /////////////////////////////////////////////////////////////////////////////// |
| 579 | 580 |
| 580 #endif | 581 #endif |
| OLD | NEW |