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

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

Issue 2163343002: Adding color space to SkSpecialImage (Closed) Base URL: https://skia.googlesource.com/skia.git@colorspace-on-image
Patch Set: Fix compile after rebase Created 4 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/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 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 bounds.width(), bounds.height(), 339 bounds.width(), bounds.height(),
340 kSkia8888_GrPix elConfig)); 340 kSkia8888_GrPix elConfig));
341 if (!drawContext) { 341 if (!drawContext) {
342 return nullptr; 342 return nullptr;
343 } 343 }
344 344
345 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound s)); 345 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound s));
346 346
347 offset->fX = bounds.left(); 347 offset->fX = bounds.left();
348 offset->fY = bounds.top(); 348 offset->fY = bounds.top();
349 // TODO: Get the colorSpace from the drawContext (once it has one)
349 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound s.height()), 350 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound s.height()),
350 kNeedNewImageUniqueID_SpecialImage, 351 kNeedNewImageUniqueID_SpecialImage,
351 drawContext->asTexture()); 352 drawContext->asTexture(),
353 sk_ref_sp(source->getColorSpace()));
352 } 354 }
353 #endif 355 #endif
354 356
355 SkBitmap colorBM, displBM; 357 SkBitmap colorBM, displBM;
356 358
357 if (!color->getROPixels(&colorBM) || !displ->getROPixels(&displBM)) { 359 if (!color->getROPixels(&colorBM) || !displ->getROPixels(&displBM)) {
358 return nullptr; 360 return nullptr;
359 } 361 }
360 362
361 if ((colorBM.colorType() != kN32_SkColorType) || 363 if ((colorBM.colorType() != kN32_SkColorType) ||
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 619 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
618 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 620 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
619 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 621 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
620 622
621 uint32_t xKey = displacementMap.xChannelSelector(); 623 uint32_t xKey = displacementMap.xChannelSelector();
622 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 624 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
623 625
624 b->add32(xKey | yKey); 626 b->add32(xKey | yKey);
625 } 627 }
626 #endif 628 #endif
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