aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
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 /src/image
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>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Lazy.cpp (renamed from src/image/SkImage_Generator.cpp)32
1 files changed, 16 insertions, 16 deletions
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;
}