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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const SkPaint& paint, | 75 const SkPaint& paint, |
76 SkTBlitterAllocator* alloc) { | 76 SkTBlitterAllocator* alloc) { |
77 if (!supported(dst.info())) { | 77 if (!supported(dst.info())) { |
78 return nullptr; | 78 return nullptr; |
79 } | 79 } |
80 if (paint.getShader()) { | 80 if (paint.getShader()) { |
81 return nullptr; // TODO: need to work out how shaders and their context
s work | 81 return nullptr; // TODO: need to work out how shaders and their context
s work |
82 } | 82 } |
83 | 83 |
84 SkRasterPipeline shader, colorFilter, xfermode; | 84 SkRasterPipeline shader, colorFilter, xfermode; |
85 if (!append_effect_stages(paint.getColorFilter(), &colorFilter) || | 85 if (!append_effect_stages(paint.getColorFilter(), &colorFilt
er) || |
86 !append_effect_stages(paint.getXfermode(), &xfermode )) { | 86 !append_effect_stages(SkXfermode::Peek(paint.getBlendMode()), &xfermode
)) { |
87 return nullptr; | 87 return nullptr; |
88 } | 88 } |
89 | 89 |
90 uint32_t paintColor = paint.getColor(); | 90 uint32_t paintColor = paint.getColor(); |
91 | 91 |
92 SkColor4f color; | 92 SkColor4f color; |
93 if (SkImageInfoIsGammaCorrect(dst.info())) { | 93 if (SkImageInfoIsGammaCorrect(dst.info())) { |
94 color = SkColor4f::FromColor(paintColor); | 94 color = SkColor4f::FromColor(paintColor); |
95 } else { | 95 } else { |
96 swizzle_rb(SkNx_cast<float>(Sk4b::Load(&paintColor)) * (1/255.0f)).store
(&color); | 96 swizzle_rb(SkNx_cast<float>(Sk4b::Load(&paintColor)) * (1/255.0f)).store
(&color); |
97 } | 97 } |
98 | 98 |
99 auto blitter = alloc->createT<SkRasterPipelineBlitter>( | 99 auto blitter = alloc->createT<SkRasterPipelineBlitter>( |
100 dst, | 100 dst, |
101 shader, colorFilter, xfermode, | 101 shader, colorFilter, xfermode, |
102 color.premul()); | 102 color.premul()); |
103 | 103 |
104 if (!paint.getShader()) { | 104 if (!paint.getShader()) { |
105 blitter->fShader.append(SkRasterPipeline::constant_color, &blitter->fPai
ntColor); | 105 blitter->fShader.append(SkRasterPipeline::constant_color, &blitter->fPai
ntColor); |
106 } | 106 } |
107 if (!paint.getXfermode()) { | 107 if (paint.isSrcOver()) { |
108 blitter->fXfermode.append(SkRasterPipeline::srcover); | 108 blitter->fXfermode.append(SkRasterPipeline::srcover); |
109 } | 109 } |
110 | 110 |
111 return blitter; | 111 return blitter; |
112 } | 112 } |
113 | 113 |
114 void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p, const void* dst
) const { | 114 void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p, const void* dst
) const { |
115 SkASSERT(supported(fDst.info())); | 115 SkASSERT(supported(fDst.info())); |
116 | 116 |
117 switch (fDst.info().colorType()) { | 117 switch (fDst.info().colorType()) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 case SkMask::kLCD16_Format: | 206 case SkMask::kLCD16_Format: |
207 p.append(SkRasterPipeline::lerp_565, mask.getAddrLCD16(x,y)-x); | 207 p.append(SkRasterPipeline::lerp_565, mask.getAddrLCD16(x,y)-x); |
208 break; | 208 break; |
209 default: break; | 209 default: break; |
210 } | 210 } |
211 this->append_store(&p, dst); | 211 this->append_store(&p, dst); |
212 | 212 |
213 p.run(x, clip.width()); | 213 p.run(x, clip.width()); |
214 } | 214 } |
215 } | 215 } |
OLD | NEW |