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

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

Issue 1783823002: Generic 4f gradient T sampler fallback (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 4 years, 9 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 "Sk4fLinearGradient.h" 8 #include "Sk4fLinearGradient.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 matrix.setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY); 44 matrix.setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY);
45 matrix.postTranslate(-pts[0].fX, -pts[0].fY); 45 matrix.postTranslate(-pts[0].fX, -pts[0].fY);
46 matrix.postScale(inv, inv); 46 matrix.postScale(inv, inv);
47 return matrix; 47 return matrix;
48 } 48 }
49 49
50 static bool use_4f_context(const SkShader::ContextRec& rec, uint32_t flags) { 50 static bool use_4f_context(const SkShader::ContextRec& rec, uint32_t flags) {
51 #ifdef FORCE_4F_CONTEXT 51 #ifdef FORCE_4F_CONTEXT
52 return true; 52 return true;
53 #else 53 #else
54 // Perspective not supported in 4f yet.
55 if (rec.fMatrix->hasPerspective()
56 || (rec.fLocalMatrix && rec.fLocalMatrix->hasPerspective())) {
57 return false;
58 }
59
60 return rec.fPreferredDstType == SkShader::ContextRec::kPM4f_DstType 54 return rec.fPreferredDstType == SkShader::ContextRec::kPM4f_DstType
61 || SkToBool(flags & SkLinearGradient::kForce4fContext_PrivateFlag); 55 || SkToBool(flags & SkLinearGradient::kForce4fContext_PrivateFlag);
62 #endif 56 #endif
63 } 57 }
64 58
65 /////////////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////////////
66 60
67 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc) 61 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc)
68 : SkGradientShaderBase(desc, pts_to_unit_matrix(pts)) 62 : SkGradientShaderBase(desc, pts_to_unit_matrix(pts))
69 , fStart(pts[0]) 63 , fStart(pts[0])
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r); 754 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r);
761 } 755 }
762 } else { 756 } else {
763 if (fApplyAlphaAfterInterp) { 757 if (fApplyAlphaAfterInterp) {
764 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 758 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
765 } else { 759 } else {
766 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 760 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
767 } 761 }
768 } 762 }
769 } 763 }
OLDNEW
« src/effects/gradients/Sk4fGradientBase.cpp ('K') | « src/effects/gradients/Sk4fLinearGradient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698