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

Side by Side Diff: gm/constcolorprocessor.cpp

Issue 1176243006: make gm background colors 565 compatible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert bitmap test changes -- only need to change font Created 5 years, 6 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/complexclip3.cpp ('k') | gm/dcshader.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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
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 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
11 #include "gm.h" 11 #include "gm.h"
12 12
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 14
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrTest.h" 16 #include "GrTest.h"
17 #include "effects/GrConstColorProcessor.h" 17 #include "effects/GrConstColorProcessor.h"
18 #include "SkGr.h" 18 #include "SkGr.h"
19 #include "SkGradientShader.h" 19 #include "SkGradientShader.h"
20 20
21 namespace skiagm { 21 namespace skiagm {
22 /** 22 /**
23 * This GM directly exercises GrConstColorProcessor. 23 * This GM directly exercises GrConstColorProcessor.
24 */ 24 */
25 class ConstColorProcessor : public GM { 25 class ConstColorProcessor : public GM {
26 public: 26 public:
27 ConstColorProcessor() { 27 ConstColorProcessor() {
28 this->setBGColor(0xFFDDDDDD); 28 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
29 } 29 }
30 30
31 protected: 31 protected:
32 SkString onShortName() override { 32 SkString onShortName() override {
33 return SkString("const_color_processor"); 33 return SkString("const_color_processor");
34 } 34 }
35 35
36 SkISize onISize() override { 36 SkISize onISize() override {
37 return SkISize::Make(kWidth, kHeight); 37 return SkISize::Make(kWidth, kHeight);
38 } 38 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 pipelineBuilder.addColorProcessor(fp); 117 pipelineBuilder.addColorProcessor(fp);
118 118
119 tt.target()->drawSimpleRect(&pipelineBuilder, 119 tt.target()->drawSimpleRect(&pipelineBuilder,
120 grPaint.getColor(), 120 grPaint.getColor(),
121 viewMatrix, 121 viewMatrix,
122 renderRect); 122 renderRect);
123 123
124 // Draw labels for the input to the processor and the proces sor to the right of 124 // Draw labels for the input to the processor and the proces sor to the right of
125 // the test rect. The input label appears above the processo r label. 125 // the test rect. The input label appears above the processo r label.
126 SkPaint labelPaint; 126 SkPaint labelPaint;
127 sk_tool_utils::set_portable_typeface_always(&labelPaint);
127 labelPaint.setAntiAlias(true); 128 labelPaint.setAntiAlias(true);
128 labelPaint.setTextSize(10.f); 129 labelPaint.setTextSize(10.f);
129 SkString inputLabel; 130 SkString inputLabel;
130 inputLabel.set("Input: "); 131 inputLabel.set("Input: ");
131 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { 132 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
132 inputLabel.append("gradient"); 133 inputLabel.append("gradient");
133 } else { 134 } else {
134 inputLabel.appendf("0x%08x", kPaintColors[paintType]); 135 inputLabel.appendf("0x%08x", kPaintColors[paintType]);
135 } 136 }
136 SkString procLabel; 137 SkString procLabel;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 typedef GM INHERITED; 190 typedef GM INHERITED;
190 }; 191 };
191 192
192 const SkScalar ConstColorProcessor::kPad = 10.f; 193 const SkScalar ConstColorProcessor::kPad = 10.f;
193 const SkScalar ConstColorProcessor::kRectSize = 20.f; 194 const SkScalar ConstColorProcessor::kRectSize = 20.f;
194 195
195 DEF_GM( return SkNEW(ConstColorProcessor); ) 196 DEF_GM( return SkNEW(ConstColorProcessor); )
196 } 197 }
197 198
198 #endif 199 #endif
OLDNEW
« no previous file with comments | « gm/complexclip3.cpp ('k') | gm/dcshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698