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

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

Issue 1695823002: Get OffsetImageFilter really working with SkSpecialImages (Closed) Base URL: https://skia.googlesource.com/skia.git@use-special
Patch Set: Fix bug Created 4 years, 10 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/effects/SkOffsetImageFilter.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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 * 144 *
145 * Offset is the amount to translate the resulting image relative to the 145 * Offset is the amount to translate the resulting image relative to the
146 * src when it is drawn. This is an out-param. 146 * src when it is drawn. This is an out-param.
147 * 147 *
148 * If the result image cannot be created, return false, in which case both 148 * If the result image cannot be created, return false, in which case both
149 * the result and offset parameters will be ignored by the caller. 149 * the result and offset parameters will be ignored by the caller.
150 */ 150 */
151 bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, 151 bool filterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
152 SkBitmap* result, SkIPoint* offset) const; 152 SkBitmap* result, SkIPoint* offset) const;
153 153
154 SkSpecialImage* filterImage(SkSpecialImage* src, const Context&, SkIPoint* o ffset) const;
155
154 enum MapDirection { 156 enum MapDirection {
155 kForward_MapDirection, 157 kForward_MapDirection,
156 kReverse_MapDirection 158 kReverse_MapDirection
157 }; 159 };
158 /** 160 /**
159 * Map a device-space rect recursively forward or backward through the 161 * Map a device-space rect recursively forward or backward through the
160 * filter DAG. kForward_MapDirection is used to determine which pixels of 162 * filter DAG. kForward_MapDirection is used to determine which pixels of
161 * the destination canvas a source image rect would touch after filtering. 163 * the destination canvas a source image rect would touch after filtering.
162 * kBackward_MapDirection is used to determine which rect of the source 164 * kBackward_MapDirection is used to determine which rect of the source
163 * image would be required to fill the given rect (typically, clip bounds). 165 * image would be required to fill the given rect (typically, clip bounds).
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 */ 258 */
257 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const; 259 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const;
258 260
259 /** 261 /**
260 * Create an SkMatrixImageFilter, which transforms its input by the given ma trix. 262 * Create an SkMatrixImageFilter, which transforms its input by the given ma trix.
261 */ 263 */
262 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, 264 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix,
263 SkFilterQuality, 265 SkFilterQuality,
264 SkImageFilter* input = NULL); 266 SkImageFilter* input = NULL);
265 267
268 SkSpecialImage* filterInput(int index,
269 SkSpecialImage* src,
270 const Context&,
271 SkIPoint* offset) const;
272
266 #if SK_SUPPORT_GPU 273 #if SK_SUPPORT_GPU
267 // Helper function which invokes GPU filter processing on the 274 // Helper function which invokes GPU filter processing on the
268 // input at the specified "index". If the input is null, it leaves 275 // input at the specified "index". If the input is null, it leaves
269 // "result" and "offset" untouched, and returns true. If the input 276 // "result" and "offset" untouched, and returns true. If the input
270 // has a GPU implementation, it will be invoked directly. 277 // has a GPU implementation, it will be invoked directly.
271 // Otherwise, the filter will be processed in software and 278 // Otherwise, the filter will be processed in software and
272 // uploaded to the GPU. 279 // uploaded to the GPU.
273 bool filterInputGPUDeprecated(int index, SkImageFilter::Proxy* proxy, 280 bool filterInputGPUDeprecated(int index, SkImageFilter::Proxy* proxy,
274 const SkBitmap& src, const Context&, 281 const SkBitmap& src, const Context&,
275 SkBitmap* result, SkIPoint* offset) const; 282 SkBitmap* result, SkIPoint* offset) const;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 * Offset is the amount to translate the resulting image relative to the 348 * Offset is the amount to translate the resulting image relative to the
342 * src when it is drawn. This is an out-param. 349 * src when it is drawn. This is an out-param.
343 * 350 *
344 * If the result image cannot be created, this should false, in which 351 * If the result image cannot be created, this should false, in which
345 * case both the result and offset parameters will be ignored by the 352 * case both the result and offset parameters will be ignored by the
346 * caller. 353 * caller.
347 */ 354 */
348 virtual bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Cont ext&, 355 virtual bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Cont ext&,
349 SkBitmap* result, SkIPoint* offset) con st; 356 SkBitmap* result, SkIPoint* offset) con st;
350 357
358 virtual SkSpecialImage* onFilterImage(SkSpecialImage* src, const Context&,
359 SkIPoint* offset) const;
360
351 /** 361 /**
352 * This function recurses into its inputs with the given clip rect (first 362 * This function recurses into its inputs with the given clip rect (first
353 * argument), calls filterBounds() with the given map direction on each, 363 * argument), calls filterBounds() with the given map direction on each,
354 * and unions the result (third argument). If the rect cannot be mapped, 364 * and unions the result (third argument). If the rect cannot be mapped,
355 * false is returned and the destination rect is left unchanged. 365 * false is returned and the destination rect is left unchanged.
356 * If a derived class has special recursion requirements (e.g., it has an 366 * If a derived class has special recursion requirements (e.g., it has an
357 * input which does not participate in bounds computation), it can be 367 * input which does not participate in bounds computation), it can be
358 * overridden here. 368 * overridden here.
359 * 369 *
360 * Note that this function is *not* responsible for mapping the rect for 370 * Note that this function is *not* responsible for mapping the rect for
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 * the source bitmap's bounds, it creates a new bitmap in "result" and 420 * the source bitmap's bounds, it creates a new bitmap in "result" and
411 * pads the edges with transparent black. In that case, the srcOffset is 421 * pads the edges with transparent black. In that case, the srcOffset is
412 * modified to be the same as the bounds, since no further adjustment is 422 * modified to be the same as the bounds, since no further adjustment is
413 * needed by the caller. This version should only be used by filters 423 * needed by the caller. This version should only be used by filters
414 * which are not capable of processing a smaller source bitmap into a 424 * which are not capable of processing a smaller source bitmap into a
415 * larger destination. 425 * larger destination.
416 */ 426 */
417 bool applyCropRectDeprecated(const Context&, Proxy* proxy, const SkBitmap& s rc, 427 bool applyCropRectDeprecated(const Context&, Proxy* proxy, const SkBitmap& s rc,
418 SkIPoint* srcOffset, SkIRect* bounds, SkBitmap* result) const; 428 SkIPoint* srcOffset, SkIRect* bounds, SkBitmap* result) const;
419 429
430 SkSpecialImage* applyCropRect(const Context&, SkSpecialImage* src, SkIPoint* srcOffset,
431 SkIRect* bounds) const;
432
420 /** 433 /**
421 * Returns true if the filter can be expressed a single-pass 434 * Returns true if the filter can be expressed a single-pass
422 * GrProcessor, used to process this filter on the GPU, or false if 435 * GrProcessor, used to process this filter on the GPU, or false if
423 * not. 436 * not.
424 * 437 *
425 * If effect is non-NULL, a new GrProcessor instance is stored 438 * If effect is non-NULL, a new GrProcessor instance is stored
426 * in it. The caller assumes ownership of the stage, and it is up to the 439 * in it. The caller assumes ownership of the stage, and it is up to the
427 * caller to unref it. 440 * caller to unref it.
428 * 441 *
429 * The effect can assume its vertexCoords space maps 1-to-1 with texels 442 * The effect can assume its vertexCoords space maps 1-to-1 with texels
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 */ 477 */
465 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 478 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
466 Common localVar; \ 479 Common localVar; \
467 do { \ 480 do { \
468 if (!localVar.unflatten(buffer, expectedCount)) { \ 481 if (!localVar.unflatten(buffer, expectedCount)) { \
469 return NULL; \ 482 return NULL; \
470 } \ 483 } \
471 } while (0) 484 } while (0)
472 485
473 #endif 486 #endif
OLDNEW
« no previous file with comments | « no previous file | include/effects/SkOffsetImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698