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

Side by Side Diff: src/image/SkImage.cpp

Issue 1364263002: Remove SkImage::newImage() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « include/core/SkImage.h ('k') | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded); 125 SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded);
126 return generator ? SkImage::NewFromGenerator(generator, subset) : nullptr; 126 return generator ? SkImage::NewFromGenerator(generator, subset) : nullptr;
127 } 127 }
128 128
129 const char* SkImage::toString(SkString* str) const { 129 const char* SkImage::toString(SkString* str) const {
130 str->appendf("image: (id:%d (%d, %d) %s)", this->uniqueID(), this->width(), this->height(), 130 str->appendf("image: (id:%d (%d, %d) %s)", this->uniqueID(), this->width(), this->height(),
131 this->isOpaque() ? "opaque" : ""); 131 this->isOpaque() ? "opaque" : "");
132 return str->c_str(); 132 return str->c_str();
133 } 133 }
134 134
135 #ifdef SK_SUPPORT_LEGACY_NEWIMAGE
136 SkImage* SkImage::newImage(int newWidth, int newHeight, const SkIRect* subset) c onst {
137 #if 0
138 if (newWidth <= 0 || newHeight <= 0) {
139 return nullptr;
140 }
141
142 const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
143
144 if (subset) {
145 if (!bounds.contains(*subset)) {
146 return nullptr;
147 }
148 if (bounds == *subset) {
149 subset = nullptr; // and fall through to check below
150 }
151 }
152
153 if (nullptr == subset && this->width() == newWidth && this->height() == newH eight) {
154 return SkRef(const_cast<SkImage*>(this));
155 }
156
157 return as_IB(this)->onNewImage(newWidth, newHeight, subset, quality);
158 #else
159 SkASSERT(subset);
160 SkASSERT(subset->width() == newWidth);
161 SkASSERT(subset->height() == newHeight);
162 return this->newSubset(*subset);
163 #endif
164 }
165 #endif
166
167 SkImage* SkImage::newSubset(const SkIRect& subset) const { 135 SkImage* SkImage::newSubset(const SkIRect& subset) const {
168 if (subset.isEmpty()) { 136 if (subset.isEmpty()) {
169 return nullptr; 137 return nullptr;
170 } 138 }
171 139
172 const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height()); 140 const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
173 if (!bounds.contains(subset)) { 141 if (!bounds.contains(subset)) {
174 return nullptr; 142 return nullptr;
175 } 143 }
176 144
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 324
357 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) { 325 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
358 return nullptr; 326 return nullptr;
359 } 327 }
360 328
361 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 329 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
362 return nullptr; 330 return nullptr;
363 } 331 }
364 332
365 #endif 333 #endif
OLDNEW
« no previous file with comments | « include/core/SkImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698