| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (!this->extractSubset(&pm, *subset)) { | 221 if (!this->extractSubset(&pm, *subset)) { |
| 222 return false; | 222 return false; |
| 223 } | 223 } |
| 224 } else { | 224 } else { |
| 225 pm = *this; | 225 pm = *this; |
| 226 } | 226 } |
| 227 | 227 |
| 228 const SkColor4f color = origColor.pin(); | 228 const SkColor4f color = origColor.pin(); |
| 229 | 229 |
| 230 if (kRGBA_F16_SkColorType != pm.colorType()) { | 230 if (kRGBA_F16_SkColorType != pm.colorType()) { |
| 231 Sk4f c4 = Sk4f::Load(color.vec()); | 231 return pm.erase(color.toSkColor()); |
| 232 SkColor c; | |
| 233 SkNx_cast<uint8_t>(c4 * Sk4f(255) + Sk4f(0.5f)).store(&c); | |
| 234 return pm.erase(c); | |
| 235 } | 232 } |
| 236 | 233 |
| 237 const uint64_t half4 = color.premul().toF16(); | 234 const uint64_t half4 = color.premul().toF16(); |
| 238 for (int y = 0; y < pm.height(); ++y) { | 235 for (int y = 0; y < pm.height(); ++y) { |
| 239 sk_memset64(pm.writable_addr64(0, y), half4, pm.width()); | 236 sk_memset64(pm.writable_addr64(0, y), half4, pm.width()); |
| 240 } | 237 } |
| 241 return true; | 238 return true; |
| 242 } | 239 } |
| 243 | 240 |
| 244 #include "SkBitmap.h" | 241 #include "SkBitmap.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 270 | 267 |
| 271 SkPaint paint; | 268 SkPaint paint; |
| 272 paint.setFilterQuality(quality); | 269 paint.setFilterQuality(quality); |
| 273 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 270 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 274 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), | 271 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), |
| 275 &paint); | 272 &paint); |
| 276 return true; | 273 return true; |
| 277 } | 274 } |
| 278 | 275 |
| 279 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 276 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
| OLD | NEW |