Rename SkImage_Generator to SkImage_Lazy
This removes a long-standing source of confusion: SkImage_Generator was an image that wrapped an SkImageGenerator (with an SkImageCacherator stuck in the middle). We could choose to rename either one, but SkImageGenerator is public, so take the easy road and rename the private image subclass. Given the existence of SkImage::isLazyGenerated, this name seems appropriate. Bug: skia: Change-Id: I061ece94f48538efb1dc5548010f6ca7d438a69b Reviewed-on: https://skia-review.googlesource.com/13979 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
7ef28f35a2
commit
f1b4382421
@ -63,7 +63,7 @@ const MakerT makers[] = {
|
||||
return make_mask(surface ? surface : SkSurface::MakeRaster(info));
|
||||
},
|
||||
|
||||
// SkImage_Generator
|
||||
// SkImage_Lazy
|
||||
[](SkCanvas*, const SkImageInfo& info) -> sk_sp<SkImage> {
|
||||
return SkImage::MakeFromGenerator(skstd::make_unique<MaskGenerator>(info));
|
||||
},
|
||||
|
@ -374,9 +374,9 @@ skia_core_sources = [
|
||||
"$_src/core/SkShadowShader.h",
|
||||
|
||||
"$_src/image/SkImage.cpp",
|
||||
"$_src/image/SkImage_Generator.cpp",
|
||||
|
||||
# "$_src/image/SkImage_Gpu.cpp",
|
||||
"$_src/image/SkImage_Lazy.cpp",
|
||||
"$_src/image/SkImage_Raster.cpp",
|
||||
"$_src/image/SkImageShader.cpp",
|
||||
"$_src/image/SkImageShader.h",
|
||||
|
@ -162,7 +162,7 @@ private:
|
||||
|
||||
friend class GrImageTextureMaker;
|
||||
friend class SkImage;
|
||||
friend class SkImage_Generator;
|
||||
friend class SkImage_Lazy;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "SkImagePriv.h"
|
||||
#include "SkPixelRef.h"
|
||||
|
||||
class SkImage_Generator : public SkImage_Base {
|
||||
class SkImage_Lazy : public SkImage_Base {
|
||||
public:
|
||||
SkImage_Generator(SkImageCacherator::Validator* validator)
|
||||
SkImage_Lazy(SkImageCacherator::Validator* validator)
|
||||
: INHERITED(validator->fInfo.width(), validator->fInfo.height(), validator->fUniqueID)
|
||||
, fCache(validator)
|
||||
{}
|
||||
@ -48,7 +48,7 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkImage_Generator::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
|
||||
bool SkImage_Lazy::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
|
||||
int srcX, int srcY, CachingHint chint) const {
|
||||
SkColorSpace* dstColorSpace = dstInfo.colorSpace();
|
||||
SkBitmap bm;
|
||||
@ -74,17 +74,17 @@ bool SkImage_Generator::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels
|
||||
return false;
|
||||
}
|
||||
|
||||
SkData* SkImage_Generator::onRefEncoded(GrContext* ctx) const {
|
||||
SkData* SkImage_Lazy::onRefEncoded(GrContext* ctx) const {
|
||||
return fCache.refEncoded(ctx);
|
||||
}
|
||||
|
||||
bool SkImage_Generator::getROPixels(SkBitmap* bitmap, SkColorSpace* dstColorSpace,
|
||||
bool SkImage_Lazy::getROPixels(SkBitmap* bitmap, SkColorSpace* dstColorSpace,
|
||||
CachingHint chint) const {
|
||||
return fCache.lockAsBitmap(nullptr, bitmap, this, dstColorSpace, chint);
|
||||
}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrTextureProxy> SkImage_Generator::asTextureProxyRef(GrContext* context,
|
||||
sk_sp<GrTextureProxy> SkImage_Lazy::asTextureProxyRef(GrContext* context,
|
||||
const GrSamplerParams& params,
|
||||
SkColorSpace* dstColorSpace,
|
||||
sk_sp<SkColorSpace>* texColorSpace,
|
||||
@ -94,16 +94,16 @@ sk_sp<GrTextureProxy> SkImage_Generator::asTextureProxyRef(GrContext* context,
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<SkImage> SkImage_Generator::onMakeSubset(const SkIRect& subset) const {
|
||||
sk_sp<SkImage> SkImage_Lazy::onMakeSubset(const SkIRect& subset) const {
|
||||
SkASSERT(fCache.info().bounds().contains(subset));
|
||||
SkASSERT(fCache.info().bounds() != subset);
|
||||
|
||||
const SkIRect generatorSubset = subset.makeOffset(fCache.fOrigin.x(), fCache.fOrigin.y());
|
||||
SkImageCacherator::Validator validator(fCache.fSharedGenerator, &generatorSubset);
|
||||
return validator ? sk_sp<SkImage>(new SkImage_Generator(&validator)) : nullptr;
|
||||
return validator ? sk_sp<SkImage>(new SkImage_Lazy(&validator)) : nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Generator::onMakeColorSpace(sk_sp<SkColorSpace> target) const {
|
||||
sk_sp<SkImage> SkImage_Lazy::onMakeColorSpace(sk_sp<SkColorSpace> target) const {
|
||||
SkBitmap dst;
|
||||
SkImageInfo dstInfo = fCache.info().makeColorSpace(target);
|
||||
if (kIndex_8_SkColorType == dstInfo.colorType() ||
|
||||
@ -129,5 +129,5 @@ sk_sp<SkImage> SkImage::MakeFromGenerator(std::unique_ptr<SkImageGenerator> gene
|
||||
SkImageCacherator::Validator validator(
|
||||
SkImageCacherator::SharedGenerator::Make(std::move(generator)), subset);
|
||||
|
||||
return validator ? sk_make_sp<SkImage_Generator>(&validator) : nullptr;
|
||||
return validator ? sk_make_sp<SkImage_Lazy>(&validator) : nullptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user