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

Unified Diff: src/image/SkImage_Gpu.cpp

Issue 1420963008: Pull texture-backed bitmap resampler out of GrTextureParamsAdjuster code into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@nomin
Patch Set: fix unused var warning Created 5 years, 2 months 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/SkGr.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Gpu.cpp
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 8e5ce4564c24afdfab2ebbc212a90748ef73632d..dd4bee311d0a864109af766e33d05eaf67dfd74f 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -14,7 +14,7 @@
#include "effects/GrYUVtoRGBEffect.h"
#include "SkCanvas.h"
#include "SkGpuDevice.h"
-#include "SkGr.h"
+#include "SkGrPriv.h"
#include "SkPixelRef.h"
SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
@@ -67,47 +67,31 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
return true;
}
-static void make_raw_texture_stretched_key(uint32_t imageID,
- const GrTextureParamsAdjuster::CopyParams& params,
- GrUniqueKey* stretchedKey) {
- static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
- GrUniqueKey::Builder builder(stretchedKey, kDomain, 4);
- builder[0] = imageID;
- builder[1] = params.fFilter;
- builder[2] = params.fWidth;
- builder[3] = params.fHeight;
-}
-
-class Texture_GrTextureParamsAdjuster : public GrTextureParamsAdjuster {
+class GpuImage_GrTextureAdjuster : public GrTextureAdjuster {
public:
- Texture_GrTextureParamsAdjuster(const SkImage* image, GrTexture* unstretched)
- : INHERITED(image->width(), image->height())
+ GpuImage_GrTextureAdjuster(const SkImage_Gpu* image)
+ : INHERITED(image->peekTexture())
, fImage(image)
- , fOriginal(unstretched)
{}
protected:
- GrTexture* refOriginalTexture(GrContext* ctx) override {
- return SkRef(fOriginal);
+ void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override {
+ GrUniqueKey baseKey;
+ GrMakeKeyFromImageID(&baseKey, fImage->uniqueID(),
+ SkIRect::MakeWH(fImage->width(), fImage->height()));
+ MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
}
- void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override {
- make_raw_texture_stretched_key(fImage->uniqueID(), copyParams, copyKey);
- }
-
- void didCacheCopy(const GrUniqueKey& copyKey) override {
- as_IB(fImage)->notifyAddedToCache();
- }
+ void didCacheCopy(const GrUniqueKey& copyKey) override { as_IB(fImage)->notifyAddedToCache(); }
private:
const SkImage* fImage;
- GrTexture* fOriginal;
- typedef GrTextureParamsAdjuster INHERITED;
+ typedef GrTextureAdjuster INHERITED;
};
GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params) const {
- return Texture_GrTextureParamsAdjuster(this, fTexture).refTextureForParams(ctx, params);
+ return GpuImage_GrTextureAdjuster(this).refTextureSafeForParams(params, nullptr);
}
bool SkImage_Gpu::isOpaque() const {
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698