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

Unified Diff: samplecode/SampleText.cpp

Issue 393063002: remove dead code from sample (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698