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

Side by Side Diff: src/effects/SkImageSource.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 2015 Google Inc. 2 * Copyright 2015 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 "SkImageSource.h" 8 #include "SkImageSource.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkIPoint* offset) const { 61 SkIPoint* offset) const {
62 SkRect dstRect; 62 SkRect dstRect;
63 ctx.ctm().mapRect(&dstRect, fDstRect); 63 ctx.ctm().mapRect(&dstRect, fDstRect);
64 64
65 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height()); 65 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height());
66 if (fSrcRect == bounds && dstRect == bounds) { 66 if (fSrcRect == bounds && dstRect == bounds) {
67 // No regions cropped out or resized; return entire image. 67 // No regions cropped out or resized; return entire image.
68 offset->fX = offset->fY = 0; 68 offset->fX = offset->fY = 0;
69 return SkSpecialImage::MakeFromImage(source->internal_getProxy(), 69 return SkSpecialImage::MakeFromImage(source->internal_getProxy(),
70 SkIRect::MakeWH(fImage->width(), fI mage->height()), 70 SkIRect::MakeWH(fImage->width(), fI mage->height()),
71 fImage); 71 fImage,
72 &source->props());
72 } 73 }
73 74
74 const SkIRect dstIRect = dstRect.roundOut(); 75 const SkIRect dstIRect = dstRect.roundOut();
75 76
77 // SRGBTODO: Propagate SkColorType?
bsalomon 2016/04/06 13:19:28 If Rob doesn't know the answer to this I'd check w
76 const SkImageInfo info = SkImageInfo::MakeN32(dstIRect.width(), dstIRect.hei ght(), 78 const SkImageInfo info = SkImageInfo::MakeN32(dstIRect.width(), dstIRect.hei ght(),
77 kPremul_SkAlphaType); 79 kPremul_SkAlphaType);
78 80
79 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); 81 sk_sp<SkSpecialSurface> surf(source->makeSurface(info));
80 if (!surf) { 82 if (!surf) {
81 return nullptr; 83 return nullptr;
82 } 84 }
83 85
84 SkCanvas* canvas = surf->getCanvas(); 86 SkCanvas* canvas = surf->getCanvas();
85 SkASSERT(canvas); 87 SkASSERT(canvas);
(...skipping 27 matching lines...) Expand all
113 void SkImageSource::toString(SkString* str) const { 115 void SkImageSource::toString(SkString* str) const {
114 str->appendf("SkImageSource: ("); 116 str->appendf("SkImageSource: (");
115 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", 117 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ",
116 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m, 118 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m,
117 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m); 119 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
118 str->appendf("image: (%d,%d)", 120 str->appendf("image: (%d,%d)",
119 fImage->width(), fImage->height()); 121 fImage->width(), fImage->height());
120 str->append(")"); 122 str->append(")");
121 } 123 }
122 #endif 124 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698