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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 2212493002: Convert SkAutoTUnref<SkData> to sk_sp<SkData>. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « gm/image.cpp ('k') | src/codec/SkCodecImageGenerator.h » ('j') | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "Sk1DPathEffect.h" 8 #include "Sk1DPathEffect.h"
9 #include "Sk2DPathEffect.h" 9 #include "Sk2DPathEffect.h"
10 #include "SkAlphaThresholdFilter.h" 10 #include "SkAlphaThresholdFilter.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 break; 731 break;
732 } 732 }
733 default: 733 default:
734 break; 734 break;
735 } 735 }
736 return (filter || canBeNull) ? filter : make_image_filter(canBeNull); 736 return (filter || canBeNull) ? filter : make_image_filter(canBeNull);
737 } 737 }
738 738
739 static SkImageFilter* make_serialized_image_filter() { 739 static SkImageFilter* make_serialized_image_filter() {
740 sk_sp<SkImageFilter> filter(make_image_filter(false)); 740 sk_sp<SkImageFilter> filter(make_image_filter(false));
741 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(filter.get())); 741 sk_sp<SkData> data(SkValidatingSerializeFlattenable(filter.get()));
742 const unsigned char* ptr = static_cast<const unsigned char*>(data->data()); 742 const unsigned char* ptr = static_cast<const unsigned char*>(data->data());
743 size_t len = data->size(); 743 size_t len = data->size();
744 #ifdef SK_ADD_RANDOM_BIT_FLIPS 744 #ifdef SK_ADD_RANDOM_BIT_FLIPS
745 unsigned char* p = const_cast<unsigned char*>(ptr); 745 unsigned char* p = const_cast<unsigned char*>(ptr);
746 for (size_t i = 0; i < len; ++i, ++p) { 746 for (size_t i = 0; i < len; ++i, ++p) {
747 if (R(250) == 1) { // 0.4% of the time, flip a bit or byte 747 if (R(250) == 1) { // 0.4% of the time, flip a bit or byte
748 if (R(10) == 1) { // Then 10% of the time, change a whole byte 748 if (R(10) == 1) { // Then 10% of the time, change a whole byte
749 switch(R(3)) { 749 switch(R(3)) {
750 case 0: 750 case 0:
751 *p ^= 0xFF; // Flip entire byte 751 *p ^= 0xFF; // Flip entire byte
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 826 }
827 827
828 private: 828 private:
829 typedef SkView INHERITED; 829 typedef SkView INHERITED;
830 }; 830 };
831 831
832 ////////////////////////////////////////////////////////////////////////////// 832 //////////////////////////////////////////////////////////////////////////////
833 833
834 static SkView* MyFactory() { return new ImageFilterFuzzView; } 834 static SkView* MyFactory() { return new ImageFilterFuzzView; }
835 static SkViewRegister reg(MyFactory); 835 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/image.cpp ('k') | src/codec/SkCodecImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698