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

Unified Diff: src/gpu/SkGr.cpp

Issue 1459433002: Convert SkGpuDevice::drawTextureAdjuster to SkGpuDevice::drawTextureProducer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove redudant virtual decl Created 5 years, 1 month 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/SkGpuDevice_drawTexture.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 540edb6a38e728c6a5e1f018a2dc3840fda965a8..affd6cd9593b53dbc2dbc9742a5f89032974df37 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -285,63 +285,12 @@ void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
pixelRef->addGenIDChangeListener(new Invalidator(key));
}
-class RasterBitmap_GrTextureMaker : public GrTextureMaker {
-public:
- RasterBitmap_GrTextureMaker(const SkBitmap& bitmap)
- : INHERITED(bitmap.width(), bitmap.height())
- , fBitmap(bitmap)
- {
- SkASSERT(!bitmap.getTexture());
- if (!bitmap.isVolatile()) {
- SkIPoint origin = bitmap.pixelRefOrigin();
- SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(),
- bitmap.height());
- GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID(), subset);
- }
- }
-
-protected:
- GrTexture* refOriginalTexture(GrContext* ctx) override {
- GrTexture* tex;
-
- if (fOriginalKey.isValid()) {
- tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(fOriginalKey);
- if (tex) {
- return tex;
- }
- }
-
- tex = GrUploadBitmapToTexture(ctx, fBitmap);
- if (tex && fOriginalKey.isValid()) {
- tex->resourcePriv().setUniqueKey(fOriginalKey);
- GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
- }
- return tex;
- }
-
- void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override {
- if (fOriginalKey.isValid()) {
- MakeCopyKeyFromOrigKey(fOriginalKey, copyParams, copyKey);
- }
- }
-
- void didCacheCopy(const GrUniqueKey& copyKey) override {
- GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
- }
-
-private:
- const SkBitmap fBitmap;
- GrUniqueKey fOriginalKey;
-
- typedef GrTextureMaker INHERITED;
-};
-
GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
const GrTextureParams& params) {
if (bitmap.getTexture()) {
return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, nullptr);
}
- return RasterBitmap_GrTextureMaker(bitmap).refTextureForParams(ctx, params);
+ return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698