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

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

Issue 2349373004: Create special surfaces according to original device (not always in N32) (Closed)
Patch Set: Remove include, upstream Created 4 years, 3 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
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou rce, 272 sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou rce,
273 const Context& ctx, 273 const Context& ctx,
274 SkIPoint* offset) c onst { 274 SkIPoint* offset) c onst {
275 SkIPoint colorOffset = SkIPoint::Make(0, 0); 275 SkIPoint colorOffset = SkIPoint::Make(0, 0);
276 sk_sp<SkSpecialImage> color(this->filterInput(1, source, ctx, &colorOffset)) ; 276 sk_sp<SkSpecialImage> color(this->filterInput(1, source, ctx, &colorOffset)) ;
277 if (!color) { 277 if (!color) {
278 return nullptr; 278 return nullptr;
279 } 279 }
280 280
281 SkIPoint displOffset = SkIPoint::Make(0, 0); 281 SkIPoint displOffset = SkIPoint::Make(0, 0);
282 sk_sp<SkSpecialImage> displ(this->filterInput(0, source, ctx, &displOffset)) ; 282 // Creation of the displacement map should happen in a non-colorspace aware context:
Brian Osman 2016/09/23 13:44:08 This is an arbitrary decision after a long discuss
robertphillips 2016/09/23 14:11:28 Maybe expand on this to mention some of the conseq
283 Context displContext(ctx.ctm(), ctx.clipBounds(), ctx.cache(), OutputPropert ies(nullptr));
284 sk_sp<SkSpecialImage> displ(this->filterInput(0, source, displContext, &disp lOffset));
283 if (!displ) { 285 if (!displ) {
284 return nullptr; 286 return nullptr;
285 } 287 }
286 288
287 const SkIRect srcBounds = SkIRect::MakeXYWH(colorOffset.x(), colorOffset.y() , 289 const SkIRect srcBounds = SkIRect::MakeXYWH(colorOffset.x(), colorOffset.y() ,
288 color->width(), color->height()) ; 290 color->width(), color->height()) ;
289 291
290 // Both paths do bounds checking on color pixel access, we don't need to 292 // Both paths do bounds checking on color pixel access, we don't need to
291 // pad the color bitmap to bounds here. 293 // pad the color bitmap to bounds here.
292 SkIRect bounds; 294 SkIRect bounds;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 624 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
623 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 625 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
624 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 626 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
625 627
626 uint32_t xKey = displacementMap.xChannelSelector(); 628 uint32_t xKey = displacementMap.xChannelSelector();
627 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 629 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
628 630
629 b->add32(xKey | yKey); 631 b->add32(xKey | yKey);
630 } 632 }
631 #endif 633 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698