aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/imagefilterscropped.cpp5
-rw-r--r--gm/lighting.cpp4
-rw-r--r--gm/morphology.cpp4
-rw-r--r--gm/offsetimagefilter.cpp4
-rw-r--r--gm/xfermodeimagefilter.cpp4
-rw-r--r--include/core/SkImageFilter.h9
-rw-r--r--src/core/SkImageFilter.cpp31
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp9
-rw-r--r--tests/ImageFilterTest.cpp4
9 files changed, 1 insertions, 73 deletions
diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp
index bdf925cc44..8f023f7208 100644
--- a/gm/imagefilterscropped.cpp
+++ b/gm/imagefilterscropped.cpp
@@ -133,13 +133,8 @@ protected:
SkAutoTUnref<SkColorFilter> cf(
SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect cropRect = SkIRect::MakeXYWH(10, 10, 44, 44);
- SkIRect bogusRect = SkIRect::MakeXYWH(-100, -100, 10, 10);
-#else
SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge);
SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge);
-#endif
SkAutoTUnref<SkImageFilter> offset(new SkOffsetImageFilter(
SkIntToScalar(-10), SkIntToScalar(-10)));
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index 50dceb44e1..ab2915d57d 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -85,11 +85,7 @@ protected:
SkColor white(0xFFFFFFFF);
SkPaint paint;
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect cropRect = SkIRect::MakeXYWH(20, 10, 60, 65);
-#else
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65));
-#endif
int y = 0;
for (int i = 0; i < 2; i++) {
diff --git a/gm/morphology.cpp b/gm/morphology.cpp
index 9e67bfaa73..756190ec03 100644
--- a/gm/morphology.cpp
+++ b/gm/morphology.cpp
@@ -70,11 +70,7 @@ protected:
{ 24, 24, 25, 25 },
};
SkPaint paint;
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80);
-#else
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80));
-#endif
for (unsigned j = 0; j < 4; ++j) {
for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) {
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp
index 52a8b817f2..2d77bbd243 100644
--- a/gm/offsetimagefilter.cpp
+++ b/gm/offsetimagefilter.cpp
@@ -92,11 +92,7 @@ protected:
y + i * 8,
bitmap->width() - i * 8,
bitmap->height() - i * 12);
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect rect = cropRect;
-#else
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
-#endif
SkAutoTUnref<SkImageFilter> tileInput(SkNEW_ARGS(SkBitmapSource, (*bitmap)));
SkScalar dx = SkIntToScalar(i*5);
SkScalar dy = SkIntToScalar(i*10);
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 1e9e4d87da..01bfe0ad61 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -207,11 +207,7 @@ protected:
y + offsets[i][1],
fBitmap.width() + offsets[i][2],
fBitmap.height() + offsets[i][3]);
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect rect = cropRect;
-#else
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
-#endif
mode.reset(SkXfermode::Create(sampledModes[i]));
filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
(mode, offsetBackground, offsetForeground, &rect)));
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 9f0e299391..6d659fad89 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -31,9 +31,6 @@ class SK_API SkImageFilter : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkImageFilter)
-#ifdef SK_CROP_RECT_IS_INT
- typedef SkIRect CropRect;
-#else
struct CropRect {
SkRect fRect;
uint32_t fFlags;
@@ -46,12 +43,12 @@ public:
};
CropRect() {}
explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {}
+ // Returns true if any of the crop edges have been set.
bool isSet() const
{
return fFlags != 0x0;
}
};
-#endif
class Proxy {
public:
@@ -160,11 +157,7 @@ public:
* "offset" parameter in onFilterImage and filterImageGPU(). (The latter
* ensures that the resulting buffer is drawn in the correct location.)
*/
-#ifdef SK_CROP_RECT_IS_INT
- bool cropRectIsSet() const { return !fCropRect.isLargest(); }
-#else
bool cropRectIsSet() const { return fCropRect.isSet(); }
-#endif
protected:
SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL);
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index c8c0c4dbf8..ee43c0e019 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -21,11 +21,7 @@ SK_DEFINE_INST_COUNT(SkImageFilter)
SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect)
: fInputCount(inputCount),
fInputs(new SkImageFilter*[inputCount]),
-#ifdef SK_CROP_RECT_IS_INT
- fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) {
-#else
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
-#endif
for (int i = 0; i < inputCount; ++i) {
fInputs[i] = inputs[i];
SkSafeRef(fInputs[i]);
@@ -35,22 +31,14 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
SkImageFilter::SkImageFilter(SkImageFilter* input, const CropRect* cropRect)
: fInputCount(1),
fInputs(new SkImageFilter*[1]),
-#ifdef SK_CROP_RECT_IS_INT
- fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) {
-#else
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
-#endif
fInputs[0] = input;
SkSafeRef(fInputs[0]);
}
SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect)
: fInputCount(2), fInputs(new SkImageFilter*[2]),
-#ifdef SK_CROP_RECT_IS_INT
- fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) {
-#else
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
-#endif
fInputs[0] = input1;
fInputs[1] = input2;
SkSafeRef(fInputs[0]);
@@ -73,12 +61,8 @@ SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer)
fInputs[i] = NULL;
}
}
-#ifdef SK_CROP_RECT_IS_INT
- buffer.readIRect(&fCropRect);
-#else
buffer.readRect(&fCropRect.fRect);
fCropRect.fFlags = buffer.readUInt();
-#endif
}
void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
@@ -90,12 +74,8 @@ void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
buffer.writeFlattenable(input);
}
}
-#ifdef SK_CROP_RECT_IS_INT
- buffer.writeIRect(fCropRect);
-#else
buffer.writeRect(fCropRect.fRect);
buffer.writeUInt(fCropRect.fFlags);
-#endif
}
bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
@@ -178,16 +158,6 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
bool SkImageFilter::applyCropRect(SkIRect* rect, const SkMatrix& matrix) const {
SkRect cropRect;
-#ifdef SK_CROP_RECT_IS_INT
- matrix.mapRect(&cropRect, SkRect::Make(fCropRect));
- SkIRect cropRectI;
- cropRect.roundOut(&cropRectI);
- // If the original crop rect edges were unset, max out the new crop edges
- if (fCropRect.fLeft == SK_MinS32) cropRectI.fLeft = SK_MinS32;
- if (fCropRect.fTop == SK_MinS32) cropRectI.fTop = SK_MinS32;
- if (fCropRect.fRight == SK_MaxS32) cropRectI.fRight = SK_MaxS32;
- if (fCropRect.fBottom == SK_MaxS32) cropRectI.fBottom = SK_MaxS32;
-#else
matrix.mapRect(&cropRect, fCropRect.fRect);
SkIRect cropRectI;
cropRect.roundOut(&cropRectI);
@@ -196,7 +166,6 @@ bool SkImageFilter::applyCropRect(SkIRect* rect, const SkMatrix& matrix) const {
if (!(fCropRect.fFlags & CropRect::kHasTop_CropEdge)) cropRectI.fTop = SK_MinS32;
if (!(fCropRect.fFlags & CropRect::kHasRight_CropEdge)) cropRectI.fRight = SK_MaxS32;
if (!(fCropRect.fFlags & CropRect::kHasBottom_CropEdge)) cropRectI.fBottom = SK_MaxS32;
-#endif
return rect->intersect(cropRectI);
}
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index e99899e191..81aa91ca71 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -14,20 +14,11 @@
SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRect& rect) {
SkASSERT(s);
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect cropRect;
- if (rect.width() == 0 || rect.height() == 0) {
- cropRect = SkIRect::MakeLargest();
- } else {
- rect.roundOut(&cropRect);
- }
-#else
uint32_t flags = CropRect::kHasAll_CropEdge;
if (rect.width() == 0 || rect.height() == 0) {
flags = 0x0;
}
CropRect cropRect(rect, flags);
-#endif
return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect));
}
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 4165f2f750..0722d14153 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -109,11 +109,7 @@ public:
{
// Check that a color filter image filter with a crop rect cannot
// be expressed as a color filter.
-#ifdef SK_CROP_RECT_IS_INT
- SkIRect cropRect = SkIRect::MakeXYWH(0, 0, 100, 100);
-#else
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(0, 0, 100, 100));
-#endif
SkAutoTUnref<SkImageFilter> grayWithCrop(make_grayscale(NULL, &cropRect));
REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(NULL));
}