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

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

Issue 1814533003: Revert of sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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"
11 #include "SkRadialGradient.h" 11 #include "SkRadialGradient.h"
12 #include "SkTwoPointConicalGradient.h" 12 #include "SkTwoPointConicalGradient.h"
13 #include "SkSweepGradient.h" 13 #include "SkSweepGradient.h"
14 14
15 #include "GrContext.h"
16
17 void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const { 15 void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const {
18 buffer.writeColorArray(fColors, fCount); 16 buffer.writeColorArray(fColors, fCount);
19 if (fPos) { 17 if (fPos) {
20 buffer.writeBool(true); 18 buffer.writeBool(true);
21 buffer.writeScalarArray(fPos, fCount); 19 buffer.writeScalarArray(fPos, fCount);
22 } else { 20 } else {
23 buffer.writeBool(false); 21 buffer.writeBool(false);
24 } 22 }
25 buffer.write32(fTileMode); 23 buffer.write32(fTileMode);
26 buffer.write32(fGradFlags); 24 buffer.write32(fGradFlags);
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 // doesn't matter how this is set, just be consistent because it is part of the effect key. 1110 // doesn't matter how this is set, just be consistent because it is part of the effect key.
1113 fPremulType = kBeforeInterp_PremulType; 1111 fPremulType = kBeforeInterp_PremulType;
1114 SkBitmap bitmap; 1112 SkBitmap bitmap;
1115 shader.getGradientTableBitmap(&bitmap); 1113 shader.getGradientTableBitmap(&bitmap);
1116 1114
1117 GrTextureStripAtlas::Desc desc; 1115 GrTextureStripAtlas::Desc desc;
1118 desc.fWidth = bitmap.width(); 1116 desc.fWidth = bitmap.width();
1119 desc.fHeight = 32; 1117 desc.fHeight = 32;
1120 desc.fRowHeight = bitmap.height(); 1118 desc.fRowHeight = bitmap.height();
1121 desc.fContext = ctx; 1119 desc.fContext = ctx;
1122 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *ctx->caps()); 1120 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info());
1123 fAtlas = GrTextureStripAtlas::GetAtlas(desc); 1121 fAtlas = GrTextureStripAtlas::GetAtlas(desc);
1124 SkASSERT(fAtlas); 1122 SkASSERT(fAtlas);
1125 1123
1126 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp. 1124 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp.
1127 GrTextureParams params; 1125 GrTextureParams params;
1128 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); 1126 params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
1129 params.setTileModeX(tileMode); 1127 params.setTileModeX(tileMode);
1130 1128
1131 fRow = fAtlas->lockRow(bitmap); 1129 fRow = fAtlas->lockRow(bitmap);
1132 if (-1 != fRow) { 1130 if (-1 != fRow) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 (*stops)[i] = stop; 1206 (*stops)[i] = stop;
1209 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1207 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1210 } 1208 }
1211 } 1209 }
1212 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1210 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1213 1211
1214 return outColors; 1212 return outColors;
1215 } 1213 }
1216 1214
1217 #endif 1215 #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