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

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

Issue 2441733002: [Sk4fGradient] Use infinity floats for clamp-mode extreme positions (Closed)
Patch Set: vertical case fix Created 4 years, 2 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/Sk4fGradientBase.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 2016 Google Inc. 2 * Copyright 2016 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 "Sk4fLinearGradient.h" 8 #include "Sk4fLinearGradient.h"
9 #include "Sk4x4f.h" 9 #include "Sk4x4f.h"
10 #include "SkXfermode.h" 10 #include "SkXfermode.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 advX = this->advance_interval(advX); 315 advX = this->advance_interval(advX);
316 } 316 }
317 SkASSERT(advX < fAdvX); 317 SkASSERT(advX < fAdvX);
318 318
319 fCc = fCc + fDcDx * Sk4f(advX); 319 fCc = fCc + fDcDx * Sk4f(advX);
320 fAdvX -= advX; 320 fAdvX -= advX;
321 } 321 }
322 322
323 private: 323 private:
324 void compute_interval_props(SkScalar t) { 324 void compute_interval_props(SkScalar t) {
325 const Sk4f dC = DstTraits<dstType, premul>::load(fInterval->fDc); 325 fZeroRamp = fIsVertical || fInterval->isZeroRamp();
326 fCc = DstTraits<dstType, premul>::load(fInterval->fC0); 326 fCc = DstTraits<dstType, premul>::load(fInterval->fC0);
327 fCc = fCc + dC * Sk4f(t); 327
328 fDcDx = dC * fDx; 328 if (fInterval->isZeroRamp()) {
329 fZeroRamp = fIsVertical || fInterval->isZeroRamp(); 329 fDcDx = 0;
330 } else {
331 const Sk4f dC = DstTraits<dstType, premul>::load(fInterval->fDc);
332 fCc = fCc + dC * Sk4f(t);
333 fDcDx = dC * fDx;
334 }
330 } 335 }
331 336
332 const Interval* next_interval(const Interval* i) const { 337 const Interval* next_interval(const Interval* i) const {
333 SkASSERT(i >= fFirstInterval); 338 SkASSERT(i >= fFirstInterval);
334 SkASSERT(i <= fLastInterval); 339 SkASSERT(i <= fLastInterval);
335 i++; 340 i++;
336 341
337 if (tileMode == kClamp_TileMode) { 342 if (tileMode == kClamp_TileMode) {
338 SkASSERT(i <= fLastInterval); 343 SkASSERT(i <= fLastInterval);
339 return i; 344 return i;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 static_cast<const LinearGradient4fContext*>(state->fCtx); 479 static_cast<const LinearGradient4fContext*>(state->fCtx);
475 480
476 if (ctx->fColorsArePremul) { 481 if (ctx->fColorsArePremul) {
477 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( 482 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>(
478 x, y, dst.writable_addr64(x, y), count); 483 x, y, dst.writable_addr64(x, y), count);
479 } else { 484 } else {
480 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( 485 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>(
481 x, y, dst.writable_addr64(x, y), count); 486 x, y, dst.writable_addr64(x, y), count);
482 } 487 }
483 } 488 }
OLDNEW
« no previous file with comments | « src/effects/gradients/Sk4fGradientBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698