diff options
author | Brian Osman <brianosman@google.com> | 2016-11-28 09:26:31 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-28 14:58:41 +0000 |
commit | 3b66ab6f9fdc6eacdf0ee1921da28751de30c018 (patch) | |
tree | e81d2a52f48030084c53260a0d3b1bcf0463c96c /src/gpu/GrBitmapTextureMaker.h | |
parent | 781c3c14629342ed3eb00d153822c751406ad80b (diff) |
GrTextureProducer cleanup, phase one: Bitmap and Image makers
Split these into their own files, and actually name the files after the
classes they contain. The top three classes in the hierarchy still need
attention, but those are going to be trickier.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5195
Change-Id: I295f4d50e35748eac38a31f302e14b5b62653c55
Reviewed-on: https://skia-review.googlesource.com/5195
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrBitmapTextureMaker.h')
-rw-r--r-- | src/gpu/GrBitmapTextureMaker.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gpu/GrBitmapTextureMaker.h b/src/gpu/GrBitmapTextureMaker.h new file mode 100644 index 0000000000..f66f20ce56 --- /dev/null +++ b/src/gpu/GrBitmapTextureMaker.h @@ -0,0 +1,38 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrBitmapTextureMaker_DEFINED +#define GrBitmapTextureMaker_DEFINED + +#include "GrTextureParamsAdjuster.h" + +/** This class manages the conversion of SW-backed bitmaps to GrTextures. If the input bitmap is + non-volatile the texture is cached using a key created from the pixels' image id and the + subset of the pixelref specified by the bitmap. */ +class GrBitmapTextureMaker : public GrTextureMaker { +public: + GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); + +protected: + GrTexture* refOriginalTexture(bool willBeMipped, SkDestinationSurfaceColorMode) override; + + void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey, + SkDestinationSurfaceColorMode colorMode) override; + + void didCacheCopy(const GrUniqueKey& copyKey) override; + + SkAlphaType alphaType() const override; + sk_sp<SkColorSpace> getColorSpace(SkDestinationSurfaceColorMode) override; + +private: + const SkBitmap fBitmap; + GrUniqueKey fOriginalKey; + + typedef GrTextureMaker INHERITED; +}; + +#endif |