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

Side by Side Diff: gm/shallowgradient.cpp

Issue 1262703002: make tests portable by using 565 compatible colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dstreadshuffle text portable gm Created 5 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/rrect.cpp ('k') | gm/simpleaaclip.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 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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 SkString onShortName() override { 46 SkString onShortName() override {
47 return fName; 47 return fName;
48 } 48 }
49 49
50 SkISize onISize() override { 50 SkISize onISize() override {
51 return SkISize::Make(800, 800); 51 return SkISize::Make(800, 800);
52 } 52 }
53 53
54 void onDraw(SkCanvas* canvas) override { 54 void onDraw(SkCanvas* canvas) override {
55 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; 55 const SkColor colors[] = { sk_tool_utils::color_to_565(0xFF555555),
56 sk_tool_utils::color_to_565(0xFF444444) };
56 const int colorCount = SK_ARRAY_COUNT(colors); 57 const int colorCount = SK_ARRAY_COUNT(colors);
57 58
58 SkRect r = { 0, 0, this->width(), this->height() }; 59 SkRect r = { 0, 0, this->width(), this->height() };
59 SkSize size = SkSize::Make(r.width(), r.height()); 60 SkSize size = SkSize::Make(r.width(), r.height());
60 61
61 SkPaint paint; 62 SkPaint paint;
62 paint.setShader(fProc(colors, colorCount, size))->unref(); 63 paint.setShader(fProc(colors, colorCount, size))->unref();
63 canvas->drawRect(r, paint); 64 canvas->drawRect(r, paint);
64 } 65 }
65 66
66 private: 67 private:
67 MakeShaderProc fProc; 68 MakeShaderProc fProc;
68 SkString fName; 69 SkString fName;
69 70
70 typedef skiagm::GM INHERITED; 71 typedef skiagm::GM INHERITED;
71 }; 72 };
72 73
73 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
74 75
75 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) 76 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); )
76 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) 77 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); )
77 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) 78 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); )
78 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) 79 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); )
OLDNEW
« no previous file with comments | « gm/rrect.cpp ('k') | gm/simpleaaclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698