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

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

Issue 1709753002: Mark existing image filter entry points that will be going away with Deprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT 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 | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.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 "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return Create(xsel, ysel, scale, common.getInput(0), common.getInput(1), &co mmon.cropRect()); 203 return Create(xsel, ysel, scale, common.getInput(0), common.getInput(1), &co mmon.cropRect());
204 } 204 }
205 205
206 void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const { 206 void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const {
207 this->INHERITED::flatten(buffer); 207 this->INHERITED::flatten(buffer);
208 buffer.writeInt((int) fXChannelSelector); 208 buffer.writeInt((int) fXChannelSelector);
209 buffer.writeInt((int) fYChannelSelector); 209 buffer.writeInt((int) fYChannelSelector);
210 buffer.writeScalar(fScale); 210 buffer.writeScalar(fScale);
211 } 211 }
212 212
213 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, 213 bool SkDisplacementMapEffect::onFilterImageDeprecated(Proxy* proxy,
214 const SkBitmap& src, 214 const SkBitmap& src,
215 const Context& ctx, 215 const Context& ctx,
216 SkBitmap* dst, 216 SkBitmap* dst,
217 SkIPoint* offset) const { 217 SkIPoint* offset) const {
218 SkBitmap displ = src, color = src; 218 SkBitmap displ = src, color = src;
219 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0, 0); 219 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0, 0);
220 if (!this->filterInput(1, proxy, src, ctx, &color, &colorOffset) || 220 if (!this->filterInputDeprecated(1, proxy, src, ctx, &color, &colorOffset) | |
221 !this->filterInput(0, proxy, src, ctx, &displ, &displOffset)) { 221 !this->filterInputDeprecated(0, proxy, src, ctx, &displ, &displOffset)) {
222 return false; 222 return false;
223 } 223 }
224 if ((displ.colorType() != kN32_SkColorType) || 224 if ((displ.colorType() != kN32_SkColorType) ||
225 (color.colorType() != kN32_SkColorType)) { 225 (color.colorType() != kN32_SkColorType)) {
226 return false; 226 return false;
227 } 227 }
228 SkIRect bounds; 228 SkIRect bounds;
229 // Since computeDisplacement does bounds checking on color pixel access, we don't need to pad 229 // Since computeDisplacement does bounds checking on color pixel access, we don't need to pad
230 // the color bitmap to bounds here. 230 // the color bitmap to bounds here.
231 SkIRect srcBounds = color.bounds(); 231 SkIRect srcBounds = color.bounds();
232 srcBounds.offset(colorOffset); 232 srcBounds.offset(colorOffset);
233 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { 233 if (!this->applyCropRect(ctx, srcBounds, &bounds)) {
234 return false; 234 return false;
235 } 235 }
236 SkIRect displBounds; 236 SkIRect displBounds;
237 if (!this->applyCropRect(ctx, proxy, displ, &displOffset, &displBounds, &dis pl)) { 237 if (!this->applyCropRectDeprecated(ctx, proxy, displ, &displOffset, &displBo unds, &displ)) {
238 return false; 238 return false;
239 } 239 }
240 if (!bounds.intersect(displBounds)) { 240 if (!bounds.intersect(displBounds)) {
241 return false; 241 return false;
242 } 242 }
243 SkAutoLockPixels alp_displacement(displ), alp_color(color); 243 SkAutoLockPixels alp_displacement(displ), alp_color(color);
244 if (!displ.getPixels() || !color.getPixels()) { 244 if (!displ.getPixels() || !color.getPixels()) {
245 return false; 245 return false;
246 } 246 }
247 247
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 GrCoordTransform fColorTransform; 379 GrCoordTransform fColorTransform;
380 GrTextureDomain fDomain; 380 GrTextureDomain fDomain;
381 GrTextureAccess fColorAccess; 381 GrTextureAccess fColorAccess;
382 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; 382 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
383 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; 383 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
384 SkVector fScale; 384 SkVector fScale;
385 385
386 typedef GrFragmentProcessor INHERITED; 386 typedef GrFragmentProcessor INHERITED;
387 }; 387 };
388 388
389 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 389 bool SkDisplacementMapEffect::filterImageGPUDeprecated(Proxy* proxy, const SkBit map& src,
390 SkBitmap* result, SkIPoint* offset) const { 390 const Context& ctx,
391 SkBitmap* result, SkIPoin t* offset) const {
391 SkBitmap colorBM = src; 392 SkBitmap colorBM = src;
392 SkIPoint colorOffset = SkIPoint::Make(0, 0); 393 SkIPoint colorOffset = SkIPoint::Make(0, 0);
393 if (!this->filterInputGPU(1, proxy, src, ctx, &colorBM, &colorOffset)) { 394 if (!this->filterInputGPUDeprecated(1, proxy, src, ctx, &colorBM, &colorOffs et)) {
394 return false; 395 return false;
395 } 396 }
396 SkBitmap displacementBM = src; 397 SkBitmap displacementBM = src;
397 SkIPoint displacementOffset = SkIPoint::Make(0, 0); 398 SkIPoint displacementOffset = SkIPoint::Make(0, 0);
398 if (!this->filterInputGPU(0, proxy, src, ctx, &displacementBM, &displacement Offset)) { 399 if (!this->filterInputGPUDeprecated(0, proxy, src, ctx, &displacementBM, &di splacementOffset)) {
399 return false; 400 return false;
400 } 401 }
401 SkIRect srcBounds = colorBM.bounds(); 402 SkIRect srcBounds = colorBM.bounds();
402 srcBounds.offset(colorOffset); 403 srcBounds.offset(colorOffset);
403 SkIRect bounds; 404 SkIRect bounds;
404 // Since GrDisplacementMapEffect does bounds checking on color pixel access, we don't need to 405 // Since GrDisplacementMapEffect does bounds checking on color pixel access, we don't need to
405 // pad the color bitmap to bounds here. 406 // pad the color bitmap to bounds here.
406 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { 407 if (!this->applyCropRect(ctx, srcBounds, &bounds)) {
407 return false; 408 return false;
408 } 409 }
409 SkIRect displBounds; 410 SkIRect displBounds;
410 if (!this->applyCropRect(ctx, proxy, displacementBM, 411 if (!this->applyCropRectDeprecated(ctx, proxy, displacementBM,
411 &displacementOffset, &displBounds, &displacementBM) ) { 412 &displacementOffset, &displBounds, &displ acementBM)) {
412 return false; 413 return false;
413 } 414 }
414 if (!bounds.intersect(displBounds)) { 415 if (!bounds.intersect(displBounds)) {
415 return false; 416 return false;
416 } 417 }
417 GrTexture* color = colorBM.getTexture(); 418 GrTexture* color = colorBM.getTexture();
418 GrTexture* displacement = displacementBM.getTexture(); 419 GrTexture* displacement = displacementBM.getTexture();
419 GrContext* context = color->getContext(); 420 GrContext* context = color->getContext();
420 421
421 GrSurfaceDesc desc; 422 GrSurfaceDesc desc;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 630 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
630 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
631 632
632 uint32_t xKey = displacementMap.xChannelSelector(); 633 uint32_t xKey = displacementMap.xChannelSelector();
633 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
634 635
635 b->add32(xKey | yKey); 636 b->add32(xKey | yKey);
636 } 637 }
637 #endif 638 #endif
638 639
OLDNEW
« no previous file with comments | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698