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

Side by Side Diff: include/core/SkColorPriv.h

Issue 270473003: Make gMask_00FF00FF a constant (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const mask no-static Created 6 years, 7 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 | « no previous file | src/core/SkBitmapProcState_filter.h » ('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 #ifndef SkColorPriv_DEFINED 8 #ifndef SkColorPriv_DEFINED
9 #define SkColorPriv_DEFINED 9 #define SkColorPriv_DEFINED
10 10
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 SkB32Assert(b); 517 SkB32Assert(b);
518 518
519 if (a != 255) { 519 if (a != 255) {
520 r = SkMulDiv255Round(r, a); 520 r = SkMulDiv255Round(r, a);
521 g = SkMulDiv255Round(g, a); 521 g = SkMulDiv255Round(g, a);
522 b = SkMulDiv255Round(b, a); 522 b = SkMulDiv255Round(b, a);
523 } 523 }
524 return SkPackARGB32(a, r, g, b); 524 return SkPackARGB32(a, r, g, b);
525 } 525 }
526 526
527 SK_API extern const uint32_t gMask_00FF00FF;
528
529 static inline uint32_t SkAlphaMulQ(uint32_t c, unsigned scale) { 527 static inline uint32_t SkAlphaMulQ(uint32_t c, unsigned scale) {
530 uint32_t mask = gMask_00FF00FF; 528 uint32_t mask = 0xFF00FF;
531 529
532 uint32_t rb = ((c & mask) * scale) >> 8; 530 uint32_t rb = ((c & mask) * scale) >> 8;
533 uint32_t ag = ((c >> 8) & mask) * scale; 531 uint32_t ag = ((c >> 8) & mask) * scale;
534 return (rb & mask) | (ag & ~mask); 532 return (rb & mask) | (ag & ~mask);
535 } 533 }
536 534
537 static inline SkPMColor SkPMSrcOver(SkPMColor src, SkPMColor dst) { 535 static inline SkPMColor SkPMSrcOver(SkPMColor src, SkPMColor dst) {
538 return src + SkAlphaMulQ(dst, SkAlpha255To256(255 - SkGetPackedA32(src))); 536 return src + SkAlphaMulQ(dst, SkAlpha255To256(255 - SkGetPackedA32(src)));
539 } 537 }
540 538
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 unsigned g, unsigned b) { 778 unsigned g, unsigned b) {
781 SkASSERT(a <= 0xF); 779 SkASSERT(a <= 0xF);
782 SkASSERT(r <= a); 780 SkASSERT(r <= a);
783 SkASSERT(g <= a); 781 SkASSERT(g <= a);
784 SkASSERT(b <= a); 782 SkASSERT(b <= a);
785 783
786 return (SkPMColor16)((a << SK_A4444_SHIFT) | (r << SK_R4444_SHIFT) | 784 return (SkPMColor16)((a << SK_A4444_SHIFT) | (r << SK_R4444_SHIFT) |
787 (g << SK_G4444_SHIFT) | (b << SK_B4444_SHIFT)); 785 (g << SK_G4444_SHIFT) | (b << SK_B4444_SHIFT));
788 } 786 }
789 787
790 extern const uint16_t gMask_0F0F;
791
792 static inline U16CPU SkAlphaMulQ4(U16CPU c, unsigned scale) { 788 static inline U16CPU SkAlphaMulQ4(U16CPU c, unsigned scale) {
793 SkASSERT(scale <= 16); 789 SkASSERT(scale <= 16);
794 790
795 const unsigned mask = 0xF0F; //gMask_0F0F; 791 const unsigned mask = 0xF0F; //gMask_0F0F;
796 792
797 #if 0 793 #if 0
798 unsigned rb = ((c & mask) * scale) >> 4; 794 unsigned rb = ((c & mask) * scale) >> 4;
799 unsigned ag = ((c >> 4) & mask) * scale; 795 unsigned ag = ((c >> 4) & mask) * scale;
800 return (rb & mask) | (ag & ~mask); 796 return (rb & mask) | (ag & ~mask);
801 #else 797 #else
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 int srcG = SkColorGetG(src); 1048 int srcG = SkColorGetG(src);
1053 int srcB = SkColorGetB(src); 1049 int srcB = SkColorGetB(src);
1054 1050
1055 for (int i = 0; i < width; i++) { 1051 for (int i = 0; i < width; i++) {
1056 dst[i] = SkBlendLCD16Opaque(srcR, srcG, srcB, dst[i], mask[i], 1052 dst[i] = SkBlendLCD16Opaque(srcR, srcG, srcB, dst[i], mask[i],
1057 opaqueDst); 1053 opaqueDst);
1058 } 1054 }
1059 } 1055 }
1060 1056
1061 #endif 1057 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapProcState_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698