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

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

Issue 1826893002: Switch new SkImageFilter internal methods over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change method name to drawSpriteWithFilter 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 | « include/core/SkDevice.h ('k') | include/effects/SkBlurImageFilter.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * 143 *
144 * 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
145 * src when it is drawn. This is an out-param. 145 * src when it is drawn. This is an out-param.
146 * 146 *
147 * If the result image cannot be created, return null, in which case 147 * If the result image cannot be created, return null, in which case
148 * the offset parameters will be ignored by the caller. 148 * the offset parameters will be ignored by the caller.
149 * 149 *
150 * TODO: Right now the imagefilters sometimes return empty result bitmaps/ 150 * TODO: Right now the imagefilters sometimes return empty result bitmaps/
151 * specialimages. That doesn't seem quite right. 151 * specialimages. That doesn't seem quite right.
152 */ 152 */
153 SkSpecialImage* filterImage(SkSpecialImage* src, const Context&, SkIPoint* o ffset) const; 153 sk_sp<SkSpecialImage> filterImage(SkSpecialImage* src, const Context&, SkIPo int* offset) const;
154 154
155 enum MapDirection { 155 enum MapDirection {
156 kForward_MapDirection, 156 kForward_MapDirection,
157 kReverse_MapDirection 157 kReverse_MapDirection
158 }; 158 };
159 /** 159 /**
160 * Map a device-space rect recursively forward or backward through the 160 * Map a device-space rect recursively forward or backward through the
161 * filter DAG. kForward_MapDirection is used to determine which pixels of 161 * filter DAG. kForward_MapDirection is used to determine which pixels of
162 * the destination canvas a source image rect would touch after filtering. 162 * the destination canvas a source image rect would touch after filtering.
163 * kReverse_MapDirection is used to determine which rect of the source 163 * kReverse_MapDirection is used to determine which rect of the source
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 */ 257 */
258 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const; 258 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const;
259 259
260 /** 260 /**
261 * Create an SkMatrixImageFilter, which transforms its input by the given ma trix. 261 * Create an SkMatrixImageFilter, which transforms its input by the given ma trix.
262 */ 262 */
263 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, 263 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix,
264 SkFilterQuality, 264 SkFilterQuality,
265 SkImageFilter* input = NULL); 265 SkImageFilter* input = NULL);
266 266
267 SkSpecialImage* filterInput(int index, 267 sk_sp<SkSpecialImage> filterInput(int index,
268 SkSpecialImage* src, 268 SkSpecialImage* src,
269 const Context&, 269 const Context&,
270 SkIPoint* offset) const; 270 SkIPoint* offset) const;
271 271
272 #if SK_SUPPORT_GPU 272 #if SK_SUPPORT_GPU
273 // Helper function which invokes GPU filter processing on the 273 // Helper function which invokes GPU filter processing on the
274 // input at the specified "index". If the input is null, it leaves 274 // input at the specified "index". If the input is null, it leaves
275 // "result" and "offset" untouched, and returns true. If the input 275 // "result" and "offset" untouched, and returns true. If the input
276 // has a GPU implementation, it will be invoked directly. 276 // has a GPU implementation, it will be invoked directly.
277 // Otherwise, the filter will be processed in software and 277 // Otherwise, the filter will be processed in software and
278 // uploaded to the GPU. 278 // uploaded to the GPU.
279 bool filterInputGPUDeprecated(int index, SkImageFilter::Proxy* proxy, 279 bool filterInputGPUDeprecated(int index, SkImageFilter::Proxy* proxy,
280 const SkBitmap& src, const Context&, 280 const SkBitmap& src, const Context&,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 * Offset is the amount to translate the resulting image relative to the 347 * Offset is the amount to translate the resulting image relative to the
348 * src when it is drawn. This is an out-param. 348 * src when it is drawn. This is an out-param.
349 * 349 *
350 * If the result image cannot be created, this should false, in which 350 * If the result image cannot be created, this should false, in which
351 * case both the result and offset parameters will be ignored by the 351 * case both the result and offset parameters will be ignored by the
352 * caller. 352 * caller.
353 */ 353 */
354 virtual bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Cont ext&, 354 virtual bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Cont ext&,
355 SkBitmap* result, SkIPoint* offset) con st; 355 SkBitmap* result, SkIPoint* offset) con st;
356 356
357 virtual SkSpecialImage* onFilterImage(SkSpecialImage* src, const Context&, 357 virtual sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* src, const Conte xt&,
358 SkIPoint* offset) const; 358 SkIPoint* offset) const;
359 359
360 /** 360 /**
361 * This function recurses into its inputs with the given rect (first 361 * This function recurses into its inputs with the given rect (first
362 * argument), calls filterBounds() with the given map direction on each, 362 * argument), calls filterBounds() with the given map direction on each,
363 * and returns the union of those results. If a derived class has special 363 * and returns the union of those results. If a derived class has special
364 * recursion requirements (e.g., it has an input which does not participate 364 * recursion requirements (e.g., it has an input which does not participate
365 * in bounds computation), it can be overridden here. 365 * in bounds computation), it can be overridden here.
366 * 366 *
367 * Note that this function is *not* responsible for mapping the rect for 367 * Note that this function is *not* responsible for mapping the rect for
368 * this node's filter bounds requirements (i.e., calling 368 * this node's filter bounds requirements (i.e., calling
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 * the source bitmap's bounds, it creates a new bitmap in "result" and 417 * the source bitmap's bounds, it creates a new bitmap in "result" and
418 * pads the edges with transparent black. In that case, the srcOffset is 418 * pads the edges with transparent black. In that case, the srcOffset is
419 * modified to be the same as the bounds, since no further adjustment is 419 * modified to be the same as the bounds, since no further adjustment is
420 * needed by the caller. This version should only be used by filters 420 * needed by the caller. This version should only be used by filters
421 * which are not capable of processing a smaller source bitmap into a 421 * which are not capable of processing a smaller source bitmap into a
422 * larger destination. 422 * larger destination.
423 */ 423 */
424 bool applyCropRectDeprecated(const Context&, Proxy* proxy, const SkBitmap& s rc, 424 bool applyCropRectDeprecated(const Context&, Proxy* proxy, const SkBitmap& s rc,
425 SkIPoint* srcOffset, SkIRect* bounds, SkBitmap* result) const; 425 SkIPoint* srcOffset, SkIRect* bounds, SkBitmap* result) const;
426 426
427 SkSpecialImage* applyCropRect(const Context&, SkSpecialImage* src, SkIPoint* srcOffset, 427 sk_sp<SkSpecialImage> applyCropRect(const Context&, SkSpecialImage* src, SkI Point* srcOffset,
428 SkIRect* bounds) const; 428 SkIRect* bounds) const;
429 429
430 /** 430 /**
431 * Returns true if the filter can be expressed a single-pass 431 * Returns true if the filter can be expressed a single-pass
432 * GrProcessor, used to process this filter on the GPU, or false if 432 * GrProcessor, used to process this filter on the GPU, or false if
433 * not. 433 * not.
434 * 434 *
435 * If effect is non-NULL, a new GrProcessor instance is stored 435 * If effect is non-NULL, a new GrProcessor instance is stored
436 * in it. The caller assumes ownership of the stage, and it is up to the 436 * in it. The caller assumes ownership of the stage, and it is up to the
437 * caller to unref it. 437 * caller to unref it.
438 * 438 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 */ 477 */
478 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 478 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
479 Common localVar; \ 479 Common localVar; \
480 do { \ 480 do { \
481 if (!localVar.unflatten(buffer, expectedCount)) { \ 481 if (!localVar.unflatten(buffer, expectedCount)) { \
482 return NULL; \ 482 return NULL; \
483 } \ 483 } \
484 } while (0) 484 } while (0)
485 485
486 #endif 486 #endif
OLDNEW
« no previous file with comments | « include/core/SkDevice.h ('k') | include/effects/SkBlurImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698