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

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

Issue 1789663002: sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Squelch assert when blurring sRGB 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
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrCaps.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGradientShaderPriv.h" 9 #include "SkGradientShaderPriv.h"
10 #include "SkLinearGradient.h" 10 #include "SkLinearGradient.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialGradient) 898 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialGradient)
899 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSweepGradient) 899 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSweepGradient)
900 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTwoPointConicalGradient) 900 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTwoPointConicalGradient)
901 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 901 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
902 902
903 /////////////////////////////////////////////////////////////////////////////// 903 ///////////////////////////////////////////////////////////////////////////////
904 904
905 #if SK_SUPPORT_GPU 905 #if SK_SUPPORT_GPU
906 906
907 #include "effects/GrTextureStripAtlas.h" 907 #include "effects/GrTextureStripAtlas.h"
908 #include "GrContext.h"
908 #include "GrInvariantOutput.h" 909 #include "GrInvariantOutput.h"
909 #include "gl/GrGLContext.h" 910 #include "gl/GrGLContext.h"
910 #include "glsl/GrGLSLFragmentShaderBuilder.h" 911 #include "glsl/GrGLSLFragmentShaderBuilder.h"
911 #include "glsl/GrGLSLProgramDataManager.h" 912 #include "glsl/GrGLSLProgramDataManager.h"
912 #include "glsl/GrGLSLUniformHandler.h" 913 #include "glsl/GrGLSLUniformHandler.h"
913 #include "SkGr.h" 914 #include "SkGr.h"
914 915
915 GrGLGradientEffect::GrGLGradientEffect() 916 GrGLGradientEffect::GrGLGradientEffect()
916 : fCachedYCoord(SK_ScalarMax) { 917 : fCachedYCoord(SK_ScalarMax) {
917 } 918 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 // doesn't matter how this is set, just be consistent because it is part of the effect key. 1111 // doesn't matter how this is set, just be consistent because it is part of the effect key.
1111 fPremulType = kBeforeInterp_PremulType; 1112 fPremulType = kBeforeInterp_PremulType;
1112 SkBitmap bitmap; 1113 SkBitmap bitmap;
1113 shader.getGradientTableBitmap(&bitmap); 1114 shader.getGradientTableBitmap(&bitmap);
1114 1115
1115 GrTextureStripAtlas::Desc desc; 1116 GrTextureStripAtlas::Desc desc;
1116 desc.fWidth = bitmap.width(); 1117 desc.fWidth = bitmap.width();
1117 desc.fHeight = 32; 1118 desc.fHeight = 32;
1118 desc.fRowHeight = bitmap.height(); 1119 desc.fRowHeight = bitmap.height();
1119 desc.fContext = ctx; 1120 desc.fContext = ctx;
1120 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); 1121 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *ctx->caps());
1121 fAtlas = GrTextureStripAtlas::GetAtlas(desc); 1122 fAtlas = GrTextureStripAtlas::GetAtlas(desc);
1122 SkASSERT(fAtlas); 1123 SkASSERT(fAtlas);
1123 1124
1124 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp. 1125 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp.
1125 GrTextureParams params; 1126 GrTextureParams params;
1126 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); 1127 params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
1127 params.setTileModeX(tileMode); 1128 params.setTileModeX(tileMode);
1128 1129
1129 fRow = fAtlas->lockRow(bitmap); 1130 fRow = fAtlas->lockRow(bitmap);
1130 if (-1 != fRow) { 1131 if (-1 != fRow) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 (*stops)[i] = stop; 1207 (*stops)[i] = stop;
1207 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1208 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1208 } 1209 }
1209 } 1210 }
1210 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1211 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1211 1212
1212 return outColors; 1213 return outColors;
1213 } 1214 }
1214 1215
1215 #endif 1216 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698