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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { | 98 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { |
99 skPaint.setShader(fShader); | 99 skPaint.setShader(fShader); |
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 sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(co
lor, mode)); |
109 | 109 |
110 GrPipelineBuilder pipelineBuilder(grPaint, drawContext->must
UseHWAA(grPaint)); | 110 GrPipelineBuilder pipelineBuilder(grPaint, drawContext->must
UseHWAA(grPaint)); |
111 pipelineBuilder.addColorFragmentProcessor(fp); | 111 pipelineBuilder.addColorFragmentProcessor(std::move(fp)); |
112 | 112 |
113 SkAutoTUnref<GrDrawBatch> batch( | 113 SkAutoTUnref<GrDrawBatch> batch( |
114 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, | 114 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, |
115 renderRect, null
ptr, nullptr)); | 115 renderRect, null
ptr, nullptr)); |
116 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); | 116 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); |
117 | 117 |
118 // 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 |
119 // 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. |
120 SkPaint labelPaint; | 120 SkPaint labelPaint; |
121 sk_tool_utils::set_portable_typeface(&labelPaint); | 121 sk_tool_utils::set_portable_typeface(&labelPaint); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 typedef GM INHERITED; | 184 typedef GM INHERITED; |
185 }; | 185 }; |
186 | 186 |
187 const SkScalar ConstColorProcessor::kPad = 10.f; | 187 const SkScalar ConstColorProcessor::kPad = 10.f; |
188 const SkScalar ConstColorProcessor::kRectSize = 20.f; | 188 const SkScalar ConstColorProcessor::kRectSize = 20.f; |
189 | 189 |
190 DEF_GM(return new ConstColorProcessor;) | 190 DEF_GM(return new ConstColorProcessor;) |
191 } | 191 } |
192 | 192 |
193 #endif | 193 #endif |
OLD | NEW |