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

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

Issue 1896383003: Begin removing deprecated (and now, unused) ImageFilter code paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 4 years, 8 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/SkBlurImageFilter.cpp ('k') | src/effects/SkImageSource.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 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRend erTarget())); 349 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRend erTarget()));
350 if (!drawContext) { 350 if (!drawContext) {
351 return nullptr; 351 return nullptr;
352 } 352 }
353 353
354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co lorBounds)); 354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co lorBounds));
355 355
356 offset->fX = bounds.left(); 356 offset->fX = bounds.left();
357 offset->fY = bounds.top(); 357 offset->fY = bounds.top();
358 return SkSpecialImage::MakeFromGpu(source->internal_getProxy(), 358 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound s.height()),
359 SkIRect::MakeWH(bounds.width(), bound s.height()),
360 kNeedNewImageUniqueID_SpecialImage, 359 kNeedNewImageUniqueID_SpecialImage,
361 dst); 360 dst);
362 } 361 }
363 #endif 362 #endif
364 363
365 SkBitmap colorBM, displBM; 364 SkBitmap colorBM, displBM;
366 365
367 if (!color->getROPixels(&colorBM) || !displ->getROPixels(&displBM)) { 366 if (!color->getROPixels(&colorBM) || !displ->getROPixels(&displBM)) {
368 return nullptr; 367 return nullptr;
369 } 368 }
(...skipping 16 matching lines...) Expand all
386 return nullptr; 385 return nullptr;
387 } 386 }
388 387
389 SkAutoLockPixels dstLock(dst); 388 SkAutoLockPixels dstLock(dst);
390 389
391 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, &dst, 390 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, &dst,
392 displBM, colorOffset - displOffset, colorBM, colorBounds ); 391 displBM, colorOffset - displOffset, colorBM, colorBounds );
393 392
394 offset->fX = bounds.left(); 393 offset->fX = bounds.left();
395 offset->fY = bounds.top(); 394 offset->fY = bounds.top();
396 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), 395 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds .height()),
397 SkIRect::MakeWH(bounds.width(), bounds .height()),
398 dst); 396 dst);
399 } 397 }
400 398
401 SkRect SkDisplacementMapEffect::computeFastBounds(const SkRect& src) const { 399 SkRect SkDisplacementMapEffect::computeFastBounds(const SkRect& src) const {
402 SkRect bounds = this->getColorInput() ? this->getColorInput()->computeFastBo unds(src) : src; 400 SkRect bounds = this->getColorInput() ? this->getColorInput()->computeFastBo unds(src) : src;
403 bounds.outset(SkScalarAbs(fScale) * SK_ScalarHalf, SkScalarAbs(fScale) * SK_ ScalarHalf); 401 bounds.outset(SkScalarAbs(fScale) * SK_ScalarHalf, SkScalarAbs(fScale) * SK_ ScalarHalf);
404 return bounds; 402 return bounds;
405 } 403 }
406 404
407 SkIRect SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const Sk Matrix& ctm, 405 SkIRect SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const Sk Matrix& ctm,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
629 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 627 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
630 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
631 629
632 uint32_t xKey = displacementMap.xChannelSelector(); 630 uint32_t xKey = displacementMap.xChannelSelector();
633 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
634 632
635 b->add32(xKey | yKey); 633 b->add32(xKey | yKey);
636 } 634 }
637 #endif 635 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkImageSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698