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

Side by Side Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { 36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const {
37 if (info) { 37 if (info) {
38 commonAsAGradient(info); 38 commonAsAGradient(info);
39 info->fPoint[0] = fCenter; 39 info->fPoint[0] = fCenter;
40 } 40 }
41 return kSweep_GradientType; 41 return kSweep_GradientType;
42 } 42 }
43 43
44 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
45 SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer)
46 : INHERITED(buffer),
47 fCenter(buffer.readPoint()) {
48 }
49 #endif
50
51 SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) { 44 SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
52 DescriptorScope desc; 45 DescriptorScope desc;
53 if (!desc.unflatten(buffer)) { 46 if (!desc.unflatten(buffer)) {
54 return NULL; 47 return NULL;
55 } 48 }
56 const SkPoint center = buffer.readPoint(); 49 const SkPoint center = buffer.readPoint();
57 return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, d esc.fPos, 50 return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, d esc.fPos,
58 desc.fCount, desc.fGradFlags, desc.fLoc alMatrix); 51 desc.fCount, desc.fGradFlags, desc.fLoc alMatrix);
59 } 52 }
60 53
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 coords2D.c_str(), coords2D.c_str()); 280 coords2D.c_str(), coords2D.c_str());
288 } 281 }
289 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); 282 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
290 } 283 }
291 284
292 ///////////////////////////////////////////////////////////////////// 285 /////////////////////////////////////////////////////////////////////
293 286
294 bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& pai nt, 287 bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& pai nt,
295 const SkMatrix* localMatrix, GrColor* paintColor, 288 const SkMatrix* localMatrix, GrColor* paintColor,
296 GrFragmentProcessor** effect) const { 289 GrFragmentProcessor** effect) const {
297 290
298 SkMatrix matrix; 291 SkMatrix matrix;
299 if (!this->getLocalMatrix().invert(&matrix)) { 292 if (!this->getLocalMatrix().invert(&matrix)) {
300 return false; 293 return false;
301 } 294 }
302 if (localMatrix) { 295 if (localMatrix) {
303 SkMatrix inv; 296 SkMatrix inv;
304 if (!localMatrix->invert(&inv)) { 297 if (!localMatrix->invert(&inv)) {
305 return false; 298 return false;
306 } 299 }
307 matrix.postConcat(inv); 300 matrix.postConcat(inv);
308 } 301 }
309 matrix.postConcat(fPtsToUnit); 302 matrix.postConcat(fPtsToUnit);
310 303
311 *effect = GrSweepGradient::Create(context, *this, matrix); 304 *effect = GrSweepGradient::Create(context, *this, matrix);
312 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); 305 *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
313 306
314 return true; 307 return true;
315 } 308 }
316 309
317 #else 310 #else
318 311
319 bool SkSweepGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*, 312 bool SkSweepGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*,
320 GrFragmentProcessor**) const { 313 GrFragmentProcessor**) const {
321 SkDEBUGFAIL("Should not call in GPU-less build"); 314 SkDEBUGFAIL("Should not call in GPU-less build");
322 return false; 315 return false;
323 } 316 }
324 317
325 #endif 318 #endif
326 319
327 #ifndef SK_IGNORE_TO_STRING 320 #ifndef SK_IGNORE_TO_STRING
328 void SkSweepGradient::toString(SkString* str) const { 321 void SkSweepGradient::toString(SkString* str) const {
329 str->append("SkSweepGradient: ("); 322 str->append("SkSweepGradient: (");
330 323
331 str->append("center: ("); 324 str->append("center: (");
332 str->appendScalar(fCenter.fX); 325 str->appendScalar(fCenter.fX);
333 str->append(", "); 326 str->append(", ");
334 str->appendScalar(fCenter.fY); 327 str->appendScalar(fCenter.fY);
335 str->append(") "); 328 str->append(") ");
336 329
337 this->INHERITED::toString(str); 330 this->INHERITED::toString(str);
338 331
339 str->append(")"); 332 str->append(")");
340 } 333 }
341 #endif 334 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698