aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-04-20 13:43:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-20 18:19:56 +0000
commitf1b4382421f24563f1df07942a98a234220e687e (patch)
tree0859f00b61c9644857400b8e6e5495d1200a94ef
parent7ef28f35a2f7d17b90c776f76d4b374ccee6c347 (diff)
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>
-rw-r--r--gm/imagemasksubset.cpp2
-rw-r--r--gn/core.gni2
-rw-r--r--src/core/SkImageCacherator.h2
-rw-r--r--src/image/SkImage_Lazy.cpp (renamed from src/image/SkImage_Generator.cpp)32
4 files changed, 19 insertions, 19 deletions
diff --git a/gm/imagemasksubset.cpp b/gm/imagemasksubset.cpp
index 49ff3c5405..cdd85d1449 100644
--- a/gm/imagemasksubset.cpp
+++ b/gm/imagemasksubset.cpp
@@ -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));
},
diff --git a/gn/core.gni b/gn/core.gni
index 797a350286..21f7ee8355 100644
--- a/gn/core.gni
+++ b/gn/core.gni
@@ -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",
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index ed3a4d95d6..df5e2f6b65 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -162,7 +162,7 @@ private:
friend class GrImageTextureMaker;
friend class SkImage;
- friend class SkImage_Generator;
+ friend class SkImage_Lazy;
};
#endif
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Lazy.cpp
index 51fb281c26..b1f243b151 100644
--- a/src/image/SkImage_Generator.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -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,8 +48,8 @@ private:
///////////////////////////////////////////////////////////////////////////////
-bool SkImage_Generator::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
- int srcX, int srcY, CachingHint chint) const {
+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;
if (kDisallow_CachingHint == chint) {
@@ -74,36 +74,36 @@ 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,
- CachingHint chint) const {
+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,
- const GrSamplerParams& params,
- SkColorSpace* dstColorSpace,
- sk_sp<SkColorSpace>* texColorSpace,
- SkScalar scaleAdjust[2]) const {
+sk_sp<GrTextureProxy> SkImage_Lazy::asTextureProxyRef(GrContext* context,
+ const GrSamplerParams& params,
+ SkColorSpace* dstColorSpace,
+ sk_sp<SkColorSpace>* texColorSpace,
+ SkScalar scaleAdjust[2]) const {
return fCache.lockAsTextureProxy(context, params, dstColorSpace,
texColorSpace, this, scaleAdjust);
}
#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;
}