Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 148593003: fix auto-delete bug that crept in with new fast blur path; is causing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« include/core/SkTemplates.h ('K') | « include/core/SkTemplates.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomai n(); 640 static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomai n();
641 GrCacheID::Key key; 641 GrCacheID::Key key;
642 memset(&key, 0, sizeof(key)); 642 memset(&key, 0, sizeof(key));
643 key.fData32[0] = profile_size; 643 key.fData32[0] = profile_size;
644 key.fData32[1] = width; 644 key.fData32[1] = width;
645 key.fData32[2] = 1; 645 key.fData32[2] = 1;
646 GrCacheID horizontalCacheID(gBlurProfileDomain, key); 646 GrCacheID horizontalCacheID(gBlurProfileDomain, key);
647 647
648 uint8_t *profile = NULL; 648 uint8_t *profile = NULL;
649 SkAutoTDeleteArray<uint8_t> ada(profile); 649 SkAutoTDeleteArray<uint8_t> ada(NULL);
650 650
651 *horizontalScanline = context->findAndRefTexture(texDesc, horizontalCacheID, &params); 651 *horizontalScanline = context->findAndRefTexture(texDesc, horizontalCacheID, &params);
652 652
653 if (NULL == *horizontalScanline) { 653 if (NULL == *horizontalScanline) {
654 654
655 SkBlurMask::ComputeBlurProfile(sigma, &profile); 655 SkBlurMask::ComputeBlurProfile(sigma, &profile);
656 ada.reset(profile);
656 657
657 SkAutoTMalloc<uint8_t> horizontalPixels(width); 658 SkAutoTMalloc<uint8_t> horizontalPixels(width);
658 SkBlurMask::ComputeBlurredScanline(horizontalPixels, profile, width, sig ma); 659 SkBlurMask::ComputeBlurredScanline(horizontalPixels, profile, width, sig ma);
659 660
660 *horizontalScanline = context->createTexture(&params, texDesc, horizonta lCacheID, 661 *horizontalScanline = context->createTexture(&params, texDesc, horizonta lCacheID,
661 horizontalPixels, 0); 662 horizontalPixels, 0);
662 663
663 if (NULL == *horizontalScanline) { 664 if (NULL == *horizontalScanline) {
664 return false; 665 return false;
665 } 666 }
666 } 667 }
667 668
668 texDesc.fWidth = 1; 669 texDesc.fWidth = 1;
669 texDesc.fHeight = height; 670 texDesc.fHeight = height;
670 key.fData32[1] = 1; 671 key.fData32[1] = 1;
671 key.fData32[2] = height; 672 key.fData32[2] = height;
672 GrCacheID verticalCacheID(gBlurProfileDomain, key); 673 GrCacheID verticalCacheID(gBlurProfileDomain, key);
673 674
674 *verticalScanline = context->findAndRefTexture(texDesc, verticalCacheID, &pa rams); 675 *verticalScanline = context->findAndRefTexture(texDesc, verticalCacheID, &pa rams);
675 if (NULL == *verticalScanline) { 676 if (NULL == *verticalScanline) {
676 if (NULL == profile) { 677 if (NULL == profile) {
677 SkBlurMask::ComputeBlurProfile(sigma, &profile); 678 SkBlurMask::ComputeBlurProfile(sigma, &profile);
679 ada.reset(profile);
678 } 680 }
679 681
680 SkAutoTMalloc<uint8_t> verticalPixels(height); 682 SkAutoTMalloc<uint8_t> verticalPixels(height);
681 SkBlurMask::ComputeBlurredScanline(verticalPixels, profile, height, sigm a); 683 SkBlurMask::ComputeBlurredScanline(verticalPixels, profile, height, sigm a);
682 684
683 *verticalScanline = context->createTexture(&params, texDesc, verticalCac heID, 685 *verticalScanline = context->createTexture(&params, texDesc, verticalCac heID,
684 verticalPixels, 0); 686 verticalPixels, 0);
685 687
686 if (NULL == *verticalScanline) { 688 if (NULL == *verticalScanline) {
687 return false; 689 return false;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } else { 895 } else {
894 str->append("None"); 896 str->append("None");
895 } 897 }
896 str->append("))"); 898 str->append("))");
897 } 899 }
898 #endif 900 #endif
899 901
900 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 902 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
901 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 903 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
902 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 904 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« include/core/SkTemplates.h ('K') | « include/core/SkTemplates.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698