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

Side by Side Diff: tests/GpuColorFilterTest.cpp

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « tests/ColorMatrixTest.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // A color with unknown alpha filtered with DstOver produces an unknown color. 92 // A color with unknown alpha filtered with DstOver produces an unknown color.
93 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:: kDstOver_Mode, 0 , gr_black}, 93 { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode:: kDstOver_Mode, 0 , gr_black},
94 94
95 // An unknown color with known alpha and red component filtered with Mul tiply produces an unknown color with known red and alpha. 95 // An unknown color with known alpha and red component filtered with Mul tiply produces an unknown color with known red and alpha.
96 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode: :kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) } 96 { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode: :kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) }
97 }; 97 };
98 98
99 GrPaint paint; 99 GrPaint paint;
100 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { 100 for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) {
101 const GetConstantComponentTestCase& test = filterTests[i]; 101 const GetConstantComponentTestCase& test = filterTests[i];
102 SkAutoTUnref<SkColorFilter> cf( 102 auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode) );
103 SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode));
104 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(cont ext)); 103 SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(cont ext));
105 REPORTER_ASSERT(reporter, fp); 104 REPORTER_ASSERT(reporter, fp);
106 GrInvariantOutput inout(test.inputColor, 105 GrInvariantOutput inout(test.inputColor,
107 static_cast<GrColorComponentFlags>(test.inputCom ponents), 106 static_cast<GrColorComponentFlags>(test.inputCom ponents),
108 false); 107 false);
109 fp->computeInvariantOutput(&inout); 108 fp->computeInvariantOutput(&inout);
110 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags()) == 109 REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags()) ==
111 test.outputColor); 110 test.outputColor);
112 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags()); 111 REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags());
113 } 112 }
114 } 113 }
115 114
116 #endif 115 #endif
OLDNEW
« no previous file with comments | « tests/ColorMatrixTest.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698