| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SkRect renderRect = SkRect::MakeXYWH(0, 0, kRectSize, kRectS
ize); | 93 SkRect renderRect = SkRect::MakeXYWH(0, 0, kRectSize, kRectS
ize); |
| 94 | 94 |
| 95 GrPaint grPaint; | 95 GrPaint grPaint; |
| 96 SkPaint skPaint; | 96 SkPaint skPaint; |
| 97 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { | 97 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { |
| 98 skPaint.setShader(fShader); | 98 skPaint.setShader(fShader); |
| 99 } else { | 99 } else { |
| 100 skPaint.setColor(kPaintColors[paintType]); | 100 skPaint.setColor(kPaintColors[paintType]); |
| 101 } | 101 } |
| 102 // SRGBTODO: No sRGB inputs allowed here? | 102 // SRGBTODO: No sRGB inputs allowed here? |
| 103 SkAssertResult(SkPaintToGrPaint(context, skPaint, viewMatrix
, false, &grPaint)); | 103 SkAssertResult(SkPaintToGrPaint(context, skPaint, viewMatrix
, false, nullptr, |
| 104 &grPaint)); |
| 104 | 105 |
| 105 GrConstColorProcessor::InputMode mode = (GrConstColorProcess
or::InputMode) m; | 106 GrConstColorProcessor::InputMode mode = (GrConstColorProcess
or::InputMode) m; |
| 106 GrColor color = kColors[procColor]; | 107 GrColor color = kColors[procColor]; |
| 107 sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(co
lor, mode)); | 108 sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(co
lor, mode)); |
| 108 | 109 |
| 109 grPaint.addColorFragmentProcessor(std::move(fp)); | 110 grPaint.addColorFragmentProcessor(std::move(fp)); |
| 110 | 111 |
| 111 SkAutoTUnref<GrDrawBatch> batch( | 112 SkAutoTUnref<GrDrawBatch> batch( |
| 112 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, | 113 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, |
| 113 renderRect, null
ptr, nullptr)); | 114 renderRect, null
ptr, nullptr)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 typedef GM INHERITED; | 183 typedef GM INHERITED; |
| 183 }; | 184 }; |
| 184 | 185 |
| 185 const SkScalar ConstColorProcessor::kPad = 10.f; | 186 const SkScalar ConstColorProcessor::kPad = 10.f; |
| 186 const SkScalar ConstColorProcessor::kRectSize = 20.f; | 187 const SkScalar ConstColorProcessor::kRectSize = 20.f; |
| 187 | 188 |
| 188 DEF_GM(return new ConstColorProcessor;) | 189 DEF_GM(return new ConstColorProcessor;) |
| 189 } | 190 } |
| 190 | 191 |
| 191 #endif | 192 #endif |
| OLD | NEW |