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

Side by Side Diff: gm/constcolorprocessor.cpp

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused inheriteds to satisfy clang Created 5 years, 2 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 | « no previous file | 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 "SkGrPriv.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(sk_tool_utils::color_to_565(0xFFDDDDDD)); 28 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return; 97 return;
98 } 98 }
99 99
100 GrPaint grPaint; 100 GrPaint grPaint;
101 SkPaint skPaint; 101 SkPaint skPaint;
102 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { 102 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
103 skPaint.setShader(fShader); 103 skPaint.setShader(fShader);
104 } else { 104 } else {
105 skPaint.setColor(kPaintColors[paintType]); 105 skPaint.setColor(kPaintColors[paintType]);
106 } 106 }
107 SkAssertResult(SkPaint2GrPaint(context, skPaint, viewMatrix, false, &grPaint)); 107 SkAssertResult(SkPaintToGrPaint(context, skPaint, viewMatrix , &grPaint));
108 108
109 GrConstColorProcessor::InputMode mode = (GrConstColorProcess or::InputMode) m; 109 GrConstColorProcessor::InputMode mode = (GrConstColorProcess or::InputMode) m;
110 GrColor color = kColors[procColor]; 110 GrColor color = kColors[procColor];
111 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor:: Create(color, mode)); 111 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor:: Create(color, mode));
112 112
113 GrClip clip; 113 GrClip clip;
114 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip); 114 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
115 pipelineBuilder.addColorFragmentProcessor(fp); 115 pipelineBuilder.addColorFragmentProcessor(fp);
116 116
117 tt.target()->drawNonAARect(pipelineBuilder, 117 tt.target()->drawNonAARect(pipelineBuilder,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 typedef GM INHERITED; 188 typedef GM INHERITED;
189 }; 189 };
190 190
191 const SkScalar ConstColorProcessor::kPad = 10.f; 191 const SkScalar ConstColorProcessor::kPad = 10.f;
192 const SkScalar ConstColorProcessor::kRectSize = 20.f; 192 const SkScalar ConstColorProcessor::kRectSize = 20.f;
193 193
194 DEF_GM(return new ConstColorProcessor;) 194 DEF_GM(return new ConstColorProcessor;)
195 } 195 }
196 196
197 #endif 197 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/dcshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698