Skip to content

Commit f967807

Browse files
Jason SamsAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug in grain." into jb-mr1-dev
2 parents a8309cb + f1c051b commit f967807

File tree

1 file changed

+4
-4
lines changed
  • tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image

1 file changed

+4
-4
lines changed

tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ int32_t gHeight;
4343

4444
rs_allocation gBlendSource;
4545
void blend9(uchar *out, uint32_t x, uint32_t y) {
46-
uint32_t x1 = min(x+1, (uint32_t)gWidth);
47-
uint32_t x2 = max(x-1, (uint32_t)0);
48-
uint32_t y1 = min(y+1, (uint32_t)gHeight);
49-
uint32_t y2 = max(y-1, (uint32_t)0);
46+
uint32_t x1 = min((int32_t)x+1, (int32_t)gWidth);
47+
uint32_t x2 = max((int32_t)x-1, (int32_t)0);
48+
uint32_t y1 = min((int32_t)y+1, (int32_t)gHeight);
49+
uint32_t y2 = max((int32_t)y-1, (int32_t)0);
5050

5151
uint p00 = 56 * ((uchar *)rsGetElementAt(gBlendSource, x1, y1))[0];
5252
uint p01 = 114 * ((uchar *)rsGetElementAt(gBlendSource, x, y1))[0];

0 commit comments

Comments
 (0)