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

Side by Side Diff: include/core/SkImageFilter.h

Issue 1571033002: remove imagefilter::sizeconstraint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | include/gpu/GrTextureProvider.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 2011 Google Inc. 2 * Copyright 2011 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 #ifndef SkImageFilter_DEFINED 8 #ifndef SkImageFilter_DEFINED
9 #define SkImageFilter_DEFINED 9 #define SkImageFilter_DEFINED
10 10
(...skipping 27 matching lines...) Expand all
38 struct Key; 38 struct Key;
39 virtual ~Cache() {} 39 virtual ~Cache() {}
40 static Cache* Create(size_t maxBytes); 40 static Cache* Create(size_t maxBytes);
41 static Cache* Get(); 41 static Cache* Get();
42 virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) con st = 0; 42 virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) con st = 0;
43 virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0; 43 virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0;
44 virtual void purge() {} 44 virtual void purge() {}
45 virtual void purgeByImageFilterId(uint32_t) {} 45 virtual void purgeByImageFilterId(uint32_t) {}
46 }; 46 };
47 47
48 enum SizeConstraint {
49 kExact_SizeConstraint,
50 kApprox_SizeConstraint,
51 };
52
53 class Context { 48 class Context {
54 public: 49 public:
55 Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache, 50 Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache)
56 SizeConstraint constraint)
57 : fCTM(ctm) 51 : fCTM(ctm)
58 , fClipBounds(clipBounds) 52 , fClipBounds(clipBounds)
59 , fCache(cache) 53 , fCache(cache)
60 , fSizeConstraint(constraint)
61 {} 54 {}
62 55
63 const SkMatrix& ctm() const { return fCTM; } 56 const SkMatrix& ctm() const { return fCTM; }
64 const SkIRect& clipBounds() const { return fClipBounds; } 57 const SkIRect& clipBounds() const { return fClipBounds; }
65 Cache* cache() const { return fCache; } 58 Cache* cache() const { return fCache; }
66 SizeConstraint sizeConstraint() const { return fSizeConstraint; }
67 59
68 private: 60 private:
69 SkMatrix fCTM; 61 SkMatrix fCTM;
70 SkIRect fClipBounds; 62 SkIRect fClipBounds;
71 Cache* fCache; 63 Cache* fCache;
72 SizeConstraint fSizeConstraint;
73 }; 64 };
74 65
75 class CropRect { 66 class CropRect {
76 public: 67 public:
77 enum CropEdge { 68 enum CropEdge {
78 kHasLeft_CropEdge = 0x01, 69 kHasLeft_CropEdge = 0x01,
79 kHasTop_CropEdge = 0x02, 70 kHasTop_CropEdge = 0x02,
80 kHasWidth_CropEdge = 0x04, 71 kHasWidth_CropEdge = 0x04,
81 kHasHeight_CropEdge = 0x08, 72 kHasHeight_CropEdge = 0x08,
82 kHasAll_CropEdge = 0x0F, 73 kHasAll_CropEdge = 0x0F,
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 * onFilterBounds(), this function is non-recursive. 357 * onFilterBounds(), this function is non-recursive.
367 */ 358 */
368 virtual void onFilterNodeBounds(const SkIRect&, const SkMatrix&, SkIRect*, M apDirection) const; 359 virtual void onFilterNodeBounds(const SkIRect&, const SkMatrix&, SkIRect*, M apDirection) const;
369 360
370 // Helper function which invokes filter processing on the input at the 361 // Helper function which invokes filter processing on the input at the
371 // specified "index". If the input is null, it leaves "result" and 362 // specified "index". If the input is null, it leaves "result" and
372 // "offset" untouched, and returns true. If the input is non-null, it 363 // "offset" untouched, and returns true. If the input is non-null, it
373 // calls filterImage() on that input, and returns true on success. 364 // calls filterImage() on that input, and returns true on success.
374 // i.e., return !getInput(index) || getInput(index)->filterImage(...); 365 // i.e., return !getInput(index) || getInput(index)->filterImage(...);
375 bool filterInput(int index, Proxy*, const SkBitmap& src, const Context&, 366 bool filterInput(int index, Proxy*, const SkBitmap& src, const Context&,
376 SkBitmap* result, SkIPoint* offset, bool relaxSizeConstrain t = true) const; 367 SkBitmap* result, SkIPoint* offset) const;
377 368
378 /** 369 /**
379 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a 370 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a
380 * colorfilter w/o CropRect constraints. 371 * colorfilter w/o CropRect constraints.
381 */ 372 */
382 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const { 373 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const {
383 return false; 374 return false;
384 } 375 }
385 376
386 /** Given a "src" bitmap and its "srcOffset", computes source and 377 /** Given a "src" bitmap and its "srcOffset", computes source and
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 */ 443 */
453 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 444 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
454 Common localVar; \ 445 Common localVar; \
455 do { \ 446 do { \
456 if (!localVar.unflatten(buffer, expectedCount)) { \ 447 if (!localVar.unflatten(buffer, expectedCount)) { \
457 return NULL; \ 448 return NULL; \
458 } \ 449 } \
459 } while (0) 450 } while (0)
460 451
461 #endif 452 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTextureProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698