code style
git-svn-id: http://skia.googlecode.com/svn/trunk@1160 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkEmbossMask.cpp b/src/effects/SkEmbossMask.cpp
index fd11f54..742ccd2 100644
--- a/src/effects/SkEmbossMask.cpp
+++ b/src/effects/SkEmbossMask.cpp
@@ -17,8 +17,7 @@
#include "SkEmbossMask.h"
-static inline int nonzero_to_one(int x)
-{
+static inline int nonzero_to_one(int x) {
#if 0
return x != 0;
#else
@@ -26,8 +25,7 @@
#endif
}
-static inline int neq_to_one(int x, int max)
-{
+static inline int neq_to_one(int x, int max) {
#if 0
return x != max;
#else
@@ -36,8 +34,7 @@
#endif
}
-static inline int neq_to_mask(int x, int max)
-{
+static inline int neq_to_mask(int x, int max) {
#if 0
return -(x != max);
#else
@@ -46,8 +43,7 @@
#endif
}
-static inline unsigned div255(unsigned x)
-{
+static inline unsigned div255(unsigned x) {
SkASSERT(x <= (255*255));
return x * ((1 << 24) / 255) >> 24;
}
@@ -60,28 +56,27 @@
#include <stdio.h>
-void SkEmbossMask_BuildTable()
-{
+void SkEmbossMask_BuildTable() {
// build it 0..127 x 0..127, so we use 2^15 - 1 in the numerator for our "fixed" table
FILE* file = ::fopen("SkEmbossMask_Table.h", "w");
SkASSERT(file);
::fprintf(file, "#include \"SkTypes.h\"\n\n");
::fprintf(file, "static const U16 gInvSqrtTable[128 * 128] = {\n");
- for (int dx = 0; dx <= 255/2; dx++)
- {
- for (int dy = 0; dy <= 255/2; dy++)
- {
+ for (int dx = 0; dx <= 255/2; dx++) {
+ for (int dy = 0; dy <= 255/2; dy++) {
if ((dy & 15) == 0)
::fprintf(file, "\t");
uint16_t value = SkToU16((1 << 15) / SkSqrt32(dx * dx + dy * dy + kDelta*kDelta/4));
::fprintf(file, "0x%04X", value);
- if (dx * 128 + dy < 128*128-1)
+ if (dx * 128 + dy < 128*128-1) {
::fprintf(file, ", ");
- if ((dy & 15) == 15)
+ }
+ if ((dy & 15) == 15) {
::fprintf(file, "\n");
+ }
}
}
::fprintf(file, "};\n#define kDeltaUsedToBuildTable\t%d\n", kDelta);
@@ -90,8 +85,7 @@
#endif
-void SkEmbossMask::Emboss(SkMask* mask, const SkEmbossMaskFilter::Light& light)
-{
+void SkEmbossMask::Emboss(SkMask* mask, const SkEmbossMaskFilter::Light& light) {
SkASSERT(kDelta == kDeltaUsedToBuildTable);
SkASSERT(mask->fFormat == SkMask::k3D_Format);
@@ -114,14 +108,11 @@
int maxx = mask->fBounds.width() - 1;
int prev_row = 0;
- for (int y = 0; y <= maxy; y++)
- {
+ for (int y = 0; y <= maxy; y++) {
int next_row = neq_to_mask(y, maxy) & rowBytes;
- for (int x = 0; x <= maxx; x++)
- {
- if (alpha[x])
- {
+ for (int x = 0; x <= maxx; x++) {
+ if (alpha[x]) {
int nx = alpha[x + neq_to_one(x, maxx)] - alpha[x - nonzero_to_one(x)];
int ny = alpha[x + next_row] - alpha[x - prev_row];
@@ -129,8 +120,7 @@
int mul = ambient;
int add = 0;
- if (numer > 0) // preflight when numer/denom will be <= 0
- {
+ if (numer > 0) { // preflight when numer/denom will be <= 0
#if 0
int denom = SkSqrt32(nx * nx + ny * ny + kDelta*kDelta);
SkFixed dot = numer / denom;
@@ -150,8 +140,7 @@
// hilite = R * Eye(0, 0, 1)
int hilite = (2 * dot - lz_dot8) * lz_dot8 >> 8;
- if (hilite > 0)
- {
+ if (hilite > 0) {
// pin hilite to 255, since our fast math is also a little sloppy
hilite = SkClampMax(hilite, 255);
@@ -160,8 +149,9 @@
// and then possibly cache a 256 table for a given specular
// value in the light, and just pass that in to this function.
add = hilite;
- for (int i = specular >> 4; i > 0; --i)
+ for (int i = specular >> 4; i > 0; --i) {
add = div255(add * hilite);
+ }
}
}
multiply[x] = SkToU8(mul);