aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrImageIDTextureAdjuster.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-12-08 10:53:43 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-08 10:53:44 -0800
commit1cf6f9b6b51bcf09d93142ba40d6c331c21f50a6 (patch)
treebf57f918562a5fdeb0b700a1be381e4c4c2c3a3f /src/gpu/GrImageIDTextureAdjuster.cpp
parent1f6a1bd969db92daa5fa60517d6b8fc6eef8cb61 (diff)
Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except when tiling)
Diffstat (limited to 'src/gpu/GrImageIDTextureAdjuster.cpp')
-rw-r--r--src/gpu/GrImageIDTextureAdjuster.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index c37c022775..a9189f63fa 100644
--- a/src/gpu/GrImageIDTextureAdjuster.cpp
+++ b/src/gpu/GrImageIDTextureAdjuster.cpp
@@ -12,6 +12,7 @@
#include "SkBitmap.h"
#include "SkGrPriv.h"
#include "SkImage_Base.h"
+#include "SkImageCacherator.h"
#include "SkPixelRef.h"
GrBitmapTextureAdjuster::GrBitmapTextureAdjuster(const SkBitmap* bmp)
@@ -96,3 +97,33 @@ void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey
void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
}
+
+//////////////////////////////////////////////////////////////////////////////
+
+GrImageTextureMaker::GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher,
+ const SkImage* client, SkImage::CachingHint chint)
+ : INHERITED(context, cacher->info().width(), cacher->info().height())
+ , fCacher(cacher)
+ , fClient(client)
+ , fCachingHint(chint) {
+ if (client) {
+ GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(),
+ SkIRect::MakeWH(this->width(), this->height()));
+ }
+}
+
+GrTexture* GrImageTextureMaker::refOriginalTexture() {
+ return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint);
+}
+
+void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) {
+ if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) {
+ MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey);
+ }
+}
+
+void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
+ if (fClient) {
+ as_IB(fClient)->notifyAddedToCache();
+ }
+}