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

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

Issue 1500373003: SkAlphaThresholdFilter allow flattening (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « gyp/effects.gypi ('k') | src/effects/SkAlphaThresholdFilterImpl.h » ('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 "SkAlphaThresholdFilterImpl.h"
9 #include "SkBitmap.h" 10 #include "SkBitmap.h"
10 #include "SkDevice.h" 11 #include "SkDevice.h"
11 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
13 #include "SkRegion.h" 14 #include "SkRegion.h"
14 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
15 #include "GrDrawContext.h" 16 #include "GrDrawContext.h"
16 #endif 17 #endif
17 18
18 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
mtklein 2015/12/07 16:47:10 Why can't this stay here in the .cpp file? Seems
19 public:
20 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
21 SkScalar outerThreshold, SkImageFilter* input);
22
23 SK_TO_STRING_OVERRIDE()
24 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl)
25
26 protected:
27 void flatten(SkWriteBuffer&) const override;
28
29 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
30 SkBitmap* result, SkIPoint* offset) const override;
31 #if SK_SUPPORT_GPU
32 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
33 const SkIRect& bounds) const override;
34 #endif
35
36 private:
37 SkRegion fRegion;
38 SkScalar fInnerThreshold;
39 SkScalar fOuterThreshold;
40 typedef SkImageFilter INHERITED;
41 };
42
43 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, 19 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
44 SkScalar innerThreshold, 20 SkScalar innerThreshold,
45 SkScalar outerThreshold, 21 SkScalar outerThreshold,
46 SkImageFilter* input) { 22 SkImageFilter* input) {
47 return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold , input); 23 return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold , input);
48 } 24 }
49 25
50 #if SK_SUPPORT_GPU 26 #if SK_SUPPORT_GPU
51 #include "GrContext.h" 27 #include "GrContext.h"
52 #include "GrCoordTransform.h" 28 #include "GrCoordTransform.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 347 }
372 348
373 #ifndef SK_IGNORE_TO_STRING 349 #ifndef SK_IGNORE_TO_STRING
374 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 350 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
375 str->appendf("SkAlphaThresholdImageFilter: ("); 351 str->appendf("SkAlphaThresholdImageFilter: (");
376 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 352 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
377 str->append(")"); 353 str->append(")");
378 } 354 }
379 #endif 355 #endif
380 356
OLDNEW
« no previous file with comments | « gyp/effects.gypi ('k') | src/effects/SkAlphaThresholdFilterImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698