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

Side by Side Diff: gm/constcolorprocessor.cpp

Issue 2182603003: Just pass the draw context to paint conversion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 5 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 | include/gpu/GrDrawContext.h » ('j') | src/gpu/text/GrAtlasTextContext.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, nullptr, 103 SkAssertResult(SkPaintToGrPaint(context, drawContext, skPain t, viewMatrix,
104 &grPaint)); 104 &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 sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(co lor, mode)); 108 sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(co lor, mode));
109 109
110 grPaint.addColorFragmentProcessor(std::move(fp)); 110 grPaint.addColorFragmentProcessor(std::move(fp));
111 111
112 SkAutoTUnref<GrDrawBatch> batch( 112 SkAutoTUnref<GrDrawBatch> batch(
113 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor (), viewMatrix, 113 GrRectBatchFactory::CreateNonAAFill(grPaint.getColor (), viewMatrix,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 typedef GM INHERITED; 183 typedef GM INHERITED;
184 }; 184 };
185 185
186 const SkScalar ConstColorProcessor::kPad = 10.f; 186 const SkScalar ConstColorProcessor::kPad = 10.f;
187 const SkScalar ConstColorProcessor::kRectSize = 20.f; 187 const SkScalar ConstColorProcessor::kRectSize = 20.f;
188 188
189 DEF_GM(return new ConstColorProcessor;) 189 DEF_GM(return new ConstColorProcessor;)
190 } 190 }
191 191
192 #endif 192 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrDrawContext.h » ('j') | src/gpu/text/GrAtlasTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698