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

Unified Diff: src/gpu/GrTextureParamsAdjuster.h

Issue 1411353002: Revert recent CLs around GrTextureMaker/GrTextureParamsAdjuster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrTextureMaker.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureParamsAdjuster.h
diff --git a/src/gpu/GrTextureParamsAdjuster.h b/src/gpu/GrTextureParamsAdjuster.h
deleted file mode 100644
index e1aa80e982a6abd3e7b586d045be87c839590b20..0000000000000000000000000000000000000000
--- a/src/gpu/GrTextureParamsAdjuster.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextureMaker_DEFINED
-#define GrTextureMaker_DEFINED
-
-#include "GrTextureParams.h"
-#include "GrResourceKey.h"
-
-class GrContext;
-class GrTexture;
-class GrTextureParams;
-class GrUniqueKey;
-class SkBitmap;
-
-/**
- * Different GPUs and API extensions have different requirements with respect to what texture
- * sampling parameters may be used with textures of various types. This class facilitates making
- * texture compatible with a given GrTextureParams. It abstracts the source of the original data
- * which may be an already existing texture, CPU pixels, a codec, ... so that various sources can
- * be used with common code that scales or copies the data to make it compatible with a
- * GrTextureParams.
- */
-class GrTextureParamsAdjuster {
-public:
- struct CopyParams {
- GrTextureParams::FilterMode fFilter;
- int fWidth;
- int fHeight;
- };
-
- GrTextureParamsAdjuster(int width, int height) : fWidth(width), fHeight(height) {}
- virtual ~GrTextureParamsAdjuster() {}
-
- int width() const { return fWidth; }
- int height() const { return fHeight; }
-
- /** Returns a texture that is safe for use with the params */
- GrTexture* refTextureForParams(GrContext*, const GrTextureParams&);
-
-protected:
- /**
- * Return the maker's "original" texture. It is the responsibility of the maker
- * to make this efficient ... if the texture is being generated, the maker must handle
- * caching it (if desired).
- */
- virtual GrTexture* refOriginalTexture(GrContext*) = 0;
-
- /**
- * If we need to copy the maker's original texture, the maker is asked to return a key
- * that identifies its original + the CopyParms parameter. If the maker does not want to cache
- * the stretched version (e.g. the maker is volatile), this should simply return without
- * initializing the copyKey.
- */
- virtual void makeCopyKey(const CopyParams&, GrUniqueKey* copyKey) = 0;
-
- /**
- * Return a new (uncached) texture that is the stretch of the maker's original.
- *
- * The base-class handles general logic for this, and only needs access to the following
- * methods:
- * - onRefOriginalTexture()
- * - onGetROBitmap()
- *
- * Subclass may override this if they can handle creating the texture more directly than
- * by copying.
- */
- virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&);
-
- /**
- * If a stretched version of the texture is generated, it may be cached (assuming that
- * onMakeParamsKey() returns true). In that case, the maker is notified in case it
- * wants to note that for when the maker is destroyed.
- */
- virtual void didCacheCopy(const GrUniqueKey& copyKey) = 0;
-
- /**
- * Some GPUs are unreliable w/ very small texture sizes. If we run into that case, this
- * method will be called (in service of onGenerateParamsTexture) to return a raster version
- * of the original texture.
- */
- virtual bool getROBitmap(SkBitmap*) = 0;
-
- /** Helper for creating a key for a copy from an original key. */
- static void MakeCopyKeyFromOrigKey(const GrUniqueKey& origKey,
- const CopyParams& copyParams,
- GrUniqueKey* copyKey) {
- SkASSERT(!copyKey->isValid());
- if (origKey.isValid()) {
- static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
- GrUniqueKey::Builder builder(copyKey, origKey, kDomain, 3);
- builder[0] = copyParams.fFilter;
- builder[1] = copyParams.fWidth;
- builder[2] = copyParams.fHeight;
- }
- }
-
-private:
- const int fWidth;
- const int fHeight;
-};
-
-#endif
« no previous file with comments | « src/gpu/GrTextureMaker.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698