Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: src/gpu/GrImageIDTextureAdjuster.cpp

Issue 1510903002: Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except when tiling) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrImageIDTextureAdjuster.cpp
diff --git a/src/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index c37c02277589c2b0f4a543cee7b46b068a21aea4..a9189f63fab88ba161b1821283142564f57d63e0 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();
+ }
+}
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698