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

Side by Side Diff: src/image/SkImageShader.cpp

Issue 2180803005: Add color gamut xform helpers to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@xform-storage
Patch Set: Rebase Created 4 years, 3 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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProvider.h" 9 #include "SkBitmapProvider.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 GrTextureParams::FilterMode textureFilterMode = 207 GrTextureParams::FilterMode textureFilterMode =
208 GrSkFilterQualityToGrFilterMode(args.fFilterQuality, *args.fViewMatrix, this ->getLocalMatrix(), 208 GrSkFilterQualityToGrFilterMode(args.fFilterQuality, *args.fViewMatrix, this ->getLocalMatrix(),
209 &doBicubic); 209 &doBicubic);
210 GrTextureParams params(tm, textureFilterMode); 210 GrTextureParams params(tm, textureFilterMode);
211 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, p arams, 211 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, p arams,
212 args.fGammaTreat ment)); 212 args.fGammaTreat ment));
213 if (!texture) { 213 if (!texture) {
214 return nullptr; 214 return nullptr;
215 } 215 }
216 216
217 SkImageInfo info = as_IB(fImage)->onImageInfo();
218 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(info.colo rSpace(),
219 args.fDst ColorSpace,
220 info.alph aType());
217 sk_sp<GrFragmentProcessor> inner; 221 sk_sp<GrFragmentProcessor> inner;
218 if (doBicubic) { 222 if (doBicubic) {
219 inner = GrBicubicEffect::Make(texture, nullptr, matrix, tm); 223 inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matri x, tm);
220 } else { 224 } else {
221 inner = GrSimpleTextureEffect::Make(texture, nullptr, matrix, params); 225 inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform), matrix, params);
222 } 226 }
223 227
224 if (GrPixelConfigIsAlphaOnly(texture->config())) { 228 if (GrPixelConfigIsAlphaOnly(texture->config())) {
225 return inner; 229 return inner;
226 } 230 }
227 return sk_sp<GrFragmentProcessor>(GrFragmentProcessor::MulOutputByInputAlpha (std::move(inner))); 231 return sk_sp<GrFragmentProcessor>(GrFragmentProcessor::MulOutputByInputAlpha (std::move(inner)));
228 } 232 }
229 233
230 #endif 234 #endif
231 235
(...skipping 20 matching lines...) Expand all
252 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt(); 256 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt();
253 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt(); 257 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt();
254 return image ? image->makeShader(mx, my, &lm) : nullptr; 258 return image ? image->makeShader(mx, my, &lm) : nullptr;
255 } 259 }
256 260
257 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader) 261 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader)
258 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) 262 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader)
259 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk Shader_Type); 263 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk Shader_Type);
260 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 264 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
261 265
OLDNEW
« include/gpu/GrColorSpaceXform.h ('K') | « src/gpu/glsl/GrGLSLShaderBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698