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

Side by Side Diff: gm/gradients.cpp

Issue 2472483002: Sk4fLinearGradient fuzzer fixes (Closed)
Patch Set: GM Created 4 years, 1 month 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 | « no previous file | src/effects/gradients/Sk4fLinearGradient.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 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 "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 #include "SkLinearGradient.h" 10 #include "SkLinearGradient.h"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 canvas->drawRect(SkRect::MakeXYWH(0, 0, 500, 500), p); 912 canvas->drawRect(SkRect::MakeXYWH(0, 0, 500, 500), p);
913 } 913 }
914 914
915 DEF_SIMPLE_GM(gradient_many_stops, canvas, 500, 500) { 915 DEF_SIMPLE_GM(gradient_many_stops, canvas, 500, 500) {
916 draw_many_stops(canvas, 0); 916 draw_many_stops(canvas, 0);
917 } 917 }
918 918
919 DEF_SIMPLE_GM(gradient_many_stops_4f, canvas, 500, 500) { 919 DEF_SIMPLE_GM(gradient_many_stops_4f, canvas, 500, 500) {
920 draw_many_stops(canvas, SkLinearGradient::kForce4fContext_PrivateFlag); 920 draw_many_stops(canvas, SkLinearGradient::kForce4fContext_PrivateFlag);
921 } 921 }
922
923 static void draw_subpixel_gradient(SkCanvas* canvas, uint32_t flags) {
924 const SkPoint pts[] = { {50, 50}, {50.1f, 50.1f}};
925 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
926 SkPaint p;
927 p.setShader(SkGradientShader::MakeLinear(
928 pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kRepeat_TileMode , flags, nullptr));
929 canvas->drawRect(SkRect::MakeXYWH(0, 0, 500, 500), p);
930 }
931
932 DEF_SIMPLE_GM(gradient_subpixel, canvas, 500, 500) {
933 draw_subpixel_gradient(canvas, 0);
934 }
935
936 DEF_SIMPLE_GM(gradient_subpixel_4f, canvas, 500, 500) {
937 draw_subpixel_gradient(canvas, SkLinearGradient::kForce4fContext_PrivateFlag );
938 }
OLDNEW
« no previous file with comments | « no previous file | src/effects/gradients/Sk4fLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698