| Index: samplecode/SampleText.cpp
|
| diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
|
| index c56ebc8b90f9f8262fdf5c9cb147192b8a3f8caa..17456b2ee988e6cbfca5d02d6caa1fba434db5a3 100644
|
| --- a/samplecode/SampleText.cpp
|
| +++ b/samplecode/SampleText.cpp
|
| @@ -63,74 +63,6 @@ static void test_breakText() {
|
| SkASSERT(mm == width);
|
| }
|
|
|
| -static SkRandom gRand;
|
| -
|
| -class SkPowerMode : public SkXfermode {
|
| -public:
|
| - SkPowerMode(SkScalar exponent) { this->init(exponent); }
|
| -
|
| - virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
|
| - const SkAlpha aa[]) const SK_OVERRIDE;
|
| -
|
| - typedef SkFlattenable* (*Factory)(SkReadBuffer&);
|
| -
|
| - SK_TO_STRING_OVERRIDE()
|
| - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPowerMode)
|
| -
|
| -private:
|
| - SkScalar fExp; // user's value
|
| - uint8_t fTable[256]; // cache
|
| -
|
| - void init(SkScalar exponent);
|
| - SkPowerMode(SkReadBuffer& b) : INHERITED(b) {
|
| - // read the exponent
|
| - this->init(SkFixedToScalar(b.readFixed()));
|
| - }
|
| - virtual void flatten(SkWriteBuffer& b) const SK_OVERRIDE {
|
| - this->INHERITED::flatten(b);
|
| - b.writeFixed(SkScalarToFixed(fExp));
|
| - }
|
| -
|
| - typedef SkXfermode INHERITED;
|
| -};
|
| -
|
| -void SkPowerMode::init(SkScalar e) {
|
| - fExp = e;
|
| - float ee = SkScalarToFloat(e);
|
| -
|
| - printf("------ %g\n", ee);
|
| - for (int i = 0; i < 256; i++) {
|
| - float x = i / 255.f;
|
| - // printf(" %d %g", i, x);
|
| - x = powf(x, ee);
|
| - // printf(" %g", x);
|
| - int xx = SkScalarRoundToInt(x * 255);
|
| - // printf(" %d\n", xx);
|
| - fTable[i] = SkToU8(xx);
|
| - }
|
| -}
|
| -
|
| -void SkPowerMode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
|
| - const SkAlpha aa[]) const {
|
| - for (int i = 0; i < count; i++) {
|
| - SkPMColor c = src[i];
|
| - int r = SkGetPackedR32(c);
|
| - int g = SkGetPackedG32(c);
|
| - int b = SkGetPackedB32(c);
|
| - r = fTable[r];
|
| - g = fTable[g];
|
| - b = fTable[b];
|
| - dst[i] = SkPack888ToRGB16(r, g, b);
|
| - }
|
| -}
|
| -
|
| -#ifndef SK_IGNORE_TO_STRING
|
| -void SkPowerMode::toString(SkString* str) const {
|
| - str->append("SkPowerMode: exponent ");
|
| - str->appendScalar(fExp);
|
| -}
|
| -#endif
|
| -
|
| static const struct {
|
| const char* fName;
|
| uint32_t fFlags;
|
|
|