OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmapProcShader.h" | 9 #include "SkBitmapProcShader.h" |
10 #include "SkColorShader.h" | 10 #include "SkColorShader.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 str->appendHex(fColor); | 354 str->appendHex(fColor); |
355 | 355 |
356 this->INHERITED::toString(str); | 356 this->INHERITED::toString(str); |
357 | 357 |
358 str->append(")"); | 358 str->append(")"); |
359 } | 359 } |
360 #endif | 360 #endif |
361 | 361 |
362 /////////////////////////////////////////////////////////////////////////////// | 362 /////////////////////////////////////////////////////////////////////////////// |
363 | 363 |
| 364 static void D32_BlitProc(SkShader::Context::BlitState* state, int x, int y, cons
t SkPixmap& dst, |
| 365 int count, const SkAlpha aa[]) { |
| 366 SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0]; |
| 367 const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; |
| 368 proc(state->fXfer, dst.writable_addr32(x, y), src, count, aa); |
| 369 } |
| 370 |
| 371 static void D64_BlitProc(SkShader::Context::BlitState* state, int x, int y, cons
t SkPixmap& dst, |
| 372 int count, const SkAlpha aa[]) { |
| 373 SkXfermode::D64Proc proc = (SkXfermode::D64Proc)state->fStorage[0]; |
| 374 const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; |
| 375 proc(state->fXfer, dst.writable_addr64(x, y), src, count, aa); |
| 376 } |
| 377 |
| 378 SkShader::Context::BlitProc |
| 379 SkColorShader::ColorShaderContext::onChooseBlitProc(const SkImageInfo& info, Bli
tState* state) { |
| 380 uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; |
| 381 if (fPM4f.a() == 1) { |
| 382 flags |= SkXfermode::kSrcIsOpaque_D32Flag; |
| 383 } |
| 384 switch (info.colorType()) { |
| 385 case kN32_SkColorType: |
| 386 if (info.isSRGB()) { |
| 387 flags |= SkXfermode::kDstIsSRGB_D32Flag; |
| 388 } |
| 389 state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, fla
gs); |
| 390 state->fStorage[1] = &fPM4f; |
| 391 return D32_BlitProc; |
| 392 case kRGBA_F16_SkColorType: |
| 393 flags |= SkXfermode::kDstIsFloat16_D64Flag; |
| 394 state->fStorage[0] = (void*)SkXfermode::GetD64Proc(state->fXfer, fla
gs); |
| 395 state->fStorage[1] = &fPM4f; |
| 396 return D64_BlitProc; |
| 397 default: |
| 398 return nullptr; |
| 399 } |
| 400 } |
| 401 |
| 402 /////////////////////////////////////////////////////////////////////////////// |
| 403 |
364 SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) { | 404 SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) { |
365 return SkShader::MakeEmptyShader().release(); | 405 return SkShader::MakeEmptyShader().release(); |
366 } | 406 } |
367 | 407 |
368 #ifndef SK_IGNORE_TO_STRING | 408 #ifndef SK_IGNORE_TO_STRING |
369 #include "SkEmptyShader.h" | 409 #include "SkEmptyShader.h" |
370 | 410 |
371 void SkEmptyShader::toString(SkString* str) const { | 411 void SkEmptyShader::toString(SkString* str) const { |
372 str->append("SkEmptyShader: ("); | 412 str->append("SkEmptyShader: ("); |
373 | 413 |
(...skipping 11 matching lines...) Expand all Loading... |
385 } | 425 } |
386 SkShader* SkShader::CreateComposeShader(SkShader* dst, SkShader* src, SkXfermode
* xfer) { | 426 SkShader* SkShader::CreateComposeShader(SkShader* dst, SkShader* src, SkXfermode
* xfer) { |
387 return MakeComposeShader(sk_ref_sp(dst), sk_ref_sp(src), xfer).release(); | 427 return MakeComposeShader(sk_ref_sp(dst), sk_ref_sp(src), xfer).release(); |
388 } | 428 } |
389 SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, Tile
Mode tmy, | 429 SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, Tile
Mode tmy, |
390 const SkMatrix* localMatrix, const SkRect*
tile) { | 430 const SkMatrix* localMatrix, const SkRect*
tile) { |
391 return MakePictureShader(sk_ref_sp(const_cast<SkPicture*>(src)), tmx, tmy, | 431 return MakePictureShader(sk_ref_sp(const_cast<SkPicture*>(src)), tmx, tmy, |
392 localMatrix, tile).release(); | 432 localMatrix, tile).release(); |
393 } | 433 } |
394 #endif | 434 #endif |
OLD | NEW |