OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
9 | 9 |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } else { | 100 } else { |
101 skPaint.setColor(kPaintColors[paintType]); | 101 skPaint.setColor(kPaintColors[paintType]); |
102 } | 102 } |
103 // SRGBTODO: No sRGB inputs allowed here? | 103 // SRGBTODO: No sRGB inputs allowed here? |
104 SkAssertResult(SkPaintToGrPaint(context, skPaint, viewMatrix
, false, &grPaint)); | 104 SkAssertResult(SkPaintToGrPaint(context, skPaint, viewMatrix
, false, &grPaint)); |
105 | 105 |
106 GrConstColorProcessor::InputMode mode = (GrConstColorProcess
or::InputMode) m; | 106 GrConstColorProcessor::InputMode mode = (GrConstColorProcess
or::InputMode) m; |
107 GrColor color = kColors[procColor]; | 107 GrColor color = kColors[procColor]; |
108 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor::
Create(color, mode)); | 108 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor::
Create(color, mode)); |
109 | 109 |
110 GrClip clip; | 110 GrPipelineBuilder pipelineBuilder(grPaint, drawContext->acce
ssRenderTarget()); |
111 GrPipelineBuilder pipelineBuilder(grPaint, | |
112 drawContext->accessRenderT
arget(), | |
113 clip); | |
114 pipelineBuilder.addColorFragmentProcessor(fp); | 111 pipelineBuilder.addColorFragmentProcessor(fp); |
115 | 112 |
116 SkAutoTUnref<GrDrawBatch> batch( | 113 SkAutoTUnref<GrDrawBatch> batch( |
117 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, | 114 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, |
118 renderRect, null
ptr, nullptr)); | 115 renderRect, null
ptr, nullptr)); |
119 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); | 116 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); |
120 | 117 |
121 // Draw labels for the input to the processor and the proces
sor to the right of | 118 // Draw labels for the input to the processor and the proces
sor to the right of |
122 // the test rect. The input label appears above the processo
r label. | 119 // the test rect. The input label appears above the processo
r label. |
123 SkPaint labelPaint; | 120 SkPaint labelPaint; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 typedef GM INHERITED; | 184 typedef GM INHERITED; |
188 }; | 185 }; |
189 | 186 |
190 const SkScalar ConstColorProcessor::kPad = 10.f; | 187 const SkScalar ConstColorProcessor::kPad = 10.f; |
191 const SkScalar ConstColorProcessor::kRectSize = 20.f; | 188 const SkScalar ConstColorProcessor::kRectSize = 20.f; |
192 | 189 |
193 DEF_GM(return new ConstColorProcessor;) | 190 DEF_GM(return new ConstColorProcessor;) |
194 } | 191 } |
195 | 192 |
196 #endif | 193 #endif |
OLD | NEW |