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

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

Issue 291913004: formalize named picture versions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkTwoPointConicalGradient.h" 8 #include "SkTwoPointConicalGradient.h"
9 9
10 #include "SkTwoPointConicalGradient_gpu.h" 10 #include "SkTwoPointConicalGradient_gpu.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return kConical_GradientType; 344 return kConical_GradientType;
345 } 345 }
346 346
347 SkTwoPointConicalGradient::SkTwoPointConicalGradient( 347 SkTwoPointConicalGradient::SkTwoPointConicalGradient(
348 SkReadBuffer& buffer) 348 SkReadBuffer& buffer)
349 : INHERITED(buffer), 349 : INHERITED(buffer),
350 fCenter1(buffer.readPoint()), 350 fCenter1(buffer.readPoint()),
351 fCenter2(buffer.readPoint()), 351 fCenter2(buffer.readPoint()),
352 fRadius1(buffer.readScalar()), 352 fRadius1(buffer.readScalar()),
353 fRadius2(buffer.readScalar()) { 353 fRadius2(buffer.readScalar()) {
354 if (buffer.pictureVersion() >= 24 || 0 == buffer.pictureVersion()) { 354 if (buffer.isVersionLT(SkReadBuffer::kGradientFlippedFlag_Version)) {
355 fFlippedGrad = buffer.readBool();
356 } else {
357 // V23_COMPATIBILITY_CODE 355 // V23_COMPATIBILITY_CODE
358 // Sort gradient by radius size for old pictures 356 // Sort gradient by radius size for old pictures
359 if (fRadius2 < fRadius1) { 357 if (fRadius2 < fRadius1) {
360 SkTSwap(fCenter1, fCenter2); 358 SkTSwap(fCenter1, fCenter2);
361 SkTSwap(fRadius1, fRadius2); 359 SkTSwap(fRadius1, fRadius2);
362 this->flipGradientColors(); 360 this->flipGradientColors();
363 fFlippedGrad = true; 361 fFlippedGrad = true;
364 } else { 362 } else {
365 fFlippedGrad = false; 363 fFlippedGrad = false;
366 } 364 }
365 } else {
366 fFlippedGrad = buffer.readBool();
367 } 367 }
368 this->init(); 368 this->init();
369 }; 369 };
370 370
371 void SkTwoPointConicalGradient::flatten( 371 void SkTwoPointConicalGradient::flatten(
372 SkWriteBuffer& buffer) const { 372 SkWriteBuffer& buffer) const {
373 this->INHERITED::flatten(buffer); 373 this->INHERITED::flatten(buffer);
374 buffer.writePoint(fCenter1); 374 buffer.writePoint(fCenter1);
375 buffer.writePoint(fCenter2); 375 buffer.writePoint(fCenter2);
376 buffer.writeScalar(fRadius1); 376 buffer.writeScalar(fRadius1);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 str->appendScalar(fCenter2.fY); 416 str->appendScalar(fCenter2.fY);
417 str->append(") radius2: "); 417 str->append(") radius2: ");
418 str->appendScalar(fRadius2); 418 str->appendScalar(fRadius2);
419 str->append(" "); 419 str->append(" ");
420 420
421 this->INHERITED::toString(str); 421 this->INHERITED::toString(str);
422 422
423 str->append(")"); 423 str->append(")");
424 } 424 }
425 #endif 425 #endif
OLDNEW
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698