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

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

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 static void apply_morphology_rect(GrDrawContext* drawContext, 363 static void apply_morphology_rect(GrDrawContext* drawContext,
364 const GrClip& clip, 364 const GrClip& clip,
365 GrTexture* texture, 365 GrTexture* texture,
366 const SkIRect& srcRect, 366 const SkIRect& srcRect,
367 const SkIRect& dstRect, 367 const SkIRect& dstRect,
368 int radius, 368 int radius,
369 GrMorphologyEffect::MorphologyType morphType, 369 GrMorphologyEffect::MorphologyType morphType,
370 float bounds[2], 370 float bounds[2],
371 Gr1DKernelEffect::Direction direction) { 371 Gr1DKernelEffect::Direction direction) {
372 GrPaint paint; 372 GrPaint paint;
373 // SRGBTODO: AllowSRGBInputs?
bsalomon 2016/04/06 13:19:28 probably should depend on the drawContext at the r
373 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, 374 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
374 direction, 375 direction,
375 radius, 376 radius,
376 morphType, 377 morphType,
377 bounds))->unref() ; 378 bounds))->unref() ;
378 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 379 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
379 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ), 380 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ),
380 SkRect::Make(srcRect)); 381 SkRect::Make(srcRect));
381 } 382 }
382 383
383 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, 384 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
384 const GrClip& clip, 385 const GrClip& clip,
385 GrTexture* texture, 386 GrTexture* texture,
386 const SkIRect& srcRect, 387 const SkIRect& srcRect,
387 const SkIRect& dstRect, 388 const SkIRect& dstRect,
388 int radius, 389 int radius,
389 GrMorphologyEffect::MorphologyType m orphType, 390 GrMorphologyEffect::MorphologyType m orphType,
390 Gr1DKernelEffect::Direction directio n) { 391 Gr1DKernelEffect::Direction directio n) {
391 GrPaint paint; 392 GrPaint paint;
393 // SRGBTODO: AllowSRGBInputs?
bsalomon 2016/04/06 13:19:28 ditto
392 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, 394 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
393 direction, 395 direction,
394 radius, 396 radius,
395 morphType))->unre f(); 397 morphType))->unre f();
396 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 398 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
397 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ), 399 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ),
398 SkRect::Make(srcRect)); 400 SkRect::Make(srcRect));
399 } 401 }
400 402
401 static void apply_morphology_pass(GrDrawContext* drawContext, 403 static void apply_morphology_pass(GrDrawContext* drawContext,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 apply_morphology_pass(dstDrawContext, clip, srcTexture, 506 apply_morphology_pass(dstDrawContext, clip, srcTexture,
505 srcRect, dstRect, radius.fHeight, morphType, 507 srcRect, dstRect, radius.fHeight, morphType,
506 Gr1DKernelEffect::kY_Direction); 508 Gr1DKernelEffect::kY_Direction);
507 509
508 srcTexture.reset(scratch); 510 srcTexture.reset(scratch);
509 } 511 }
510 512
511 return SkSpecialImage::MakeFromGpu(input->internal_getProxy(), 513 return SkSpecialImage::MakeFromGpu(input->internal_getProxy(),
512 SkIRect::MakeWH(rect.width(), rect.height ()), 514 SkIRect::MakeWH(rect.width(), rect.height ()),
513 kNeedNewImageUniqueID_SpecialImage, 515 kNeedNewImageUniqueID_SpecialImage,
514 srcTexture); 516 srcTexture, &input->props());
515 } 517 }
516 #endif 518 #endif
517 519
518 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou rce, 520 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou rce,
519 const Context& ctx, 521 const Context& ctx,
520 SkIPoint* offset) c onst { 522 SkIPoint* offset) c onst {
521 SkIPoint inputOffset = SkIPoint::Make(0, 0); 523 SkIPoint inputOffset = SkIPoint::Make(0, 0);
522 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset)) ; 524 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset)) ;
523 if (!input) { 525 if (!input) {
524 return nullptr; 526 return nullptr;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 call_proc_Y(procY, 614 call_proc_Y(procY,
613 inputPixmap.addr32(srcBounds.left(), srcBounds.top()), 615 inputPixmap.addr32(srcBounds.left(), srcBounds.top()),
614 inputPixmap.rowBytesAsPixels(), 616 inputPixmap.rowBytesAsPixels(),
615 &dst, height, srcBounds); 617 &dst, height, srcBounds);
616 } 618 }
617 offset->fX = bounds.left(); 619 offset->fX = bounds.left();
618 offset->fY = bounds.top(); 620 offset->fY = bounds.top();
619 621
620 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), 622 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
621 SkIRect::MakeWH(bounds.width(), bounds .height()), 623 SkIRect::MakeWH(bounds.width(), bounds .height()),
622 dst); 624 dst, &source->props());
623 } 625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698