Remove use of varargs in SkImageFilter. This is causing a crash in recent

builds of clang.  (It was also masking the fact that SkMergeImageFilter was
calling the wrong constructor!)

Review URL: https://codereview.appspot.com/6709066

git-svn-id: http://skia.googlecode.com/svn/trunk@6029 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2012-10-22 15:07:14 +00:00
Родитель d7bafb700c
Коммит c2e8cef479
6 изменённых файлов: 23 добавлений и 20 удалений

Просмотреть файл

@ -133,10 +133,11 @@ public:
protected: protected:
SkImageFilter(int inputCount, SkImageFilter** inputs); SkImageFilter(int inputCount, SkImageFilter** inputs);
// The ... represents inputCount SkImageFilter pointers, upon which this // Convenience constructor for 1-input filters.
// constructor will call SkSafeRef(). This is the same behaviour as explicit SkImageFilter(SkImageFilter* input);
// the SkImageFilter(int, SkImageFilter**) constructor above.
explicit SkImageFilter(int inputCount, ...); // Convenience constructor for 2-input filters.
SkImageFilter(SkImageFilter* input1, SkImageFilter* input2);
virtual ~SkImageFilter(); virtual ~SkImageFilter();

Просмотреть файл

@ -28,7 +28,7 @@ private:
class SK_API SkComposeImageFilter : public SkImageFilter { class SK_API SkComposeImageFilter : public SkImageFilter {
public: public:
SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(2, outer, inner) {} SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
virtual ~SkComposeImageFilter(); virtual ~SkComposeImageFilter();
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter) SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
@ -50,7 +50,7 @@ class SK_API SkMergeImageFilter : public SkImageFilter {
public: public:
SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second, SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
SkXfermode::Mode = SkXfermode::kSrcOver_Mode); SkXfermode::Mode = SkXfermode::kSrcOver_Mode);
SkMergeImageFilter(SkImageFilter* const filters[], int count, SkMergeImageFilter(SkImageFilter* filters[], int count,
const SkXfermode::Mode modes[] = NULL); const SkXfermode::Mode modes[] = NULL);
virtual ~SkMergeImageFilter(); virtual ~SkMergeImageFilter();

Просмотреть файл

@ -10,7 +10,6 @@
#include "SkBitmap.h" #include "SkBitmap.h"
#include "SkFlattenableBuffers.h" #include "SkFlattenableBuffers.h"
#include "SkRect.h" #include "SkRect.h"
#include "stdarg.h"
SK_DEFINE_INST_COUNT(SkImageFilter) SK_DEFINE_INST_COUNT(SkImageFilter)
@ -22,15 +21,18 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs)
} }
} }
SkImageFilter::SkImageFilter(int inputCount, ...) SkImageFilter::SkImageFilter(SkImageFilter* input)
: fInputCount(inputCount), fInputs(new SkImageFilter*[inputCount]) { : fInputCount(1), fInputs(new SkImageFilter*[1]) {
va_list ap; fInputs[0] = input;
va_start(ap, inputCount); SkSafeRef(fInputs[0]);
for (int i = 0; i < inputCount; ++i) { }
fInputs[i] = va_arg(ap, SkImageFilter*);
SkSafeRef(fInputs[i]); SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2)
} : fInputCount(2), fInputs(new SkImageFilter*[2]) {
va_end(ap); fInputs[0] = input1;
fInputs[1] = input2;
SkSafeRef(fInputs[0]);
SkSafeRef(fInputs[1]);
} }
SkImageFilter::~SkImageFilter() { SkImageFilter::~SkImageFilter() {

Просмотреть файл

@ -52,7 +52,7 @@ SkPMColor multiply_proc(SkPMColor src, SkPMColor dst) {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SkBlendImageFilter::SkBlendImageFilter(SkBlendImageFilter::Mode mode, SkImageFilter* background, SkImageFilter* foreground) SkBlendImageFilter::SkBlendImageFilter(SkBlendImageFilter::Mode mode, SkImageFilter* background, SkImageFilter* foreground)
: INHERITED(2, background, foreground), fMode(mode) : INHERITED(background, foreground), fMode(mode)
{ {
} }

Просмотреть файл

@ -15,7 +15,7 @@
#include "SkGrPixelRef.h" #include "SkGrPixelRef.h"
#endif #endif
SkSingleInputImageFilter::SkSingleInputImageFilter(SkImageFilter* input) : INHERITED(1, input) { SkSingleInputImageFilter::SkSingleInputImageFilter(SkImageFilter* input) : INHERITED(input) {
} }
SkSingleInputImageFilter::~SkSingleInputImageFilter() { SkSingleInputImageFilter::~SkSingleInputImageFilter() {

Просмотреть файл

@ -127,7 +127,7 @@ void SkMergeImageFilter::initModes(const SkXfermode::Mode modes[]) {
} }
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second, SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
SkXfermode::Mode mode) : INHERITED(2, first, second) { SkXfermode::Mode mode) : INHERITED(first, second) {
if (SkXfermode::kSrcOver_Mode != mode) { if (SkXfermode::kSrcOver_Mode != mode) {
SkXfermode::Mode modes[] = { mode, mode }; SkXfermode::Mode modes[] = { mode, mode };
this->initModes(modes); this->initModes(modes);
@ -136,7 +136,7 @@ SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* seco
} }
} }
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* const filters[], int count, SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
const SkXfermode::Mode modes[]) : INHERITED(count, filters) { const SkXfermode::Mode modes[]) : INHERITED(count, filters) {
this->initModes(modes); this->initModes(modes);
} }