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

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

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/effects/Sk2DPathEffect.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"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 #include "SkRegion.h" 12 #include "SkRegion.h"
13 13
14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { 14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
15 public: 15 public:
16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, 16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
17 SkScalar outerThreshold, SkImageFilter* input); 17 SkScalar outerThreshold, SkImageFilter* input);
18 18
19 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) 19 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl)
20 20
21 protected: 21 protected:
22 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
23 explicit SkAlphaThresholdFilterImpl(SkReadBuffer& buffer);
24 #endif
22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 25 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
23 26
24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 27 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
25 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 28 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
26 #if SK_SUPPORT_GPU 29 #if SK_SUPPORT_GPU
27 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&, 30 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&,
28 const SkIRect& bounds) const SK_OVERRIDE; 31 const SkIRect& bounds) const SK_OVERRIDE;
29 #endif 32 #endif
30 33
31 private: 34 private:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 inout->mulByUnknownAlpha(); 231 inout->mulByUnknownAlpha();
229 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh old >= 1.f) { 232 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh old >= 1.f) {
230 inout->mulByUnknownOpaqueColor(); 233 inout->mulByUnknownOpaqueColor();
231 } else { 234 } else {
232 inout->mulByUnknownColor(); 235 inout->mulByUnknownColor();
233 } 236 }
234 } 237 }
235 238
236 #endif 239 #endif
237 240
241 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
242 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer)
243 : INHERITED(1, buffer) {
244 fInnerThreshold = buffer.readScalar();
245 fOuterThreshold = buffer.readScalar();
246 buffer.readRegion(&fRegion);
247 }
248 #endif
249
238 SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) { 250 SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) {
239 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 251 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
240 SkScalar inner = buffer.readScalar(); 252 SkScalar inner = buffer.readScalar();
241 SkScalar outer = buffer.readScalar(); 253 SkScalar outer = buffer.readScalar();
242 SkRegion rgn; 254 SkRegion rgn;
243 buffer.readRegion(&rgn); 255 buffer.readRegion(&rgn);
244 return SkAlphaThresholdFilter::Create(rgn, inner, outer, common.getInput(0)) ; 256 return SkAlphaThresholdFilter::Create(rgn, inner, outer, common.getInput(0)) ;
245 } 257 }
246 258
247 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, 259 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 (U8CPU)(SkColorGetG(source) * scale), 378 (U8CPU)(SkColorGetG(source) * scale),
367 (U8CPU)(SkColorGetB(source) * scale)); 379 (U8CPU)(SkColorGetB(source) * scale));
368 } 380 }
369 } 381 }
370 dptr[y * dst->width() + x] = output_color; 382 dptr[y * dst->width() + x] = output_color;
371 } 383 }
372 } 384 }
373 385
374 return true; 386 return true;
375 } 387 }
OLDNEW
« no previous file with comments | « src/effects/Sk2DPathEffect.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698