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

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

Issue 461643002: add localMatrix to gradient Descriptor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« 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 const SkMatrix* localMatrix) 56 : SkGradientShaderBase(desc)
57 : SkGradientShaderBase(desc, localMatrix)
58 , fStart(pts[0]) 57 , fStart(pts[0])
59 , fEnd(pts[1]) { 58 , fEnd(pts[1])
59 {
60 pts_to_unit_matrix(pts, &fPtsToUnit); 60 pts_to_unit_matrix(pts, &fPtsToUnit);
61 } 61 }
62 62
63 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer) 63 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer)
64 : INHERITED(buffer) 64 : INHERITED(buffer)
65 , fStart(buffer.readPoint()) 65 , fStart(buffer.readPoint())
66 , fEnd(buffer.readPoint()) { 66 , fEnd(buffer.readPoint()) {
67 } 67 }
68 68
69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { 69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 str->append("SkLinearGradient ("); 592 str->append("SkLinearGradient (");
593 593
594 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 594 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
595 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 595 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
596 596
597 this->INHERITED::toString(str); 597 this->INHERITED::toString(str);
598 598
599 str->append(")"); 599 str->append(")");
600 } 600 }
601 #endif 601 #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