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

Side by Side Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 643743003: Create helper functions to use in computeInvariantOutput calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update blurMaskFilter Created 6 years, 2 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/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.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 * 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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 bool AlphaThresholdEffect::onIsEqual(const GrProcessor& sBase) const { 224 bool AlphaThresholdEffect::onIsEqual(const GrProcessor& sBase) const {
225 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); 225 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>();
226 return (this->texture(0) == s.texture(0) && 226 return (this->texture(0) == s.texture(0) &&
227 this->fInnerThreshold == s.fInnerThreshold && 227 this->fInnerThreshold == s.fInnerThreshold &&
228 this->fOuterThreshold == s.fOuterThreshold); 228 this->fOuterThreshold == s.fOuterThreshold);
229 } 229 }
230 230
231 void AlphaThresholdEffect::onComputeInvariantOutput(InvariantOutput* inout) cons t { 231 void AlphaThresholdEffect::onComputeInvariantOutput(InvariantOutput* inout) cons t {
232 if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config())) { 232 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
233 inout->fValidFlags = kA_GrColorComponentFlag; 233 inout->mulByUnknownOpaqueColor();
234 } else { 234 } else {
235 inout->fValidFlags = 0; 235 inout->mulByUnknownColor();
236 } 236 }
237 inout->fIsSingleComponent = false;
238 } 237 }
239 238
240 #endif 239 #endif
241 240
242 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 241 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
243 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) 242 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer)
244 : INHERITED(1, buffer) { 243 : INHERITED(1, buffer) {
245 fInnerThreshold = buffer.readScalar(); 244 fInnerThreshold = buffer.readScalar();
246 fOuterThreshold = buffer.readScalar(); 245 fOuterThreshold = buffer.readScalar();
247 buffer.readRegion(&fRegion); 246 buffer.readRegion(&fRegion);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 (U8CPU)(SkColorGetG(source) * scale), 378 (U8CPU)(SkColorGetG(source) * scale),
380 (U8CPU)(SkColorGetB(source) * scale)); 379 (U8CPU)(SkColorGetB(source) * scale));
381 } 380 }
382 } 381 }
383 dptr[y * dst->width() + x] = output_color; 382 dptr[y * dst->width() + x] = output_color;
384 } 383 }
385 } 384 }
386 385
387 return true; 386 return true;
388 } 387 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698