OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 SkXfermode::kSaturation_Mode, | 147 SkXfermode::kSaturation_Mode, |
148 SkXfermode::kColor_Mode, | 148 SkXfermode::kColor_Mode, |
149 SkXfermode::kLuminosity_Mode, | 149 SkXfermode::kLuminosity_Mode, |
150 }; | 150 }; |
151 | 151 |
152 SkPaint paint; | 152 SkPaint paint; |
153 | 153 |
154 canvas->translate(4, 4); | 154 canvas->translate(4, 4); |
155 int x = 0; | 155 int x = 0; |
156 for (size_t j = 0; j < SK_ARRAY_COUNT(modes); ++j) { | 156 for (size_t j = 0; j < SK_ARRAY_COUNT(modes); ++j) { |
157 SkXfermode* xfer = SkXfermode::Create(modes[j]); | 157 auto xfer = SkXfermode::Make(modes[j]); |
158 canvas->save(); | 158 canvas->save(); |
159 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { | 159 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { |
160 paint.setShader(rec[i].fShader); | 160 paint.setShader(rec[i].fShader); |
161 paint.setColorFilter(rec[i].fColorFilter); | 161 paint.setColorFilter(rec[i].fColorFilter); |
162 paint.setAlpha(rec[i].fAlpha); | 162 paint.setAlpha(rec[i].fAlpha); |
163 //if (2 == x) | 163 //if (2 == x) |
164 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, | 164 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, |
165 SK_ARRAY_COUNT(fPts), fPts, | 165 SK_ARRAY_COUNT(fPts), fPts, |
166 rec[i].fTexs, rec[i].fColors, | 166 rec[i].fTexs, rec[i].fColors, |
167 xfer, fan, SK_ARRAY_COUNT(fan), paint); | 167 xfer, fan, SK_ARRAY_COUNT(fan), paint); |
168 canvas->translate(40, 0); | 168 canvas->translate(40, 0); |
169 ++x; | 169 ++x; |
170 } | 170 } |
171 canvas->restore(); | 171 canvas->restore(); |
172 canvas->translate(0, 40); | 172 canvas->translate(0, 40); |
173 SkSafeUnref(xfer); | |
174 } | 173 } |
175 } | 174 } |
176 | 175 |
177 private: | 176 private: |
178 typedef skiagm::GM INHERITED; | 177 typedef skiagm::GM INHERITED; |
179 }; | 178 }; |
180 | 179 |
181 ////////////////////////////////////////////////////////////////////////////////
///// | 180 ////////////////////////////////////////////////////////////////////////////////
///// |
182 | 181 |
183 DEF_GM(return new VerticesGM();) | 182 DEF_GM(return new VerticesGM();) |
OLD | NEW |