OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 } else { | 220 } else { |
221 pm = *this; | 221 pm = *this; |
222 } | 222 } |
223 | 223 |
224 const SkColor4f color = origColor.pin(); | 224 const SkColor4f color = origColor.pin(); |
225 | 225 |
226 if (kRGBA_F16_SkColorType != pm.colorType()) { | 226 if (kRGBA_F16_SkColorType != pm.colorType()) { |
227 Sk4f c4 = Sk4f::Load(color.vec()); | 227 Sk4f c4 = Sk4f::Load(color.vec()); |
228 SkColor c; | 228 SkColor c; |
229 (c4 * Sk4f(255) + Sk4f(0.5f)).store(&c); | 229 SkNx_cast<uint8_t>(c4 * Sk4f(255) + Sk4f(0.5f)).store(&c); |
230 return pm.erase(c); | 230 return pm.erase(c); |
231 } | 231 } |
232 | 232 |
233 const uint64_t half4 = color.premul().toF16(); | 233 const uint64_t half4 = color.premul().toF16(); |
234 for (int y = 0; y < pm.height(); ++y) { | 234 for (int y = 0; y < pm.height(); ++y) { |
235 sk_memset64(pm.writable_addr64(0, y), half4, pm.width()); | 235 sk_memset64(pm.writable_addr64(0, y), half4, pm.width()); |
236 } | 236 } |
237 return true; | 237 return true; |
238 } | 238 } |
239 | 239 |
(...skipping 26 matching lines...) Expand all Loading... |
266 | 266 |
267 SkPaint paint; | 267 SkPaint paint; |
268 paint.setFilterQuality(quality); | 268 paint.setFilterQuality(quality); |
269 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 269 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
270 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), | 270 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), |
271 &paint); | 271 &paint); |
272 return true; | 272 return true; |
273 } | 273 } |
274 | 274 |
275 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 275 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
OLD | NEW |