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

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

Issue 1702683002: Image filters: change applyCropRect() to take a src rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | src/core/SkImageFilter.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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 SkBitmap* result, SkIPoint* offset) const; 383 SkBitmap* result, SkIPoint* offset) const;
384 384
385 /** 385 /**
386 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a 386 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a
387 * colorfilter w/o CropRect constraints. 387 * colorfilter w/o CropRect constraints.
388 */ 388 */
389 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const { 389 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const {
390 return false; 390 return false;
391 } 391 }
392 392
393 /** Given a "src" bitmap and its "srcOffset", computes source and 393 /** Given a "srcBounds" rect, computes destination bounds for this
394 * destination bounds for this filter. Initial bounds are the 394 * destination bounds for this filter. "dstBounds" are computed by
395 * "src" bitmap bounds offset by "srcOffset". "dstBounds" are 395 * transforming the crop rect by the context's CTM, applying it to the
396 * computed by transforming the crop rect by the context's CTM, 396 * initial bounds, and intersecting the result with the context's clip
397 * applying it to the initial bounds, and intersecting the result 397 * bounds. "srcBounds" (if non-null) are computed by intersecting the
398 * with the context's clip bounds. "srcBounds" (if non-null) are 398 * initial bounds with "dstBounds", to ensure that we never sample
399 * computed by intersecting the initial bounds with "dstBounds", to 399 * outside of the crop rect (this restriction may be relaxed in the
400 * ensure that we never sample outside of the crop rect (this restriction 400 * future).
401 * may be relaxed in the future).
402 */ 401 */
403 bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcO ffset, 402 bool applyCropRect(const Context&, const SkIRect& srcBounds, SkIRect* dstBou nds) const;
404 SkIRect* dstBounds, SkIRect* srcBounds = nullptr) const;
405 403
406 /** Same as the above call, except that if the resulting crop rect is not 404 /** A variant of the above call which takes the original source bitmap and
407 * entirely contained by the source bitmap's bounds, it creates a new 405 * source offset. If the resulting crop rect is not entirely contained by
408 * bitmap in "result" and pads the edges with transparent black. In that 406 * the source bitmap's bounds, it creates a new bitmap in "result" and
409 * case, the srcOffset is modified to be the same as the bounds, since no 407 * pads the edges with transparent black. In that case, the srcOffset is
410 * further adjustment is needed by the caller. This version should only 408 * modified to be the same as the bounds, since no further adjustment is
411 * be used by filters which are not capable of processing a smaller 409 * needed by the caller. This version should only be used by filters
412 * source bitmap into a larger destination. 410 * which are not capable of processing a smaller source bitmap into a
411 * larger destination.
413 */ 412 */
414 bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoi nt* srcOffset, 413 bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoi nt* srcOffset,
415 SkIRect* bounds, SkBitmap* result) const; 414 SkIRect* bounds, SkBitmap* result) const;
416 415
417 /** 416 /**
418 * Returns true if the filter can be expressed a single-pass 417 * Returns true if the filter can be expressed a single-pass
419 * GrProcessor, used to process this filter on the GPU, or false if 418 * GrProcessor, used to process this filter on the GPU, or false if
420 * not. 419 * not.
421 * 420 *
422 * If effect is non-NULL, a new GrProcessor instance is stored 421 * If effect is non-NULL, a new GrProcessor instance is stored
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 */ 460 */
462 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 461 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
463 Common localVar; \ 462 Common localVar; \
464 do { \ 463 do { \
465 if (!localVar.unflatten(buffer, expectedCount)) { \ 464 if (!localVar.unflatten(buffer, expectedCount)) { \
466 return NULL; \ 465 return NULL; \
467 } \ 466 } \
468 } while (0) 467 } while (0)
469 468
470 #endif 469 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698