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

Side by Side Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1217303004: Revert of Revert of Revert of Fix SkTileImageFilter clipping/cropRect interaction issue (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkTileImageFilter.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst) const { 262 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst) const {
263 if (getColorInput()) { 263 if (getColorInput()) {
264 getColorInput()->computeFastBounds(src, dst); 264 getColorInput()->computeFastBounds(src, dst);
265 } else { 265 } else {
266 *dst = src; 266 *dst = src;
267 } 267 }
268 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf); 268 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf);
269 } 269 }
270 270
271 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, 271 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
272 SkIRect* dst) const { 272 SkIRect* dst) const {
273 SkIRect bounds = src; 273 SkIRect bounds = src;
274 SkVector scale = SkVector::Make(fScale, fScale); 274 SkVector scale = SkVector::Make(fScale, fScale);
275 ctm.mapVectors(&scale, 1); 275 ctm.mapVectors(&scale, 1);
276 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), 276 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf),
277 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); 277 SkScalarCeilToInt(scale.fY * SK_ScalarHalf));
278 if (getColorInput()) { 278 if (getColorInput()) {
279 return getColorInput()->filterBounds(bounds, ctm, dst); 279 return getColorInput()->filterBounds(bounds, ctm, dst);
280 } 280 }
281 *dst = bounds; 281 *dst = bounds;
282 return true; 282 return true;
283 } 283 }
284 284
285 #ifndef SK_IGNORE_TO_STRING 285 #ifndef SK_IGNORE_TO_STRING
286 void SkDisplacementMapEffect::toString(SkString* str) const { 286 void SkDisplacementMapEffect::toString(SkString* str) const {
287 str->appendf("SkDisplacementMapEffect: ("); 287 str->appendf("SkDisplacementMapEffect: (");
288 this->getCropRect().toString(str);
289 str->appendf("scale: %f ", fScale); 288 str->appendf("scale: %f ", fScale);
290 str->appendf("displacement: ("); 289 str->appendf("displacement: (");
291 if (this->getDisplacementInput()) { 290 if (this->getDisplacementInput()) {
292 this->getDisplacementInput()->toString(str); 291 this->getDisplacementInput()->toString(str);
293 } 292 }
294 str->appendf(") color: ("); 293 str->appendf(") color: (");
295 if (this->getColorInput()) { 294 if (this->getColorInput()) {
296 this->getColorInput()->toString(str); 295 this->getColorInput()->toString(str);
297 } 296 }
298 str->appendf("))"); 297 str->appendf("))");
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 644 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
646 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 645 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
647 646
648 uint32_t xKey = displacementMap.xChannelSelector(); 647 uint32_t xKey = displacementMap.xChannelSelector();
649 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 648 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
650 649
651 b->add32(xKey | yKey); 650 b->add32(xKey | yKey);
652 } 651 }
653 #endif 652 #endif
654 653
OLDNEW
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkTileImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698