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 1393283008: Image filters: refactor input GPU processing into filterInputGPU(). (Closed) Base URL: https://skia.googlesource.com/skia.git@filter-input
Patch Set: Update to ToT Created 5 years, 2 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/SkLightingImageFilter.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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; 377 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
378 SkVector fScale; 378 SkVector fScale;
379 379
380 typedef GrFragmentProcessor INHERITED; 380 typedef GrFragmentProcessor INHERITED;
381 }; 381 };
382 382
383 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 383 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
384 SkBitmap* result, SkIPoint* offset) const { 384 SkBitmap* result, SkIPoint* offset) const {
385 SkBitmap colorBM = src; 385 SkBitmap colorBM = src;
386 SkIPoint colorOffset = SkIPoint::Make(0, 0); 386 SkIPoint colorOffset = SkIPoint::Make(0, 0);
387 if (this->getColorInput() && 387 if (!this->filterInputGPU(1, proxy, src, ctx, &colorBM, &colorOffset)) {
388 !this->getColorInput()->getInputResultGPU(proxy, src, ctx, &colorBM, &co lorOffset)) {
389 return false; 388 return false;
390 } 389 }
391 SkBitmap displacementBM = src; 390 SkBitmap displacementBM = src;
392 SkIPoint displacementOffset = SkIPoint::Make(0, 0); 391 SkIPoint displacementOffset = SkIPoint::Make(0, 0);
393 if (this->getDisplacementInput() && 392 if (!this->filterInputGPU(0, proxy, src, ctx, &displacementBM, &displacement Offset)) {
394 !this->getDisplacementInput()->getInputResultGPU(proxy, src, ctx, &displ acementBM,
395 &displacementOffset)) {
396 return false; 393 return false;
397 } 394 }
398 SkIRect bounds; 395 SkIRect bounds;
399 // Since GrDisplacementMapEffect does bounds checking on color pixel access, we don't need to 396 // Since GrDisplacementMapEffect does bounds checking on color pixel access, we don't need to
400 // pad the color bitmap to bounds here. 397 // pad the color bitmap to bounds here.
401 if (!this->applyCropRect(ctx, colorBM, colorOffset, &bounds)) { 398 if (!this->applyCropRect(ctx, colorBM, colorOffset, &bounds)) {
402 return false; 399 return false;
403 } 400 }
404 SkIRect displBounds; 401 SkIRect displBounds;
405 if (!this->applyCropRect(ctx, proxy, displacementBM, 402 if (!this->applyCropRect(ctx, proxy, displacementBM,
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 621 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
625 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 622 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
626 623
627 uint32_t xKey = displacementMap.xChannelSelector(); 624 uint32_t xKey = displacementMap.xChannelSelector();
628 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 625 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
629 626
630 b->add32(xKey | yKey); 627 b->add32(xKey | yKey);
631 } 628 }
632 #endif 629 #endif
633 630
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698