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

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

Issue 769953002: 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
25 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
26 23
27 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
28 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 25 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
29 #if SK_SUPPORT_GPU 26 #if SK_SUPPORT_GPU
30 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&, 27 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&,
31 const SkIRect& bounds) const SK_OVERRIDE; 28 const SkIRect& bounds) const SK_OVERRIDE;
32 #endif 29 #endif
33 30
34 private: 31 private:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 inout->mulByUnknownAlpha(); 228 inout->mulByUnknownAlpha();
232 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh old >= 1.f) { 229 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh old >= 1.f) {
233 inout->mulByUnknownOpaqueColor(); 230 inout->mulByUnknownOpaqueColor();
234 } else { 231 } else {
235 inout->mulByUnknownColor(); 232 inout->mulByUnknownColor();
236 } 233 }
237 } 234 }
238 235
239 #endif 236 #endif
240 237
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
250 SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) { 238 SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) {
251 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 239 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
252 SkScalar inner = buffer.readScalar(); 240 SkScalar inner = buffer.readScalar();
253 SkScalar outer = buffer.readScalar(); 241 SkScalar outer = buffer.readScalar();
254 SkRegion rgn; 242 SkRegion rgn;
255 buffer.readRegion(&rgn); 243 buffer.readRegion(&rgn);
256 return SkAlphaThresholdFilter::Create(rgn, inner, outer, common.getInput(0)) ; 244 return SkAlphaThresholdFilter::Create(rgn, inner, outer, common.getInput(0)) ;
257 } 245 }
258 246
259 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, 247 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 (U8CPU)(SkColorGetG(source) * scale), 366 (U8CPU)(SkColorGetG(source) * scale),
379 (U8CPU)(SkColorGetB(source) * scale)); 367 (U8CPU)(SkColorGetB(source) * scale));
380 } 368 }
381 } 369 }
382 dptr[y * dst->width() + x] = output_color; 370 dptr[y * dst->width() + x] = output_color;
383 } 371 }
384 } 372 }
385 373
386 return true; 374 return true;
387 } 375 }
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