Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6475053
git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleEncode.cpp b/samplecode/SampleEncode.cpp
index 6999a06..afcde03 100644
--- a/samplecode/SampleEncode.cpp
+++ b/samplecode/SampleEncode.cpp
@@ -28,13 +28,13 @@
const int width = 98;
const int height = 100;
SkBitmap device;
-
+
device.setConfig(SkBitmap::kARGB_8888_Config, width, height);
device.allocPixels();
SkCanvas canvas(device);
SkPaint paint;
-
+
paint.setAntiAlias(true);
canvas.drawColor(SK_ColorRED);
paint.setColor(SK_ColorBLUE);
@@ -67,7 +67,7 @@
SkColorTable* ctable = new SkColorTable(colors, 256);
bm->allocPixels(ctable);
ctable->unref();
-
+
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
*bm->getAddr8(x, y) = SkGetPackedR32(*device.getAddr32(x, y));
@@ -118,22 +118,22 @@
SkBitmap* fBitmaps;
size_t fBitmapCount;
- EncodeView() {
+ EncodeView() {
#if 1
(void)mkdir(gPath, S_IRWXU | S_IRWXG | S_IRWXO);
-
+
fBitmapCount = SK_ARRAY_COUNT(gConfigs);
fBitmaps = new SkBitmap[fBitmapCount];
for (size_t i = 0; i < fBitmapCount; i++) {
make_image(&fBitmaps[i], gConfigs[i], i);
-
+
for (size_t j = 0; j < SK_ARRAY_COUNT(gExt); j++) {
SkString path;
make_name(&path, i, j);
-
+
// remove any previous run of this file
remove(path.c_str());
-
+
SkImageEncoder* codec = SkImageEncoder::Create(gTypes[j]);
if (NULL == codec ||
!codec->encodeFile(path.c_str(), fBitmaps[i], 100)) {
@@ -149,11 +149,11 @@
#endif
this->setBGColor(0xFFDDDDDD);
}
-
+
virtual ~EncodeView() {
delete[] fBitmaps;
}
-
+
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
@@ -163,21 +163,21 @@
}
return this->INHERITED::onQuery(evt);
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fBitmapCount == 0) {
return;
}
-
+
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextAlign(SkPaint::kCenter_Align);
-
+
canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
-
+
SkScalar x = 0, y = 0, maxX = 0;
const int SPACER = 10;
-
+
for (size_t i = 0; i < fBitmapCount; i++) {
canvas->drawText(gConfigLabels[i], strlen(gConfigLabels[i]),
x + SkIntToScalar(fBitmaps[i].width()) / 2, 0,
@@ -185,20 +185,20 @@
y = paint.getTextSize();
canvas->drawBitmap(fBitmaps[i], x, y);
-
+
SkScalar yy = y;
for (size_t j = 0; j < SK_ARRAY_COUNT(gExt); j++) {
yy += SkIntToScalar(fBitmaps[i].height() + 10);
SkBitmap bm;
SkString name;
-
+
make_name(&name, i, j);
-
+
SkImageDecoder::DecodeFile(name.c_str(), &bm);
canvas->drawBitmap(bm, x, yy);
}
-
+
x += SkIntToScalar(fBitmaps[i].width() + SPACER);
if (x > maxX) {
maxX = x;
@@ -214,12 +214,12 @@
y += SkIntToScalar(fBitmaps[0].height() + SPACER);
}
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
this->inval(NULL);
return this->INHERITED::onFindClickHandler(x, y);
}
-
+
private:
typedef SampleView INHERITED;
};