OLD | NEW |
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); | 217 SkImageInfo info = as_IB(fImage)->onImageInfo(); |
218 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(info.colo
rSpace(), | 218 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(info.colo
rSpace(), |
219 args.fDst
ColorSpace, | 219 args.fDst
ColorSpace); |
220 info.alph
aType()); | |
221 sk_sp<GrFragmentProcessor> inner; | 220 sk_sp<GrFragmentProcessor> inner; |
222 if (doBicubic) { | 221 if (doBicubic) { |
223 inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matri
x, tm); | 222 inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matri
x, tm); |
224 } else { | 223 } else { |
225 inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform),
matrix, params); | 224 inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform),
matrix, params); |
226 } | 225 } |
227 | 226 |
228 if (GrPixelConfigIsAlphaOnly(texture->config())) { | 227 if (GrPixelConfigIsAlphaOnly(texture->config())) { |
229 return inner; | 228 return inner; |
230 } | 229 } |
(...skipping 25 matching lines...) Expand all Loading... |
256 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt(); | 255 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt(); |
257 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt(); | 256 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt(); |
258 return image ? image->makeShader(mx, my, &lm) : nullptr; | 257 return image ? image->makeShader(mx, my, &lm) : nullptr; |
259 } | 258 } |
260 | 259 |
261 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader) | 260 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader) |
262 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) | 261 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) |
263 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk
Shader_Type); | 262 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk
Shader_Type); |
264 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 263 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
265 | 264 |
OLD | NEW |