| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkColorShader.h" | 8 #include "SkColorShader.h" |
| 9 #include "SkColorSpace.h" | 9 #include "SkColorSpace.h" |
| 10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 279 } |
| 280 | 280 |
| 281 static bool choose_blitprocs(const SkPM4f* pm4, const SkImageInfo& info, | 281 static bool choose_blitprocs(const SkPM4f* pm4, const SkImageInfo& info, |
| 282 SkShader::Context::BlitState* state) { | 282 SkShader::Context::BlitState* state) { |
| 283 uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; | 283 uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; |
| 284 if (pm4->a() == 1) { | 284 if (pm4->a() == 1) { |
| 285 flags |= SkXfermode::kSrcIsOpaque_D32Flag; | 285 flags |= SkXfermode::kSrcIsOpaque_D32Flag; |
| 286 } | 286 } |
| 287 switch (info.colorType()) { | 287 switch (info.colorType()) { |
| 288 case kN32_SkColorType: | 288 case kN32_SkColorType: |
| 289 if (info.isSRGB()) { | 289 if (info.gammaCloseToSRGB()) { |
| 290 flags |= SkXfermode::kDstIsSRGB_D32Flag; | 290 flags |= SkXfermode::kDstIsSRGB_D32Flag; |
| 291 } | 291 } |
| 292 state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, fla
gs); | 292 state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, fla
gs); |
| 293 state->fStorage[1] = (void*)pm4; | 293 state->fStorage[1] = (void*)pm4; |
| 294 state->fBlitBW = D32_BlitBW; | 294 state->fBlitBW = D32_BlitBW; |
| 295 state->fBlitAA = D32_BlitAA; | 295 state->fBlitAA = D32_BlitAA; |
| 296 return true; | 296 return true; |
| 297 case kRGBA_F16_SkColorType: | 297 case kRGBA_F16_SkColorType: |
| 298 state->fStorage[0] = (void*)SkXfermode::GetF16Proc(state->fXfer, fla
gs); | 298 state->fStorage[0] = (void*)SkXfermode::GetF16Proc(state->fXfer, fla
gs); |
| 299 state->fStorage[1] = (void*)pm4; | 299 state->fStorage[1] = (void*)pm4; |
| 300 state->fBlitBW = F16_BlitBW; | 300 state->fBlitBW = F16_BlitBW; |
| 301 state->fBlitAA = F16_BlitAA; | 301 state->fBlitAA = F16_BlitAA; |
| 302 return true; | 302 return true; |
| 303 default: | 303 default: |
| 304 return false; | 304 return false; |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf
o, | 308 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf
o, |
| 309 BlitState* state) { | 309 BlitState* state) { |
| 310 return choose_blitprocs(&fPM4f, info, state); | 310 return choose_blitprocs(&fPM4f, info, state); |
| 311 } | 311 } |
| 312 | 312 |
| 313 bool SkColor4Shader::Color4Context::onChooseBlitProcs(const SkImageInfo& info, B
litState* state) { | 313 bool SkColor4Shader::Color4Context::onChooseBlitProcs(const SkImageInfo& info, B
litState* state) { |
| 314 return choose_blitprocs(&fPM4f, info, state); | 314 return choose_blitprocs(&fPM4f, info, state); |
| 315 } | 315 } |
| OLD | NEW |