Skip to content
Permalink
Browse files

Use min/max to pin value between 0 and 255.

bug:27210135
Change-Id: I377cd4a228312d47cd2ffa1d91e1a5535be5721e
(cherry picked from commit 6c3a6caae5b2e9cfe1f8188b7a9dc4d46072e7ea)
  • Loading branch information...
drWulf authored and andi34 committed May 23, 2016
1 parent d58a710 commit 4a0fbab72f72fa6d8d97f9f84733b28c18f0060e
Showing with 3 additions and 6 deletions.
  1. +3 −6 src/effects/SkArithmeticMode.cpp
@@ -18,6 +18,8 @@
#include "SkImageFilterUtils.h"
#endif

#include <algorithm>

static const bool gUseUnpremul = false;

class SkArithmeticMode_scalar : public SkXfermode {
@@ -60,12 +62,7 @@ class SkArithmeticMode_scalar : public SkXfermode {
};

static int pinToByte(int value) {
if (value < 0) {
value = 0;
} else if (value > 255) {
value = 255;
}
return value;
return std::max(0, std::min(255, value));
}

static int arith(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,

0 comments on commit 4a0fbab

Please sign in to comment.
You can’t perform that action at this time.