Remove SkImage::newImage()
All clients converted to newSubset(). R=reed@google.com Review URL: https://codereview.chromium.org/1364263002
This commit is contained in:
parent
7f0a3d7523
commit
3f9deab9fc
@ -272,28 +272,6 @@ public:
|
||||
|
||||
const char* toString(SkString*) const;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_NEWIMAGE
|
||||
/**
|
||||
* Return an image that is a rescale of this image (using newWidth, newHeight).
|
||||
*
|
||||
* If subset is NULL, then the entire original image is used as the src for the scaling.
|
||||
* If subset is not NULL, then it specifies subset of src-pixels used for scaling. If
|
||||
* subset extends beyond the bounds of the original image, then NULL is returned.
|
||||
*
|
||||
* Notes:
|
||||
* - newWidth and newHeight must be > 0 or NULL will be returned.
|
||||
*
|
||||
* - it is legal for the returned image to be the same instance as the src image
|
||||
* (if the new dimensions == the src dimensions and subset is NULL or == src dimensions).
|
||||
*
|
||||
* - it is legal for the "scaled" image to have changed its SkAlphaType from unpremul
|
||||
* to premul (as required by the impl). The image should draw (nearly) identically,
|
||||
* since during drawing we will "apply the alpha" to the pixels. Future optimizations
|
||||
* may take away this caveat, preserving unpremul.
|
||||
*/
|
||||
SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset) const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a new image that is a subset of this image. The underlying implementation may
|
||||
* share the pixels, or it may make a copy.
|
||||
|
@ -132,38 +132,6 @@ const char* SkImage::toString(SkString* str) const {
|
||||
return str->c_str();
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_NEWIMAGE
|
||||
SkImage* SkImage::newImage(int newWidth, int newHeight, const SkIRect* subset) const {
|
||||
#if 0
|
||||
if (newWidth <= 0 || newHeight <= 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
|
||||
|
||||
if (subset) {
|
||||
if (!bounds.contains(*subset)) {
|
||||
return nullptr;
|
||||
}
|
||||
if (bounds == *subset) {
|
||||
subset = nullptr; // and fall through to check below
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr == subset && this->width() == newWidth && this->height() == newHeight) {
|
||||
return SkRef(const_cast<SkImage*>(this));
|
||||
}
|
||||
|
||||
return as_IB(this)->onNewImage(newWidth, newHeight, subset, quality);
|
||||
#else
|
||||
SkASSERT(subset);
|
||||
SkASSERT(subset->width() == newWidth);
|
||||
SkASSERT(subset->height() == newHeight);
|
||||
return this->newSubset(*subset);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
SkImage* SkImage::newSubset(const SkIRect& subset) const {
|
||||
if (subset.isEmpty()) {
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user