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

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: Remove helper function for old pixel-config method of enabling decode 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 static void apply_morphology_rect(GrDrawContext* drawContext, 365 static void apply_morphology_rect(GrDrawContext* drawContext,
366 const GrClip& clip, 366 const GrClip& clip,
367 GrTexture* texture, 367 GrTexture* texture,
368 const SkIRect& srcRect, 368 const SkIRect& srcRect,
369 const SkIRect& dstRect, 369 const SkIRect& dstRect,
370 int radius, 370 int radius,
371 GrMorphologyEffect::MorphologyType morphType, 371 GrMorphologyEffect::MorphologyType morphType,
372 float bounds[2], 372 float bounds[2],
373 Gr1DKernelEffect::Direction direction) { 373 Gr1DKernelEffect::Direction direction) {
374 GrPaint paint; 374 GrPaint paint;
375 // SRGBTODO: AllowSRGBInputs?
375 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, 376 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
376 direction, 377 direction,
377 radius, 378 radius,
378 morphType, 379 morphType,
379 bounds))->unref() ; 380 bounds))->unref() ;
380 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 381 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
381 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ), 382 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ),
382 SkRect::Make(srcRect)); 383 SkRect::Make(srcRect));
383 } 384 }
384 385
385 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, 386 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
386 const GrClip& clip, 387 const GrClip& clip,
387 GrTexture* texture, 388 GrTexture* texture,
388 const SkIRect& srcRect, 389 const SkIRect& srcRect,
389 const SkIRect& dstRect, 390 const SkIRect& dstRect,
390 int radius, 391 int radius,
391 GrMorphologyEffect::MorphologyType m orphType, 392 GrMorphologyEffect::MorphologyType m orphType,
392 Gr1DKernelEffect::Direction directio n) { 393 Gr1DKernelEffect::Direction directio n) {
393 GrPaint paint; 394 GrPaint paint;
395 // SRGBTODO: AllowSRGBInputs?
394 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, 396 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
395 direction, 397 direction,
396 radius, 398 radius,
397 morphType))->unre f(); 399 morphType))->unre f();
398 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 400 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
399 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ), 401 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect ),
400 SkRect::Make(srcRect)); 402 SkRect::Make(srcRect));
401 } 403 }
402 404
403 static void apply_morphology_pass(GrDrawContext* drawContext, 405 static void apply_morphology_pass(GrDrawContext* drawContext,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 apply_morphology_pass(dstDrawContext, clip, srcTexture, 508 apply_morphology_pass(dstDrawContext, clip, srcTexture,
507 srcRect, dstRect, radius.fHeight, morphType, 509 srcRect, dstRect, radius.fHeight, morphType,
508 Gr1DKernelEffect::kY_Direction); 510 Gr1DKernelEffect::kY_Direction);
509 511
510 srcTexture.reset(scratch); 512 srcTexture.reset(scratch);
511 } 513 }
512 514
513 return SkSpecialImage::MakeFromGpu(input->internal_getProxy(), 515 return SkSpecialImage::MakeFromGpu(input->internal_getProxy(),
514 SkIRect::MakeWH(rect.width(), rect.height ()), 516 SkIRect::MakeWH(rect.width(), rect.height ()),
515 kNeedNewImageUniqueID_SpecialImage, 517 kNeedNewImageUniqueID_SpecialImage,
516 srcTexture); 518 srcTexture, &input->props());
517 } 519 }
518 #endif 520 #endif
519 521
520 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou rce, 522 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou rce,
521 const Context& ctx, 523 const Context& ctx,
522 SkIPoint* offset) c onst { 524 SkIPoint* offset) c onst {
523 SkIPoint inputOffset = SkIPoint::Make(0, 0); 525 SkIPoint inputOffset = SkIPoint::Make(0, 0);
524 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset)) ; 526 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset)) ;
525 if (!input) { 527 if (!input) {
526 return nullptr; 528 return nullptr;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 call_proc_Y(procY, 616 call_proc_Y(procY,
615 inputPixmap.addr32(srcBounds.left(), srcBounds.top()), 617 inputPixmap.addr32(srcBounds.left(), srcBounds.top()),
616 inputPixmap.rowBytesAsPixels(), 618 inputPixmap.rowBytesAsPixels(),
617 &dst, height, srcBounds); 619 &dst, height, srcBounds);
618 } 620 }
619 offset->fX = bounds.left(); 621 offset->fX = bounds.left();
620 offset->fY = bounds.top(); 622 offset->fY = bounds.top();
621 623
622 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), 624 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(),
623 SkIRect::MakeWH(bounds.width(), bounds .height()), 625 SkIRect::MakeWH(bounds.width(), bounds .height()),
624 dst); 626 dst, &source->props());
625 } 627 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698