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

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

Issue 71303003: fix general-pespective for conical gradient bug=1744 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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 static int valid_divide(float numer, float denom, float* ratio) { 10 static int valid_divide(float numer, float denom, float* ratio) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 dy = SkFixedToScalar(fixedY); 229 dy = SkFixedToScalar(fixedY);
230 } else { 230 } else {
231 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); 231 SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
232 dx = fDstToIndex.getScaleX(); 232 dx = fDstToIndex.getScaleX();
233 dy = fDstToIndex.getSkewY(); 233 dy = fDstToIndex.getSkewY();
234 } 234 }
235 235
236 fRec.setup(fx, fy, dx, dy); 236 fRec.setup(fx, fy, dx, dy);
237 (*shadeProc)(&fRec, dstC, cache, toggle, count); 237 (*shadeProc)(&fRec, dstC, cache, toggle, count);
238 } else { // perspective case 238 } else { // perspective case
239 SkScalar dstX = SkIntToScalar(x); 239 SkScalar dstX = SkIntToScalar(x) + SK_ScalarHalf;
240 SkScalar dstY = SkIntToScalar(y); 240 SkScalar dstY = SkIntToScalar(y) + SK_ScalarHalf;
241 for (; count > 0; --count) { 241 for (; count > 0; --count) {
242 SkPoint srcPt; 242 SkPoint srcPt;
243 dstProc(fDstToIndex, dstX, dstY, &srcPt); 243 dstProc(fDstToIndex, dstX, dstY, &srcPt);
244 dstX += SK_Scalar1;
245
246 fRec.setup(srcPt.fX, srcPt.fY, 0, 0); 244 fRec.setup(srcPt.fX, srcPt.fY, 0, 0);
247 (*shadeProc)(&fRec, dstC, cache, toggle, 1); 245 (*shadeProc)(&fRec, dstC, cache, toggle, 1);
246
247 dstX += SK_Scalar1;
248 toggle = next_dither_toggle(toggle); 248 toggle = next_dither_toggle(toggle);
249 dstC += 1;
249 } 250 }
250 } 251 }
251 } 252 }
252 253
253 bool SkTwoPointConicalGradient::setContext(const SkBitmap& device, 254 bool SkTwoPointConicalGradient::setContext(const SkBitmap& device,
254 const SkPaint& paint, 255 const SkPaint& paint,
255 const SkMatrix& matrix) { 256 const SkMatrix& matrix) {
256 if (!this->INHERITED::setContext(device, paint, matrix)) { 257 if (!this->INHERITED::setContext(device, paint, matrix)) {
257 return false; 258 return false;
258 } 259 }
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 str->appendScalar(fCenter2.fY); 728 str->appendScalar(fCenter2.fY);
728 str->append(") radius2: "); 729 str->append(") radius2: ");
729 str->appendScalar(fRadius2); 730 str->appendScalar(fRadius2);
730 str->append(" "); 731 str->append(" ");
731 732
732 this->INHERITED::toString(str); 733 this->INHERITED::toString(str);
733 734
734 str->append(")"); 735 str->append(")");
735 } 736 }
736 #endif 737 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698