Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1256)

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1937053002: Remove (almost) unused read/writeFunctionPtr API. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkValidatingReadBuffer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 protected: 59 protected:
60 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context& c tx, 60 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context& c tx,
61 SkIPoint* offset) const override { 61 SkIPoint* offset) const override {
62 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix); 62 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix);
63 offset->fX = offset->fY = 0; 63 offset->fX = offset->fY = 0;
64 return sk_ref_sp<SkSpecialImage>(source); 64 return sk_ref_sp<SkSpecialImage>(source);
65 } 65 }
66 66
67 void flatten(SkWriteBuffer& buffer) const override { 67 void flatten(SkWriteBuffer& buffer) const override {
68 this->INHERITED::flatten(buffer); 68 SkDEBUGFAIL("Should never get here");
69 buffer.writeFunctionPtr(fReporter);
70 buffer.writeMatrix(fExpectedMatrix);
71 } 69 }
72 70
73 private: 71 private:
74 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected Matrix) 72 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected Matrix)
75 : INHERITED(nullptr, 0, nullptr) 73 : INHERITED(nullptr, 0, nullptr)
76 , fReporter(reporter) 74 , fReporter(reporter)
77 , fExpectedMatrix(expectedMatrix) { 75 , fExpectedMatrix(expectedMatrix) {
78 } 76 }
79 77
80 skiatest::Reporter* fReporter; 78 skiatest::Reporter* fReporter;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void addFilter(const char* name, sk_sp<SkImageFilter> filter) { 280 void addFilter(const char* name, sk_sp<SkImageFilter> filter) {
283 fFilters.push_back(Filter(name, std::move(filter))); 281 fFilters.push_back(Filter(name, std::move(filter)));
284 } 282 }
285 283
286 SkTArray<Filter> fFilters; 284 SkTArray<Filter> fFilters;
287 }; 285 };
288 286
289 } 287 }
290 288
291 sk_sp<SkFlattenable> MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) { 289 sk_sp<SkFlattenable> MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) {
292 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 290 SkDEBUGFAIL("Should never get here");
293 skiatest::Reporter* reporter = (skiatest::Reporter*)buffer.readFunctionPtr() ; 291 return nullptr;
294 SkMatrix matrix;
295 buffer.readMatrix(&matrix);
296 return MatrixTestImageFilter::Make(reporter, matrix);
297 } 292 }
298 293
299 #ifndef SK_IGNORE_TO_STRING 294 #ifndef SK_IGNORE_TO_STRING
300 void MatrixTestImageFilter::toString(SkString* str) const { 295 void MatrixTestImageFilter::toString(SkString* str) const {
301 str->appendf("MatrixTestImageFilter: ("); 296 str->appendf("MatrixTestImageFilter: (");
302 str->append(")"); 297 str->append(")");
303 } 298 }
304 #endif 299 #endif
305 300
306 static sk_sp<SkImage> make_small_image() { 301 static sk_sp<SkImage> make_small_image() {
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 { SkColorFilterImageFilter::Make(cf, blif), false }, 1726 { SkColorFilterImageFilter::Make(cf, blif), false },
1732 { SkMergeImageFilter::Make(cfif, blif), false }, 1727 { SkMergeImageFilter::Make(cfif, blif), false },
1733 { SkComposeImageFilter::Make(blif, cfif), false }, 1728 { SkComposeImageFilter::Make(blif, cfif), false },
1734 }; 1729 };
1735 1730
1736 for (const auto& rec : recs) { 1731 for (const auto& rec : recs) {
1737 const bool canHandle = rec.fFilter->canHandleComplexCTM(); 1732 const bool canHandle = rec.fFilter->canHandleComplexCTM();
1738 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); 1733 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle);
1739 } 1734 }
1740 } 1735 }
OLDNEW
« no previous file with comments | « src/core/SkValidatingReadBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698