aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-10 13:51:19 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-10 13:51:19 +0000
commitb295fb6ff3222453912dfcb7a1ea5184d40014b5 (patch)
treee15812e8b5c505bce63d6a3b277be97456ecc23c /src/effects
parentf29c3802899c3e1e285a44140eb32cfa329764dc (diff)
Change SkImageFilter's cropRect from SkIRect to a CropRect struct, containing an SkRect and flags indicating which parameters are set.
NOTE: this will require SK_CROP_RECT_IS_INT=1 to be set in Chrome until Blink has been updated to use SkImageFilter::CropRect. Include https://codereview.chromium.org/26528002/ with the Skia roll. Note also that SK_CROP_RECT_IS_INT is a temporary measure until all call sites in Blink have been updated to use SkRect. R=reed@google.com Review URL: https://codereview.chromium.org/26371002 git-svn-id: http://skia.googlecode.com/svn/trunk@11692 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkBlurImageFilter.cpp2
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp6
-rw-r--r--src/effects/SkLightingImageFilter.cpp22
-rwxr-xr-xsrc/effects/SkMergeImageFilter.cpp4
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/effects/SkOffsetImageFilter.cpp4
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp2
7 files changed, 21 insertions, 21 deletions
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 3f97ddd59a..abbf9719db 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -24,7 +24,7 @@ SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer)
SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX,
SkScalar sigmaY,
SkImageFilter* input,
- const SkIRect* cropRect)
+ const CropRect* cropRect)
: INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) {
SkASSERT(sigmaX >= 0 && sigmaY >= 0);
}
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index cfda0b7e75..a756a4766c 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -57,7 +57,7 @@ bool matrix_needs_clamping(SkScalar matrix[20]) {
};
SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf,
- SkImageFilter* input, const SkIRect* cropRect) {
+ SkImageFilter* input, const CropRect* cropRect) {
SkASSERT(cf);
SkScalar colorMatrix[20], inputMatrix[20];
SkColorFilter* inputColorFilter;
@@ -76,7 +76,7 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf,
}
SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
- SkImageFilter* input, const SkIRect* cropRect)
+ SkImageFilter* input, const CropRect* cropRect)
: INHERITED(input, cropRect), fColorFilter(cf) {
SkASSERT(cf);
SkSafeRef(cf);
@@ -126,7 +126,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
}
bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
- if (cropRect().isLargest()) {
+ if (!cropRectIsSet()) {
if (filter) {
*filter = fColorFilter;
fColorFilter->ref();
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index aac54625fe..c28b317e22 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -260,7 +260,7 @@ void writePoint3(const SkPoint3& point, SkFlattenableWriteBuffer& buffer) {
class SkDiffuseLightingImageFilter : public SkLightingImageFilter {
public:
SkDiffuseLightingImageFilter(SkLight* light, SkScalar surfaceScale,
- SkScalar kd, SkImageFilter* input, const SkIRect* cropRect);
+ SkScalar kd, SkImageFilter* input, const CropRect* cropRect);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiffuseLightingImageFilter)
#if SK_SUPPORT_GPU
@@ -282,7 +282,7 @@ private:
class SkSpecularLightingImageFilter : public SkLightingImageFilter {
public:
- SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input, const SkIRect* cropRect);
+ SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input, const CropRect* cropRect);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSpecularLightingImageFilter)
#if SK_SUPPORT_GPU
@@ -797,7 +797,7 @@ const SkScalar SkSpotLight::kSpecularExponentMax = SkFloatToScalar(128.0f);
///////////////////////////////////////////////////////////////////////////////
-SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkImageFilter* input, const SkIRect* cropRect)
+SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkImageFilter* input, const CropRect* cropRect)
: INHERITED(input, cropRect),
fLight(light),
fSurfaceScale(SkScalarDiv(surfaceScale, SkIntToScalar(255)))
@@ -809,7 +809,7 @@ SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceSca
SkImageFilter* SkLightingImageFilter::CreateDistantLitDiffuse(
const SkPoint3& direction, SkColor lightColor, SkScalar surfaceScale,
- SkScalar kd, SkImageFilter* input, const SkIRect* cropRect) {
+ SkScalar kd, SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkDiffuseLightingImageFilter,
(SkNEW_ARGS(SkDistantLight, (direction, lightColor)), surfaceScale, kd,
input, cropRect));
@@ -817,7 +817,7 @@ SkImageFilter* SkLightingImageFilter::CreateDistantLitDiffuse(
SkImageFilter* SkLightingImageFilter::CreatePointLitDiffuse(
const SkPoint3& location, SkColor lightColor, SkScalar surfaceScale,
- SkScalar kd, SkImageFilter* input, const SkIRect* cropRect) {
+ SkScalar kd, SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkDiffuseLightingImageFilter,
(SkNEW_ARGS(SkPointLight, (location, lightColor)), surfaceScale, kd,
input, cropRect));
@@ -827,7 +827,7 @@ SkImageFilter* SkLightingImageFilter::CreateSpotLitDiffuse(
const SkPoint3& location, const SkPoint3& target,
SkScalar specularExponent, SkScalar cutoffAngle,
SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
- SkImageFilter* input, const SkIRect* cropRect) {
+ SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkDiffuseLightingImageFilter,
(SkNEW_ARGS(SkSpotLight, (location, target, specularExponent,
cutoffAngle, lightColor)),
@@ -836,7 +836,7 @@ SkImageFilter* SkLightingImageFilter::CreateSpotLitDiffuse(
SkImageFilter* SkLightingImageFilter::CreateDistantLitSpecular(
const SkPoint3& direction, SkColor lightColor, SkScalar surfaceScale,
- SkScalar ks, SkScalar shininess, SkImageFilter* input, const SkIRect* cropRect) {
+ SkScalar ks, SkScalar shininess, SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkSpecularLightingImageFilter,
(SkNEW_ARGS(SkDistantLight, (direction, lightColor)),
surfaceScale, ks, shininess, input, cropRect));
@@ -844,7 +844,7 @@ SkImageFilter* SkLightingImageFilter::CreateDistantLitSpecular(
SkImageFilter* SkLightingImageFilter::CreatePointLitSpecular(
const SkPoint3& location, SkColor lightColor, SkScalar surfaceScale,
- SkScalar ks, SkScalar shininess, SkImageFilter* input, const SkIRect* cropRect) {
+ SkScalar ks, SkScalar shininess, SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkSpecularLightingImageFilter,
(SkNEW_ARGS(SkPointLight, (location, lightColor)),
surfaceScale, ks, shininess, input, cropRect));
@@ -854,7 +854,7 @@ SkImageFilter* SkLightingImageFilter::CreateSpotLitSpecular(
const SkPoint3& location, const SkPoint3& target,
SkScalar specularExponent, SkScalar cutoffAngle,
SkColor lightColor, SkScalar surfaceScale,
- SkScalar ks, SkScalar shininess, SkImageFilter* input, const SkIRect* cropRect) {
+ SkScalar ks, SkScalar shininess, SkImageFilter* input, const CropRect* cropRect) {
return SkNEW_ARGS(SkSpecularLightingImageFilter,
(SkNEW_ARGS(SkSpotLight, (location, target, specularExponent, cutoffAngle, lightColor)),
surfaceScale, ks, shininess, input, cropRect));
@@ -879,7 +879,7 @@ void SkLightingImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
///////////////////////////////////////////////////////////////////////////////
-SkDiffuseLightingImageFilter::SkDiffuseLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar kd, SkImageFilter* input, const SkIRect* cropRect = NULL)
+SkDiffuseLightingImageFilter::SkDiffuseLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar kd, SkImageFilter* input, const CropRect* cropRect = NULL)
: SkLightingImageFilter(light, surfaceScale, input, cropRect),
fKD(kd)
{
@@ -954,7 +954,7 @@ bool SkDiffuseLightingImageFilter::asNewEffect(GrEffectRef** effect, GrTexture*
///////////////////////////////////////////////////////////////////////////////
-SkSpecularLightingImageFilter::SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input, const SkIRect* cropRect)
+SkSpecularLightingImageFilter::SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input, const CropRect* cropRect)
: SkLightingImageFilter(light, surfaceScale, input, cropRect),
fKS(ks),
fShininess(shininess)
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 020533046d..7d12ebe06e 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -40,7 +40,7 @@ void SkMergeImageFilter::initModes(const SkXfermode::Mode modes[]) {
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
SkXfermode::Mode mode,
- const SkIRect* cropRect) : INHERITED(first, second, cropRect) {
+ const CropRect* cropRect) : INHERITED(first, second, cropRect) {
if (SkXfermode::kSrcOver_Mode != mode) {
SkXfermode::Mode modes[] = { mode, mode };
this->initModes(modes);
@@ -51,7 +51,7 @@ SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* seco
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
const SkXfermode::Mode modes[],
- const SkIRect* cropRect) : INHERITED(count, filters, cropRect) {
+ const CropRect* cropRect) : INHERITED(count, filters, cropRect) {
this->initModes(modes);
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 8b314c8770..d02e8cae6e 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -25,7 +25,7 @@ SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
fRadius.fHeight = buffer.readInt();
}
-SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, const SkIRect* cropRect)
+SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect)
: INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) {
}
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp
index 3b98160841..d684ded368 100644
--- a/src/effects/SkOffsetImageFilter.cpp
+++ b/src/effects/SkOffsetImageFilter.cpp
@@ -19,7 +19,7 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
SkIPoint* loc) {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
- if (cropRect().isLargest()) {
+ if (!cropRectIsSet()) {
if (input && !input->filterImage(proxy, source, matrix, &src, loc)) {
return false;
}
@@ -71,7 +71,7 @@ void SkOffsetImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
}
SkOffsetImageFilter::SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input,
- const SkIRect* cropRect) : INHERITED(input, cropRect) {
+ const CropRect* cropRect) : INHERITED(input, cropRect) {
fOffset.set(dx, dy);
}
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 8491292c26..5175fd4890 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -23,7 +23,7 @@
SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode,
SkImageFilter* background,
SkImageFilter* foreground,
- const SkIRect* cropRect)
+ const CropRect* cropRect)
: INHERITED(background, foreground, cropRect), fMode(mode) {
SkSafeRef(fMode);
}