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 "Sk4fLinearGradient.h" | 8 #include "Sk4fLinearGradient.h" |
9 #include "Sk4x4f.h" | 9 #include "Sk4x4f.h" |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 bool SkLinearGradient::LinearGradient4fContext::onChooseBlitProcs(const SkImageI
nfo& info, | 415 bool SkLinearGradient::LinearGradient4fContext::onChooseBlitProcs(const SkImageI
nfo& info, |
416 BlitState* sta
te) { | 416 BlitState* sta
te) { |
417 SkXfermode::Mode mode; | 417 SkXfermode::Mode mode; |
418 if (!SkXfermode::AsMode(state->fXfer, &mode)) { | 418 if (!SkXfermode::AsMode(state->fXfer, &mode)) { |
419 return false; | 419 return false; |
420 } | 420 } |
421 | 421 |
422 const SkGradientShaderBase& shader = static_cast<const SkGradientShaderBase&
>(fShader); | |
423 if (mode != SkXfermode::kSrc_Mode && | 422 if (mode != SkXfermode::kSrc_Mode && |
424 !(mode == SkXfermode::kSrcOver_Mode && shader.colorsAreOpaque())) { | 423 !(mode == SkXfermode::kSrcOver_Mode && (fFlags & kOpaqueAlpha_Flag))) { |
425 return false; | 424 return false; |
426 } | 425 } |
427 | 426 |
428 switch (info.colorType()) { | 427 switch (info.colorType()) { |
429 case kN32_SkColorType: | 428 case kN32_SkColorType: |
430 state->fBlitBW = D32_BlitBW; | 429 state->fBlitBW = D32_BlitBW; |
431 return true; | 430 return true; |
432 case kRGBA_F16_SkColorType: | 431 case kRGBA_F16_SkColorType: |
433 state->fBlitBW = D64_BlitBW; | 432 state->fBlitBW = D64_BlitBW; |
434 return true; | 433 return true; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 static_cast<const LinearGradient4fContext*>(state->fCtx); | 470 static_cast<const LinearGradient4fContext*>(state->fCtx); |
472 | 471 |
473 if (ctx->fColorsArePremul) { | 472 if (ctx->fColorsArePremul) { |
474 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( | 473 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( |
475 x, y, dst.writable_addr64(x, y), count); | 474 x, y, dst.writable_addr64(x, y), count); |
476 } else { | 475 } else { |
477 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( | 476 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( |
478 x, y, dst.writable_addr64(x, y), count); | 477 x, y, dst.writable_addr64(x, y), count); |
479 } | 478 } |
480 } | 479 } |
OLD | NEW |