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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 sk_sp<SkImage> image(buffer.readImage()); 65 sk_sp<SkImage> image(buffer.readImage());
66 if (!image) { 66 if (!image) {
67 return nullptr; 67 return nullptr;
68 } 68 }
69 69
70 return SkImageSource::Make(std::move(image), src, dst, filterQuality); 70 return SkImageSource::Make(std::move(image), src, dst, filterQuality);
71 } 71 }
72 72
73 void SkImageSource::flatten(SkWriteBuffer& buffer) const { 73 void SkImageSource::flatten(SkWriteBuffer& buffer) const {
74 buffer.writeInt(fFilterQuality); 74 buffer.writeInt("fFilterQuality", fFilterQuality);
75 buffer.writeRect(fSrcRect); 75 buffer.writeRect("fSrcRect", fSrcRect);
76 buffer.writeRect(fDstRect); 76 buffer.writeRect("fDstRect", fDstRect);
77 buffer.writeImage(fImage.get()); 77 buffer.writeImage("fImage", fImage.get());
78 } 78 }
79 79
80 sk_sp<SkSpecialImage> SkImageSource::onFilterImage(SkSpecialImage* source, const Context& ctx, 80 sk_sp<SkSpecialImage> SkImageSource::onFilterImage(SkSpecialImage* source, const Context& ctx,
81 SkIPoint* offset) const { 81 SkIPoint* offset) const {
82 SkRect dstRect; 82 SkRect dstRect;
83 ctx.ctm().mapRect(&dstRect, fDstRect); 83 ctx.ctm().mapRect(&dstRect, fDstRect);
84 84
85 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height()); 85 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height());
86 if (fSrcRect == bounds && dstRect == bounds) { 86 if (fSrcRect == bounds && dstRect == bounds) {
87 // No regions cropped out or resized; return entire image. 87 // No regions cropped out or resized; return entire image.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void SkImageSource::toString(SkString* str) const { 134 void SkImageSource::toString(SkString* str) const {
135 str->appendf("SkImageSource: ("); 135 str->appendf("SkImageSource: (");
136 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", 136 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ",
137 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m, 137 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m,
138 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m); 138 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
139 str->appendf("image: (%d,%d)", 139 str->appendf("image: (%d,%d)",
140 fImage->width(), fImage->height()); 140 fImage->width(), fImage->height());
141 str->append(")"); 141 str->append(")");
142 } 142 }
143 #endif 143 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698