Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrTextureMaker_DEFINED |
| 9 | #define GrTextureMaker_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/gpu/GrTextureProducer.h" |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 12 | |
| 13 | /** |
| 14 | * Base class for sources that start out as something other than a texture (encoded image, |
| 15 | * picture, ...). |
| 16 | */ |
| 17 | class GrTextureMaker : public GrTextureProducer { |
| 18 | public: |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame] | 19 | std::unique_ptr<GrFragmentProcessor> createFragmentProcessor(const SkMatrix& textureMatrix, |
| 20 | const SkRect* subset, |
| 21 | const SkRect* domain, |
| 22 | GrSamplerState) override; |
| 23 | |
| 24 | std::unique_ptr<GrFragmentProcessor> createBicubicFragmentProcessor( |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 25 | const SkMatrix& textureMatrix, |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame] | 26 | const SkRect* subset, |
| 27 | const SkRect* domain, |
Brian Salomon | 777e146 | 2020-02-28 21:10:31 -0500 | [diff] [blame] | 28 | GrSamplerState::WrapMode wrapX, |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame] | 29 | GrSamplerState::WrapMode wrapY) override; |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 30 | |
| 31 | protected: |
Brian Salomon | 777e146 | 2020-02-28 21:10:31 -0500 | [diff] [blame] | 32 | GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info) |
| 33 | : INHERITED(context, info) {} |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 34 | |
Brian Salomon | b62cee3 | 2020-02-28 13:34:16 -0500 | [diff] [blame] | 35 | private: |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 36 | /** |
| 37 | * Return the maker's "original" texture. It is the responsibility of the maker to handle any |
| 38 | * caching of the original if desired. |
| 39 | */ |
Brian Salomon | 7e67dca | 2020-07-21 09:27:25 -0400 | [diff] [blame] | 40 | virtual GrSurfaceProxyView refOriginalTextureProxyView(GrMipmapped) = 0; |
Robert Phillips | 0c984a0 | 2017-03-16 07:51:56 -0400 | [diff] [blame] | 41 | |
Brian Salomon | 7e67dca | 2020-07-21 09:27:25 -0400 | [diff] [blame] | 42 | GrSurfaceProxyView onView(GrMipmapped) final; |
Brian Salomon | 2a943df | 2018-05-04 13:43:19 -0400 | [diff] [blame] | 43 | |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 44 | typedef GrTextureProducer INHERITED; |
| 45 | }; |
| 46 | |
| 47 | #endif |