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

Unified Diff: src/core/SkImageCacherator.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/core/SkImageCacherator.h ('k') | src/gpu/GrImageIDTextureAdjuster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageCacherator.cpp
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index f4a2ab734a5dd60edc9563e2778a92f6d398b564..9074924b2ab0ac643a5d6216f2b99c0c859efa61 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -17,6 +17,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrGpuResourcePriv.h"
+#include "GrImageIDTextureAdjuster.h"
#include "GrResourceKey.h"
#include "GrTextureParams.h"
#include "GrYUVProvider.h"
@@ -289,60 +290,13 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
///////////////////////////////////////////////////////////////////////////////////////////////////
-#include "GrTextureParamsAdjuster.h"
-
-class Cacherator_GrTextureMaker : public GrTextureMaker {
-public:
- Cacherator_GrTextureMaker(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()));
- }
- }
-
-protected:
- // TODO: consider overriding this, for the case where the underlying generator might be
- // able to efficiently produce a "stretched" texture natively (e.g. picture-backed)
- // GrTexture* generateTextureForParams(const CopyParams&) override;
-
- GrTexture* refOriginalTexture() override {
- return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint);
- }
-
- void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) override {
- if (fOriginalKey.isValid()) {
- MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey);
- }
- }
-
- void didCacheCopy(const GrUniqueKey& copyKey) override {
- if (fClient) {
- as_IB(fClient)->notifyAddedToCache();
- }
- }
-
-private:
- SkImageCacherator* fCacher;
- const SkImage* fClient;
- GrUniqueKey fOriginalKey;
- SkImage::CachingHint fCachingHint;
-
- typedef GrTextureMaker INHERITED;
-};
-
GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams& params,
const SkImage* client, SkImage::CachingHint chint) {
if (!ctx) {
return nullptr;
}
- return Cacherator_GrTextureMaker(ctx, this, client, chint).refTextureForParams(params);
+ return GrImageTextureMaker(ctx, this, client, chint).refTextureForParams(params);
}
#else
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/gpu/GrImageIDTextureAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698