aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrImageTextureMaker.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-04-26 16:20:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-27 18:31:19 +0000
commitdf7e075c74110fcfebdc49ca503684162e118af5 (patch)
tree4d4f55d2867115102a2d2460096c9fe8ce0ecb51 /src/gpu/GrImageTextureMaker.cpp
parent0aa742f15a400433bafe6350c20523b4dd062f64 (diff)
Fold SkImageCacherator into SkImage_Lazy
SkImageCacherator still exists, but only as an interface implemented (solely) by SkImage_Lazy. The only external clients are GrImageTextureMaker and SkImage_Gpu::getDeferredTextureImageData. This is probably an improvement, but doesn't go as far as I'd hoped. Bug: skia: Change-Id: I6812badfabb6924b025621b21af00cbde9c16cac Reviewed-on: https://skia-review.googlesource.com/14371 Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrImageTextureMaker.cpp')
-rw-r--r--src/gpu/GrImageTextureMaker.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index a1a6053a03..bbdc9c1913 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -14,26 +14,20 @@
#include "SkImageCacherator.h"
#include "SkPixelRef.h"
-static bool cacher_is_alpha_only(const SkImageCacherator& cacher) {
- return kAlpha_8_SkColorType == cacher.info().colorType();
-}
-
-GrImageTextureMaker::GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher,
- const SkImage* client, SkImage::CachingHint chint)
- : INHERITED(context, cacher->info().width(), cacher->info().height(),
- cacher_is_alpha_only(*cacher))
- , fCacher(cacher)
- , fClient(client)
- , fCachingHint(chint) {
- if (client) {
- GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(),
- SkIRect::MakeWH(this->width(), this->height()));
- }
+GrImageTextureMaker::GrImageTextureMaker(GrContext* context, const SkImage* client,
+ SkImage::CachingHint chint)
+ : INHERITED(context, client->width(), client->height(), client->isAlphaOnly())
+ , fCacher(as_IB(client)->peekCacherator())
+ , fClient(client)
+ , fCachingHint(chint) {
+ SkASSERT(fCacher);
+ GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(),
+ SkIRect::MakeWH(this->width(), this->height()));
}
sk_sp<GrTextureProxy> GrImageTextureMaker::refOriginalTextureProxy(bool willBeMipped,
SkColorSpace* dstColorSpace) {
- return fCacher->lockTextureProxy(this->context(), fOriginalKey, fClient, fCachingHint,
+ return fCacher->lockTextureProxy(this->context(), fOriginalKey, fCachingHint,
willBeMipped, dstColorSpace);
}
@@ -49,13 +43,11 @@ void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa
}
void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
- if (fClient) {
- as_IB(fClient)->notifyAddedToCache();
- }
+ as_IB(fClient)->notifyAddedToCache();
}
SkAlphaType GrImageTextureMaker::alphaType() const {
- return fCacher->info().alphaType();
+ return fClient->alphaType();
}
sk_sp<SkColorSpace> GrImageTextureMaker::getColorSpace(SkColorSpace* dstColorSpace) {
return fCacher->getColorSpace(this->context(), dstColorSpace);