diff options
author | bsalomon <bsalomon@google.com> | 2015-10-16 13:35:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 13:35:10 -0700 |
commit | fcffaf22d697f06f903c3193308f9dc54a959f79 (patch) | |
tree | 38408d319b281941642893e3642d2b947a086cf6 /src/gpu/GrTextureMaker.h | |
parent | 466c2c48b9f78b974becbc6834970b6f6cdfa5f5 (diff) |
Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what copying needs to be done.
Review URL: https://codereview.chromium.org/1409163002
Diffstat (limited to 'src/gpu/GrTextureMaker.h')
-rw-r--r-- | src/gpu/GrTextureMaker.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/gpu/GrTextureMaker.h b/src/gpu/GrTextureMaker.h deleted file mode 100644 index 47141bdfb0..0000000000 --- a/src/gpu/GrTextureMaker.h +++ /dev/null @@ -1,76 +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 "SkGrPriv.h" - -class GrContext; -class GrTexture; -class GrTextureParams; -class GrUniqueKey; -class SkBitmap; - -class GrTextureMaker { -public: - GrTextureMaker(int width, int height) : fWidth(width), fHeight(height) {} - virtual ~GrTextureMaker() {} - - int width() const { return fWidth; } - int height() const { return fHeight; } - - GrTexture* refCachedTexture(GrContext*, const GrTextureParams&); - -protected: - /** - * Return the maker's "original" unstretched texture. It is the responsibility of the maker - * to make this efficient ... if the texture is being generated, the maker must handle - * caching it. - */ - virtual GrTexture* onRefUnstretchedTexture(GrContext*) = 0; - - /** - * If we need to stretch the maker's original texture, the maker is asked to return a key - * that identifies its origianl + the stretch parameter. If the maker does not want to cache - * the stretched version (e.g. the maker is volatile), this should ignore the key parameter - * and return false. - */ - virtual bool onMakeStretchedKey(const SkGrStretch&, GrUniqueKey* stretchedKey) = 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: - * - onRefUnstretchedTexture() - * - onGetROBitmap() - * - * Subclass may override this if they can handle stretching more efficiently. - */ - virtual GrTexture* onGenerateStretchedTexture(GrContext*, const SkGrStretch&); - - /** - * If a stretched version of the texture is generated, it may be cached (assuming that - * onMakeStretchedKey() returns true). In that case, the maker is notified in case it - * wants to note that for when the maker is destroyed. - */ - virtual void onNotifyStretchCached(const GrUniqueKey& stretchedKey) = 0; - - /** - * Some GPUs are unreliable w/ very small texture sizes. If we run into that case, this - * method will be called (in service of onGenerateStretchedTexture) to return a raster version - * of the original texture. - */ - virtual bool onGetROBitmap(SkBitmap*) = 0; - -private: - const int fWidth; - const int fHeight; -}; - -#endif |