00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SkUnPreMultiply_DEFINED
00021 #define SkUnPreMultiply_DEFINED
00022
00023 #include "SkColor.h"
00024
00025 class SkUnPreMultiply {
00026 public:
00027 typedef uint32_t Scale;
00028
00029
00030 static const Scale* GetScaleTable() {
00031 return gTable;
00032 }
00033
00034 static Scale GetScale(U8CPU alpha) {
00035 SkASSERT(alpha <= 255);
00036 return gTable[alpha];
00037 }
00038
00052 static U8CPU ApplyScale(Scale scale, U8CPU component) {
00053 SkASSERT(component <= 255);
00054 return (scale * component + (1 << 23)) >> 24;
00055 }
00056
00057 static SkColor PMColorToColor(SkPMColor c);
00058
00059 private:
00060 static const uint32_t gTable[256];
00061 };
00062
00063 #endif