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

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

Issue 1762013002: Swap over to using SkImageFilter::filterImage instead of filterImageDeprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@if-fragment
Patch Set: Fix no-GPU build Created 4 years, 9 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 | src/core/SkCanvas.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 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // false then the filter's code will be called. 130 // false then the filter's code will be called.
131 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag eFilter::Context&, 131 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag eFilter::Context&,
132 SkBitmap* result, SkIPoint* offset) override; 132 SkBitmap* result, SkIPoint* offset) override;
133 133
134 private: 134 private:
135 SkBaseDevice* fDevice; 135 SkBaseDevice* fDevice;
136 }; 136 };
137 137
138 /** 138 /**
139 * Request a new (result) image to be created from the src image. 139 * Request a new (result) image to be created from the src image.
140 * If the src has no pixels (isNull()) then the request just wants to
141 * receive the config and width/height of the result.
142 * 140 *
143 * The matrix is the current matrix on the canvas. 141 * The context contains the environment in which the filter is occurring.
142 * It includes the clip bounds, CTM and cache.
144 * 143 *
145 * Offset is the amount to translate the resulting image relative to the 144 * Offset is the amount to translate the resulting image relative to the
146 * src when it is drawn. This is an out-param. 145 * src when it is drawn. This is an out-param.
147 * 146 *
148 * If the result image cannot be created, return false, in which case both 147 * If the result image cannot be created, return null, in which case
149 * the result and offset parameters will be ignored by the caller. 148 * the offset parameters will be ignored by the caller.
149 *
150 * TODO: Right now the imagefilters sometimes return empty result bitmaps/
151 * specialimages. That doesn't seem quite right.
150 */ 152 */
151 bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
152 SkBitmap* result, SkIPoint* offset) const;
153
154 SkSpecialImage* filterImage(SkSpecialImage* src, const Context&, SkIPoint* o ffset) const; 153 SkSpecialImage* filterImage(SkSpecialImage* src, const Context&, SkIPoint* o ffset) const;
155 154
156 enum MapDirection { 155 enum MapDirection {
157 kForward_MapDirection, 156 kForward_MapDirection,
158 kReverse_MapDirection 157 kReverse_MapDirection
159 }; 158 };
160 /** 159 /**
161 * Map a device-space rect recursively forward or backward through the 160 * Map a device-space rect recursively forward or backward through the
162 * filter DAG. kForward_MapDirection is used to determine which pixels of 161 * filter DAG. kForward_MapDirection is used to determine which pixels of
163 * the destination canvas a source image rect would touch after filtering. 162 * the destination canvas a source image rect would touch after filtering.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 * The clip bounds are adjusted to accommodate any margins that this 452 * The clip bounds are adjusted to accommodate any margins that this
454 * filter requires by calling this node's 453 * filter requires by calling this node's
455 * onFilterNodeBounds(..., kReverse_MapDirection). 454 * onFilterNodeBounds(..., kReverse_MapDirection).
456 */ 455 */
457 Context mapContext(const Context& ctx) const; 456 Context mapContext(const Context& ctx) const;
458 457
459 private: 458 private:
460 friend class SkGraphics; 459 friend class SkGraphics;
461 static void PurgeCache(); 460 static void PurgeCache();
462 461
462 bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
463 SkBitmap* result, SkIPoint* offset) const;
464
463 bool usesSrcInput() const { return fUsesSrcInput; } 465 bool usesSrcInput() const { return fUsesSrcInput; }
464 466
465 typedef SkFlattenable INHERITED; 467 typedef SkFlattenable INHERITED;
466 int fInputCount; 468 int fInputCount;
467 SkImageFilter** fInputs; 469 SkImageFilter** fInputs;
468 bool fUsesSrcInput; 470 bool fUsesSrcInput;
469 CropRect fCropRect; 471 CropRect fCropRect;
470 uint32_t fUniqueID; // Globally unique 472 uint32_t fUniqueID; // Globally unique
471 mutable SkTArray<Cache::Key> fCacheKeys; 473 mutable SkTArray<Cache::Key> fCacheKeys;
472 mutable SkMutex fMutex; 474 mutable SkMutex fMutex;
473 }; 475 };
474 476
475 /** 477 /**
476 * Helper to unflatten the common data, and return NULL if we fail. 478 * Helper to unflatten the common data, and return NULL if we fail.
477 */ 479 */
478 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 480 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
479 Common localVar; \ 481 Common localVar; \
480 do { \ 482 do { \
481 if (!localVar.unflatten(buffer, expectedCount)) { \ 483 if (!localVar.unflatten(buffer, expectedCount)) { \
482 return NULL; \ 484 return NULL; \
483 } \ 485 } \
484 } while (0) 486 } while (0)
485 487
486 #endif 488 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698