diff options
Diffstat (limited to 'src/core/SkDraw_vertices.cpp')
-rw-r--r-- | src/core/SkDraw_vertices.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp index 9735fa8a25..ceeb3c2ddc 100644 --- a/src/core/SkDraw_vertices.cpp +++ b/src/core/SkDraw_vertices.cpp @@ -257,9 +257,9 @@ void SkTriColorShader::TriColorShaderContext::shadeSpan4f(int x, int y, SkPM4f d #ifndef SK_IGNORE_TO_STRING void SkTriColorShader::toString(SkString* str) const { str->append("SkTriColorShader: ("); - + this->INHERITED::toString(str); - + str->append(")"); } #endif @@ -472,6 +472,17 @@ void SkDraw::drawVertices(SkVertices::VertexMode vmode, int count, // SkPM4f* dstColors = convert_colors(colors, count, fDst.colorSpace(), &alloc); + bool is_opaque; + if (paint.getAlpha() == 0xff) { + is_opaque = compute_is_opaque(colors, count); + } else { + is_opaque = false; + Sk4f alpha = paint.getAlpha() * (1/255.0f); + for (int i = 0; i < count; i++) { + (dstColors[i].to4f() * alpha).store(dstColors + i); + } + } + shaderPipeline.append(SkRasterPipeline::matrix_4x3, &matrix43); // In theory we should never need to clamp. However, either due to imprecision in our // matrix43, or the scan converter passing us pixel centers that in fact are not within @@ -480,9 +491,8 @@ void SkDraw::drawVertices(SkVertices::VertexMode vmode, int count, shaderPipeline.append(SkRasterPipeline::clamp_0); shaderPipeline.append(SkRasterPipeline::clamp_a); - bool is_opaque = compute_is_opaque(colors, count), - wants_dither = paint.isDither(); - auto blitter = SkCreateRasterPipelineBlitter(fDst, paint, *fMatrix, shaderPipeline, + bool wants_dither = paint.isDither(); + auto blitter = SkCreateRasterPipelineBlitter(fDst, paint, shaderPipeline, is_opaque, wants_dither, &alloc); SkASSERT(!blitter->isNullBlitter()); |