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

Side by Side Diff: fuzz/FilterFuzz.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 | « bench/EncoderBench.cpp ('k') | fuzz/Fuzz.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 "Fuzz.h" 7 #include "Fuzz.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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 break; 727 break;
728 } 728 }
729 default: 729 default:
730 break; 730 break;
731 } 731 }
732 return (filter || canBeNull) ? filter : make_image_filter(canBeNull); 732 return (filter || canBeNull) ? filter : make_image_filter(canBeNull);
733 } 733 }
734 734
735 static SkImageFilter* make_serialized_image_filter() { 735 static SkImageFilter* make_serialized_image_filter() {
736 sk_sp<SkImageFilter> filter(make_image_filter(false)); 736 sk_sp<SkImageFilter> filter(make_image_filter(false));
737 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(filter.get())); 737 sk_sp<SkData> data(SkValidatingSerializeFlattenable(filter.get()));
738 const unsigned char* ptr = static_cast<const unsigned char*>(data->data()); 738 const unsigned char* ptr = static_cast<const unsigned char*>(data->data());
739 size_t len = data->size(); 739 size_t len = data->size();
740 #ifdef SK_ADD_RANDOM_BIT_FLIPS 740 #ifdef SK_ADD_RANDOM_BIT_FLIPS
741 unsigned char* p = const_cast<unsigned char*>(ptr); 741 unsigned char* p = const_cast<unsigned char*>(ptr);
742 for (size_t i = 0; i < len; ++i, ++p) { 742 for (size_t i = 0; i < len; ++i, ++p) {
743 if (R(250) == 1) { // 0.4% of the time, flip a bit or byte 743 if (R(250) == 1) { // 0.4% of the time, flip a bit or byte
744 if (R(10) == 1) { // Then 10% of the time, change a whole byte 744 if (R(10) == 1) { // Then 10% of the time, change a whole byte
745 switch(R(3)) { 745 switch(R(3)) {
746 case 0: 746 case 0:
747 *p ^= 0xFF; // Flip entire byte 747 *p ^= 0xFF; // Flip entire byte
(...skipping 27 matching lines...) Expand all
775 DEF_FUZZ(SerializedImageFilter, f) { 775 DEF_FUZZ(SerializedImageFilter, f) {
776 fuzz = f; 776 fuzz = f;
777 SkImageFilter* filter = make_serialized_image_filter(); 777 SkImageFilter* filter = make_serialized_image_filter();
778 778
779 SkPaint paint; 779 SkPaint paint;
780 SkSafeUnref(paint.setImageFilter(filter)); 780 SkSafeUnref(paint.setImageFilter(filter));
781 SkBitmap bitmap; 781 SkBitmap bitmap;
782 SkCanvas canvas(bitmap); 782 SkCanvas canvas(bitmap);
783 drawClippedBitmap(&canvas, 0, 0, paint); 783 drawClippedBitmap(&canvas, 0, 0, paint);
784 } 784 }
OLDNEW
« no previous file with comments | « bench/EncoderBench.cpp ('k') | fuzz/Fuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698