Move SkComposeImageFilter into its own {.h, .cpp} files
In http://crrev.com/21154002, SkComposeImageFilter will be used outside of tests. Consequently, this moves SkComposeImageFilter from SkTestImageFilters.{h, cpp} into its own {.h, .cpp} files. BUG=181613 R=senorblanco@chromium.org Author: ajuma@chromium.org Review URL: https://chromiumcodereview.appspot.com/22438003 git-svn-id: http://skia.googlecode.com/svn/trunk@10591 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
7ca6d2f070
commit
1c4c9ef437
@ -13,6 +13,7 @@
|
||||
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkColorFilterImageFilter.h"
|
||||
#include "SkComposeImageFilter.h"
|
||||
#include "SkMergeImageFilter.h"
|
||||
#include "SkOffsetImageFilter.h"
|
||||
#include "SkTestImageFilters.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
'<(skia_src_path)/effects/SkColorFilterImageFilter.cpp',
|
||||
'<(skia_src_path)/effects/SkColorMatrix.cpp',
|
||||
'<(skia_src_path)/effects/SkColorMatrixFilter.cpp',
|
||||
'<(skia_src_path)/effects/SkComposeImageFilter.cpp',
|
||||
'<(skia_src_path)/effects/SkCornerPathEffect.cpp',
|
||||
'<(skia_src_path)/effects/SkDashPathEffect.cpp',
|
||||
'<(skia_src_path)/effects/SkDiscretePathEffect.cpp',
|
||||
|
31
include/effects/SkComposeImageFilter.h
Normal file
31
include/effects/SkComposeImageFilter.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkComposeImageFilter_DEFINED
|
||||
#define SkComposeImageFilter_DEFINED
|
||||
|
||||
#include "SkImageFilter.h"
|
||||
|
||||
class SK_API SkComposeImageFilter : public SkImageFilter {
|
||||
public:
|
||||
SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
|
||||
virtual ~SkComposeImageFilter();
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
|
||||
|
||||
protected:
|
||||
explicit SkComposeImageFilter(SkFlattenableReadBuffer& buffer);
|
||||
|
||||
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
|
||||
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
|
||||
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
typedef SkImageFilter INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
@ -4,26 +4,6 @@
|
||||
#include "SkImageFilter.h"
|
||||
#include "SkPoint.h"
|
||||
|
||||
class SK_API SkComposeImageFilter : public SkImageFilter {
|
||||
public:
|
||||
SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
|
||||
virtual ~SkComposeImageFilter();
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
|
||||
|
||||
protected:
|
||||
SkComposeImageFilter(SkFlattenableReadBuffer& buffer);
|
||||
|
||||
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
|
||||
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
|
||||
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
typedef SkImageFilter INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Fun mode that scales down (only) and then scales back up to look pixelated
|
||||
class SK_API SkDownSampleImageFilter : public SkImageFilter {
|
||||
public:
|
||||
|
56
src/effects/SkComposeImageFilter.cpp
Normal file
56
src/effects/SkComposeImageFilter.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkBitmap.h"
|
||||
#include "SkComposeImageFilter.h"
|
||||
#include "SkFlattenableBuffers.h"
|
||||
|
||||
SkComposeImageFilter::~SkComposeImageFilter() {
|
||||
}
|
||||
|
||||
bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
|
||||
const SkBitmap& src,
|
||||
const SkMatrix& ctm,
|
||||
SkBitmap* result,
|
||||
SkIPoint* loc) {
|
||||
SkImageFilter* outer = getInput(0);
|
||||
SkImageFilter* inner = getInput(1);
|
||||
|
||||
if (!outer && !inner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outer || !inner) {
|
||||
return (outer ? outer : inner)->filterImage(proxy, src, ctm, result, loc);
|
||||
}
|
||||
|
||||
SkBitmap tmp;
|
||||
return inner->filterImage(proxy, src, ctm, &tmp, loc) &&
|
||||
outer->filterImage(proxy, tmp, ctm, result, loc);
|
||||
}
|
||||
|
||||
bool SkComposeImageFilter::onFilterBounds(const SkIRect& src,
|
||||
const SkMatrix& ctm,
|
||||
SkIRect* dst) {
|
||||
SkImageFilter* outer = getInput(0);
|
||||
SkImageFilter* inner = getInput(1);
|
||||
|
||||
if (!outer && !inner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outer || !inner) {
|
||||
return (outer ? outer : inner)->filterBounds(src, ctm, dst);
|
||||
}
|
||||
|
||||
SkIRect tmp;
|
||||
return inner->filterBounds(src, ctm, &tmp) &&
|
||||
outer->filterBounds(tmp, ctm, dst);
|
||||
}
|
||||
|
||||
SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
|
||||
}
|
@ -20,54 +20,6 @@ public:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkComposeImageFilter::~SkComposeImageFilter() {
|
||||
}
|
||||
|
||||
bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
|
||||
const SkBitmap& src,
|
||||
const SkMatrix& ctm,
|
||||
SkBitmap* result,
|
||||
SkIPoint* loc) {
|
||||
SkImageFilter* outer = getInput(0);
|
||||
SkImageFilter* inner = getInput(1);
|
||||
|
||||
if (!outer && !inner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outer || !inner) {
|
||||
return (outer ? outer : inner)->filterImage(proxy, src, ctm, result, loc);
|
||||
}
|
||||
|
||||
SkBitmap tmp;
|
||||
return inner->filterImage(proxy, src, ctm, &tmp, loc) &&
|
||||
outer->filterImage(proxy, tmp, ctm, result, loc);
|
||||
}
|
||||
|
||||
bool SkComposeImageFilter::onFilterBounds(const SkIRect& src,
|
||||
const SkMatrix& ctm,
|
||||
SkIRect* dst) {
|
||||
SkImageFilter* outer = getInput(0);
|
||||
SkImageFilter* inner = getInput(1);
|
||||
|
||||
if (!outer && !inner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outer || !inner) {
|
||||
return (outer ? outer : inner)->filterBounds(src, ctm, dst);
|
||||
}
|
||||
|
||||
SkIRect tmp;
|
||||
return inner->filterBounds(src, ctm, &tmp) &&
|
||||
outer->filterBounds(tmp, ctm, dst);
|
||||
}
|
||||
|
||||
SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
|
||||
const SkMatrix&,
|
||||
SkBitmap* result, SkIPoint*) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "SkColorMatrixFilter.h"
|
||||
#include "SkColorShader.h"
|
||||
#include "SkColorTable.h"
|
||||
#include "SkComposeImageFilter.h"
|
||||
#include "SkComposeShader.h"
|
||||
#include "SkCornerPathEffect.h"
|
||||
#include "SkDashPathEffect.h"
|
||||
|
Loading…
Reference in New Issue
Block a user