Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: src/core/SkShader.cpp

Issue 1889753002: remove U16 support, just support F16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address reviewer comments, mostly fixing class/function names Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkCoreBlitters.h ('k') | src/core/SkSpriteBlitter4f.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 proc(state->fXfer, dst.writable_addr32(x, y), src, count, nullptr); 368 proc(state->fXfer, dst.writable_addr32(x, y), src, count, nullptr);
369 } 369 }
370 370
371 static void D32_BlitAA(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst, 371 static void D32_BlitAA(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst,
372 int count, const SkAlpha aa[]) { 372 int count, const SkAlpha aa[]) {
373 SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0]; 373 SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0];
374 const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; 374 const SkPM4f* src = (const SkPM4f*)state->fStorage[1];
375 proc(state->fXfer, dst.writable_addr32(x, y), src, count, aa); 375 proc(state->fXfer, dst.writable_addr32(x, y), src, count, aa);
376 } 376 }
377 377
378 static void D64_BlitBW(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst, 378 static void F16_BlitBW(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst,
379 int count) { 379 int count) {
380 SkXfermode::D64Proc proc = (SkXfermode::D64Proc)state->fStorage[0]; 380 SkXfermode::F16Proc proc = (SkXfermode::F16Proc)state->fStorage[0];
381 const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; 381 const SkPM4f* src = (const SkPM4f*)state->fStorage[1];
382 proc(state->fXfer, dst.writable_addr64(x, y), src, count, nullptr); 382 proc(state->fXfer, dst.writable_addr64(x, y), src, count, nullptr);
383 } 383 }
384 384
385 static void D64_BlitAA(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst, 385 static void F16_BlitAA(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst,
386 int count, const SkAlpha aa[]) { 386 int count, const SkAlpha aa[]) {
387 SkXfermode::D64Proc proc = (SkXfermode::D64Proc)state->fStorage[0]; 387 SkXfermode::F16Proc proc = (SkXfermode::F16Proc)state->fStorage[0];
388 const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; 388 const SkPM4f* src = (const SkPM4f*)state->fStorage[1];
389 proc(state->fXfer, dst.writable_addr64(x, y), src, count, aa); 389 proc(state->fXfer, dst.writable_addr64(x, y), src, count, aa);
390 } 390 }
391 391
392 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf o, 392 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf o,
393 BlitState* state) { 393 BlitState* state) {
394 uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; 394 uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag;
395 if (fPM4f.a() == 1) { 395 if (fPM4f.a() == 1) {
396 flags |= SkXfermode::kSrcIsOpaque_D32Flag; 396 flags |= SkXfermode::kSrcIsOpaque_D32Flag;
397 } 397 }
398 switch (info.colorType()) { 398 switch (info.colorType()) {
399 case kN32_SkColorType: 399 case kN32_SkColorType:
400 if (info.isSRGB()) { 400 if (info.isSRGB()) {
401 flags |= SkXfermode::kDstIsSRGB_D32Flag; 401 flags |= SkXfermode::kDstIsSRGB_D32Flag;
402 } 402 }
403 state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, fla gs); 403 state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, fla gs);
404 state->fStorage[1] = &fPM4f; 404 state->fStorage[1] = &fPM4f;
405 state->fBlitBW = D32_BlitBW; 405 state->fBlitBW = D32_BlitBW;
406 state->fBlitAA = D32_BlitAA; 406 state->fBlitAA = D32_BlitAA;
407 return true; 407 return true;
408 case kRGBA_F16_SkColorType: 408 case kRGBA_F16_SkColorType:
409 flags |= SkXfermode::kDstIsFloat16_D64Flag; 409 state->fStorage[0] = (void*)SkXfermode::GetF16Proc(state->fXfer, fla gs);
410 state->fStorage[0] = (void*)SkXfermode::GetD64Proc(state->fXfer, fla gs);
411 state->fStorage[1] = &fPM4f; 410 state->fStorage[1] = &fPM4f;
412 state->fBlitBW = D64_BlitBW; 411 state->fBlitBW = F16_BlitBW;
413 state->fBlitAA = D64_BlitAA; 412 state->fBlitAA = F16_BlitAA;
414 return true; 413 return true;
415 default: 414 default:
416 return false; 415 return false;
417 } 416 }
418 } 417 }
419 418
420 /////////////////////////////////////////////////////////////////////////////// 419 ///////////////////////////////////////////////////////////////////////////////
421 420
422 sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) { 421 sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) {
423 return SkShader::MakeEmptyShader(); 422 return SkShader::MakeEmptyShader();
(...skipping 30 matching lines...) Expand all
454 } 453 }
455 #endif 454 #endif
456 455
457 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR 456 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
458 #include "SkXfermode.h" 457 #include "SkXfermode.h"
459 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 458 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
460 SkXfermode* xfer) { 459 SkXfermode* xfer) {
461 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer)); 460 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer));
462 } 461 }
463 #endif 462 #endif
OLDNEW
« no previous file with comments | « src/core/SkCoreBlitters.h ('k') | src/core/SkSpriteBlitter4f.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698