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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine Created 6 years, 10 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 * 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 "SkLinearGradient.h" 8 #include "SkLinearGradient.h"
9 9
10 static inline int repeat_bits(int x, const int bits) { 10 static inline int repeat_bits(int x, const int bits) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 /////////////////////////////////////////////////////////////////////////////// 53 ///////////////////////////////////////////////////////////////////////////////
54 54
55 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc) 55 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc)
56 : SkGradientShaderBase(desc) 56 : SkGradientShaderBase(desc)
57 , fStart(pts[0]) 57 , fStart(pts[0])
58 , fEnd(pts[1]) { 58 , fEnd(pts[1]) {
59 pts_to_unit_matrix(pts, &fPtsToUnit); 59 pts_to_unit_matrix(pts, &fPtsToUnit);
60 } 60 }
61 61
62 SkLinearGradient::SkLinearGradient(SkFlattenableReadBuffer& buffer) 62 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer)
63 : INHERITED(buffer) 63 : INHERITED(buffer)
64 , fStart(buffer.readPoint()) 64 , fStart(buffer.readPoint())
65 , fEnd(buffer.readPoint()) { 65 , fEnd(buffer.readPoint()) {
66 } 66 }
67 67
68 void SkLinearGradient::flatten(SkFlattenableWriteBuffer& buffer) const { 68 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const {
69 this->INHERITED::flatten(buffer); 69 this->INHERITED::flatten(buffer);
70 buffer.writePoint(fStart); 70 buffer.writePoint(fStart);
71 buffer.writePoint(fEnd); 71 buffer.writePoint(fEnd);
72 } 72 }
73 73
74 bool SkLinearGradient::setContext(const SkBitmap& device, const SkPaint& paint, 74 bool SkLinearGradient::setContext(const SkBitmap& device, const SkPaint& paint,
75 const SkMatrix& matrix) { 75 const SkMatrix& matrix) {
76 if (!this->INHERITED::setContext(device, paint, matrix)) { 76 if (!this->INHERITED::setContext(device, paint, matrix)) {
77 return false; 77 return false;
78 } 78 }
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 str->append("SkLinearGradient ("); 561 str->append("SkLinearGradient (");
562 562
563 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 563 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
564 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 564 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
565 565
566 this->INHERITED::toString(str); 566 this->INHERITED::toString(str);
567 567
568 str->append(")"); 568 str->append(")");
569 } 569 }
570 #endif 570 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698