| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
| 10 #include "SkBitmapProvider.h" | 10 #include "SkBitmapProvider.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 fPipeline = (SkLinearBitmapPipeline*)SkAlign16((intptr_t)fStorage); | 125 fPipeline = (SkLinearBitmapPipeline*)SkAlign16((intptr_t)fStorage); |
| 126 float alpha = SkColorGetA(info->fPaintColor) / 255.0f; | 126 float alpha = SkColorGetA(info->fPaintColor) / 255.0f; |
| 127 new (fPipeline) SkLinearBitmapPipeline(info->fRealInvMatrix, info->fFilt
erQuality, | 127 new (fPipeline) SkLinearBitmapPipeline(info->fRealInvMatrix, info->fFilt
erQuality, |
| 128 info->fTileModeX, info->fTileMode
Y, | 128 info->fTileModeX, info->fTileMode
Y, |
| 129 alpha, | 129 alpha, |
| 130 info->fPixmap); | 130 info->fPixmap); |
| 131 | 131 |
| 132 // To implement the old shadeSpan entry-point, we need to efficiently co
nvert our native | 132 // To implement the old shadeSpan entry-point, we need to efficiently co
nvert our native |
| 133 // floats into SkPMColor. The SkXfermode::D32Procs do exactly that. | 133 // floats into SkPMColor. The SkXfermode::D32Procs do exactly that. |
| 134 // | 134 // |
| 135 sk_sp<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kSrc_Mode)); | 135 sk_sp<SkXfermode> xfer(SkXfermode::Make(SkXfermode::kSrc_Mode)); |
| 136 fXferProc = SkXfermode::GetD32Proc(xfer.get(), 0); | 136 fXferProc = SkXfermode::GetD32Proc(xfer.get(), 0); |
| 137 } | 137 } |
| 138 | 138 |
| 139 ~LinearPipelineContext() override { | 139 ~LinearPipelineContext() override { |
| 140 // since we did a manual new, we need to manually destroy as well. | 140 // since we did a manual new, we need to manually destroy as well. |
| 141 fPipeline->~SkLinearBitmapPipeline(); | 141 fPipeline->~SkLinearBitmapPipeline(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void shadeSpan4f(int x, int y, SkPM4f dstC[], int count) override { | 144 void shadeSpan4f(int x, int y, SkPM4f dstC[], int count) override { |
| 145 fPipeline->shadeSpan4f(x, y, dstC, count); | 145 fPipeline->shadeSpan4f(x, y, dstC, count); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); | 454 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); |
| 455 } | 455 } |
| 456 | 456 |
| 457 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 457 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
| 458 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); | 458 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); |
| 459 } | 459 } |
| 460 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 460 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
| 461 } | 461 } |
| 462 | 462 |
| 463 #endif | 463 #endif |
| OLD | NEW |