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

Unified Diff: src/core/SkXfermode.cpp

Issue 1253493002: No one calls SkXfermode::GetProc16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more dead Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkXfermode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermode.cpp
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index eb711f1625cd44931f24830fbcfea4d740e38a11..46703aa6546e07a7cd5b0d9ac3b914acbe54b803 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1113,179 +1113,6 @@ bool SkXfermode::IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType) {
return xfer->isOpaque(opacityType);
}
-///////////////////////////////////////////////////////////////////////////////
-//////////// 16bit xfermode procs
-
-#ifdef SK_DEBUG
-static bool require_255(SkPMColor src) { return SkGetPackedA32(src) == 0xFF; }
-static bool require_0(SkPMColor src) { return SkGetPackedA32(src) == 0; }
-#endif
-
-static uint16_t src_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return SkPixel32ToPixel16(src);
-}
-
-static uint16_t dst_modeproc16(SkPMColor src, uint16_t dst) {
- return dst;
-}
-
-static uint16_t srcover_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return dst;
-}
-
-static uint16_t srcover_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return SkPixel32ToPixel16(src);
-}
-
-static uint16_t dstover_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return dst;
-}
-
-static uint16_t dstover_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return dst;
-}
-
-static uint16_t srcin_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return SkPixel32ToPixel16(src);
-}
-
-static uint16_t dstin_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return dst;
-}
-
-static uint16_t dstout_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return dst;
-}
-
-static uint16_t srcatop_modeproc16(SkPMColor src, uint16_t dst) {
- unsigned isa = 255 - SkGetPackedA32(src);
-
- return SkPackRGB16(
- SkPacked32ToR16(src) + SkAlphaMulAlpha(SkGetPackedR16(dst), isa),
- SkPacked32ToG16(src) + SkAlphaMulAlpha(SkGetPackedG16(dst), isa),
- SkPacked32ToB16(src) + SkAlphaMulAlpha(SkGetPackedB16(dst), isa));
-}
-
-static uint16_t srcatop_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return dst;
-}
-
-static uint16_t srcatop_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return SkPixel32ToPixel16(src);
-}
-
-static uint16_t dstatop_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- return dst;
-}
-
-/*********
- darken and lighten boil down to this.
-
- darken = (1 - Sa) * Dc + min(Sc, Dc)
- lighten = (1 - Sa) * Dc + max(Sc, Dc)
-
- if (Sa == 0) these become
- darken = Dc + min(0, Dc) = 0
- lighten = Dc + max(0, Dc) = Dc
-
- if (Sa == 1) these become
- darken = min(Sc, Dc)
- lighten = max(Sc, Dc)
-*/
-
-static uint16_t darken_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return 0;
-}
-
-static uint16_t darken_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- unsigned r = SkFastMin32(SkPacked32ToR16(src), SkGetPackedR16(dst));
- unsigned g = SkFastMin32(SkPacked32ToG16(src), SkGetPackedG16(dst));
- unsigned b = SkFastMin32(SkPacked32ToB16(src), SkGetPackedB16(dst));
- return SkPackRGB16(r, g, b);
-}
-
-static uint16_t lighten_modeproc16_0(SkPMColor src, uint16_t dst) {
- SkASSERT(require_0(src));
- return dst;
-}
-
-static uint16_t lighten_modeproc16_255(SkPMColor src, uint16_t dst) {
- SkASSERT(require_255(src));
- unsigned r = SkMax32(SkPacked32ToR16(src), SkGetPackedR16(dst));
- unsigned g = SkMax32(SkPacked32ToG16(src), SkGetPackedG16(dst));
- unsigned b = SkMax32(SkPacked32ToB16(src), SkGetPackedB16(dst));
- return SkPackRGB16(r, g, b);
-}
-
-struct Proc16Rec {
- SkXfermodeProc16 fProc16_0;
- SkXfermodeProc16 fProc16_255;
- SkXfermodeProc16 fProc16_General;
-};
-
-static const Proc16Rec gModeProcs16[] = {
- { NULL, NULL, NULL }, // CLEAR
- { NULL, src_modeproc16_255, NULL },
- { dst_modeproc16, dst_modeproc16, dst_modeproc16 },
- { srcover_modeproc16_0, srcover_modeproc16_255, NULL },
- { dstover_modeproc16_0, dstover_modeproc16_255, NULL },
- { NULL, srcin_modeproc16_255, NULL },
- { NULL, dstin_modeproc16_255, NULL },
- { NULL, NULL, NULL },// SRC_OUT
- { dstout_modeproc16_0, NULL, NULL },
- { srcatop_modeproc16_0, srcatop_modeproc16_255, srcatop_modeproc16 },
- { NULL, dstatop_modeproc16_255, NULL },
- { NULL, NULL, NULL }, // XOR
-
- { NULL, NULL, NULL }, // plus
- { NULL, NULL, NULL }, // modulate
- { NULL, NULL, NULL }, // screen
- { NULL, NULL, NULL }, // overlay
- { darken_modeproc16_0, darken_modeproc16_255, NULL }, // darken
- { lighten_modeproc16_0, lighten_modeproc16_255, NULL }, // lighten
- { NULL, NULL, NULL }, // colordodge
- { NULL, NULL, NULL }, // colorburn
- { NULL, NULL, NULL }, // hardlight
- { NULL, NULL, NULL }, // softlight
- { NULL, NULL, NULL }, // difference
- { NULL, NULL, NULL }, // exclusion
- { NULL, NULL, NULL }, // multiply
- { NULL, NULL, NULL }, // hue
- { NULL, NULL, NULL }, // saturation
- { NULL, NULL, NULL }, // color
- { NULL, NULL, NULL }, // luminosity
-};
-
-SkXfermodeProc16 SkXfermode::GetProc16(Mode mode, SkColor srcColor) {
- SkXfermodeProc16 proc16 = NULL;
- if ((unsigned)mode < kModeCount) {
- const Proc16Rec& rec = gModeProcs16[mode];
- unsigned a = SkColorGetA(srcColor);
-
- if (0 == a) {
- proc16 = rec.fProc16_0;
- } else if (255 == a) {
- proc16 = rec.fProc16_255;
- } else {
- proc16 = rec.fProc16_General;
- }
- }
- return proc16;
-}
-
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
« no previous file with comments | « include/core/SkXfermode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698