| OLD | NEW |
| 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 "GrDrawContext.h" | 16 #include "GrDrawContextPriv.h" |
| 17 #include "GrPipelineBuilder.h" | 17 #include "GrPipelineBuilder.h" |
| 18 #include "SkGrPriv.h" | 18 #include "SkGrPriv.h" |
| 19 #include "SkGradientShader.h" | 19 #include "SkGradientShader.h" |
| 20 #include "batches/GrDrawBatch.h" | 20 #include "batches/GrDrawBatch.h" |
| 21 #include "batches/GrRectBatchFactory.h" | 21 #include "batches/GrRectBatchFactory.h" |
| 22 #include "effects/GrConstColorProcessor.h" | 22 #include "effects/GrConstColorProcessor.h" |
| 23 | 23 |
| 24 namespace skiagm { | 24 namespace skiagm { |
| 25 /** | 25 /** |
| 26 * This GM directly exercises GrConstColorProcessor. | 26 * This GM directly exercises GrConstColorProcessor. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 GrColor color = kColors[procColor]; | 111 GrColor color = kColors[procColor]; |
| 112 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor::
Create(color, mode)); | 112 SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor::
Create(color, mode)); |
| 113 | 113 |
| 114 GrClip clip; | 114 GrClip clip; |
| 115 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip); | 115 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip); |
| 116 pipelineBuilder.addColorFragmentProcessor(fp); | 116 pipelineBuilder.addColorFragmentProcessor(fp); |
| 117 | 117 |
| 118 SkAutoTUnref<GrDrawBatch> batch( | 118 SkAutoTUnref<GrDrawBatch> batch( |
| 119 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, | 119 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor
(), viewMatrix, |
| 120 renderRect, null
ptr, nullptr)); | 120 renderRect, null
ptr, nullptr)); |
| 121 drawContext->internal_drawBatch(pipelineBuilder, batch); | 121 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin
eBuilder, batch); |
| 122 | 122 |
| 123 // Draw labels for the input to the processor and the proces
sor to the right of | 123 // Draw labels for the input to the processor and the proces
sor to the right of |
| 124 // the test rect. The input label appears above the processo
r label. | 124 // the test rect. The input label appears above the processo
r label. |
| 125 SkPaint labelPaint; | 125 SkPaint labelPaint; |
| 126 sk_tool_utils::set_portable_typeface(&labelPaint); | 126 sk_tool_utils::set_portable_typeface(&labelPaint); |
| 127 labelPaint.setAntiAlias(true); | 127 labelPaint.setAntiAlias(true); |
| 128 labelPaint.setTextSize(10.f); | 128 labelPaint.setTextSize(10.f); |
| 129 SkString inputLabel; | 129 SkString inputLabel; |
| 130 inputLabel.set("Input: "); | 130 inputLabel.set("Input: "); |
| 131 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { | 131 if (paintType >= SK_ARRAY_COUNT(kPaintColors)) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 typedef GM INHERITED; | 189 typedef GM INHERITED; |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 const SkScalar ConstColorProcessor::kPad = 10.f; | 192 const SkScalar ConstColorProcessor::kPad = 10.f; |
| 193 const SkScalar ConstColorProcessor::kRectSize = 20.f; | 193 const SkScalar ConstColorProcessor::kRectSize = 20.f; |
| 194 | 194 |
| 195 DEF_GM(return new ConstColorProcessor;) | 195 DEF_GM(return new ConstColorProcessor;) |
| 196 } | 196 } |
| 197 | 197 |
| 198 #endif | 198 #endif |
| OLD | NEW |