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

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

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify xfermodes, fix SkLayerDrawLooper Created 6 years, 4 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
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 "SkTwoPointRadialGradient.h" 9 #include "SkTwoPointRadialGradient.h"
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 str->append(") radius2: "); 336 str->append(") radius2: ");
337 str->appendScalar(fRadius2); 337 str->appendScalar(fRadius2);
338 str->append(" "); 338 str->append(" ");
339 339
340 this->INHERITED::toString(str); 340 this->INHERITED::toString(str);
341 341
342 str->append(")"); 342 str->append(")");
343 } 343 }
344 #endif 344 #endif
345 345
346 SkTwoPointRadialGradient::SkTwoPointRadialGradient( 346 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
347 SkReadBuffer& buffer) 347 SkTwoPointRadialGradient::SkTwoPointRadialGradient(SkReadBuffer& buffer)
348 : INHERITED(buffer), 348 : INHERITED(buffer),
349 fCenter1(buffer.readPoint()), 349 fCenter1(buffer.readPoint()),
350 fCenter2(buffer.readPoint()), 350 fCenter2(buffer.readPoint()),
351 fRadius1(buffer.readScalar()), 351 fRadius1(buffer.readScalar()),
352 fRadius2(buffer.readScalar()) { 352 fRadius2(buffer.readScalar()) {
353 init(); 353 init();
354 }; 354 };
355 #endif
356
357 SkFlattenable* SkTwoPointRadialGradient::CreateProc(SkReadBuffer& buffer) {
358 DescriptorScope desc;
359 if (!desc.unflatten(buffer)) {
360 return NULL;
361 }
362 const SkPoint c1 = buffer.readPoint();
363 const SkPoint c2 = buffer.readPoint();
364 const SkScalar r1 = buffer.readScalar();
365 const SkScalar r2 = buffer.readScalar();
366 return SkGradientShader::CreateTwoPointRadial(c1, r1, c2, r2, desc.fColors, desc.fPos,
367 desc.fCount, desc.fTileMode, d esc.fGradFlags,
368 desc.fLocalMatrix);
369 }
355 370
356 void SkTwoPointRadialGradient::flatten( 371 void SkTwoPointRadialGradient::flatten(
357 SkWriteBuffer& buffer) const { 372 SkWriteBuffer& buffer) const {
358 this->INHERITED::flatten(buffer); 373 this->INHERITED::flatten(buffer);
359 buffer.writePoint(fCenter1); 374 buffer.writePoint(fCenter1);
360 buffer.writePoint(fCenter2); 375 buffer.writePoint(fCenter2);
361 buffer.writeScalar(fRadius1); 376 buffer.writeScalar(fRadius1);
362 buffer.writeScalar(fRadius2); 377 buffer.writeScalar(fRadius2);
363 } 378 }
364 379
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 #else 720 #else
706 721
707 bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& pa int, 722 bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& pa int,
708 const SkMatrix* localMatrix, GrColor* paintColor, 723 const SkMatrix* localMatrix, GrColor* paintColor,
709 GrEffect** effect) const { 724 GrEffect** effect) const {
710 SkDEBUGFAIL("Should not call in GPU-less build"); 725 SkDEBUGFAIL("Should not call in GPU-less build");
711 return false; 726 return false;
712 } 727 }
713 728
714 #endif 729 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698