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

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

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit 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
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | 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 "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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 SkScalar inv = mag ? SkScalarInvert(mag) : 0; 45 SkScalar inv = mag ? SkScalarInvert(mag) : 0;
46 46
47 vec.scale(inv); 47 vec.scale(inv);
48 matrix->setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY); 48 matrix->setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY);
49 matrix->postTranslate(-pts[0].fX, -pts[0].fY); 49 matrix->postTranslate(-pts[0].fX, -pts[0].fY);
50 matrix->postScale(inv, inv); 50 matrix->postScale(inv, inv);
51 } 51 }
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 const SkMatrix* localMatrix)
57 : SkGradientShaderBase(desc, localMatrix)
57 , fStart(pts[0]) 58 , fStart(pts[0])
58 , fEnd(pts[1]) { 59 , fEnd(pts[1]) {
59 pts_to_unit_matrix(pts, &fPtsToUnit); 60 pts_to_unit_matrix(pts, &fPtsToUnit);
60 } 61 }
61 62
62 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer) 63 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer)
63 : INHERITED(buffer) 64 : INHERITED(buffer)
64 , fStart(buffer.readPoint()) 65 , fStart(buffer.readPoint())
65 , fEnd(buffer.readPoint()) { 66 , fEnd(buffer.readPoint()) {
66 } 67 }
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 str->append("SkLinearGradient ("); 577 str->append("SkLinearGradient (");
577 578
578 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 579 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
579 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 580 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
580 581
581 this->INHERITED::toString(str); 582 this->INHERITED::toString(str);
582 583
583 str->append(")"); 584 str->append(")");
584 } 585 }
585 #endif 586 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698