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 | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 19 | std::unique_ptr<GrFragmentProcessor> createFragmentProcessor( |
| 20 | const SkMatrix& textureMatrix, |
| 21 | const SkRect& constraintRect, |
| 22 | FilterConstraint filterConstraint, |
| 23 | bool coordsLimitedToConstraintRect, |
Brian Osman | 05c8f46 | 2018-10-22 17:13:36 -0400 | [diff] [blame] | 24 | const GrSamplerState::Filter* filterOrNullForBicubic) override; |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 25 | |
| 26 | protected: |
Brian Salomon | 1a217eb | 2019-10-24 10:50:36 -0400 | [diff] [blame] | 27 | GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info, bool domainNeedsLocal) |
| 28 | : INHERITED(context, info, domainNeedsLocal) {} |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 29 | |
Brian Salomon | b62cee3 | 2020-02-28 13:34:16 -0500 | [diff] [blame^] | 30 | private: |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 31 | /** |
| 32 | * Return the maker's "original" texture. It is the responsibility of the maker to handle any |
| 33 | * caching of the original if desired. |
Stan Iliev | ba81af2 | 2017-06-08 15:16:53 -0400 | [diff] [blame] | 34 | * If "genType" argument equals AllowedTexGenType::kCheap and the texture is not trivial to |
| 35 | * construct then refOriginalTextureProxy should return nullptr (for example if texture is made |
| 36 | * by drawing into a render target). |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 37 | */ |
Brian Salomon | 6066b75 | 2020-02-26 15:34:27 -0500 | [diff] [blame] | 38 | virtual GrSurfaceProxyView refOriginalTextureProxyView(bool willBeMipped) = 0; |
Robert Phillips | 0c984a0 | 2017-03-16 07:51:56 -0400 | [diff] [blame] | 39 | |
Brian Salomon | b62cee3 | 2020-02-28 13:34:16 -0500 | [diff] [blame^] | 40 | GrSurfaceProxyView onRefTextureProxyViewForParams(GrSamplerState, bool willBeMipped) final; |
Brian Salomon | 2a943df | 2018-05-04 13:43:19 -0400 | [diff] [blame] | 41 | |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 42 | typedef GrTextureProducer INHERITED; |
| 43 | }; |
| 44 | |
| 45 | #endif |