blob: b3f9e47946d54a2381bf3b75a0c3b4dabd707b81 [file] [log] [blame]
Brian Osmane8e54582016-11-28 10:06:27 -05001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrTextureProducer.h"
Brian Osmane8e54582016-11-28 10:06:27 -050012
13/**
14 * Base class for sources that start out as something other than a texture (encoded image,
15 * picture, ...).
16 */
17class GrTextureMaker : public GrTextureProducer {
18public:
Brian Salomonaff329b2017-08-11 09:40:37 -040019 std::unique_ptr<GrFragmentProcessor> createFragmentProcessor(
20 const SkMatrix& textureMatrix,
21 const SkRect& constraintRect,
22 FilterConstraint filterConstraint,
23 bool coordsLimitedToConstraintRect,
Brian Osman05c8f462018-10-22 17:13:36 -040024 const GrSamplerState::Filter* filterOrNullForBicubic) override;
Brian Osmane8e54582016-11-28 10:06:27 -050025
26protected:
Brian Salomon1a217eb2019-10-24 10:50:36 -040027 GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info, bool domainNeedsLocal)
28 : INHERITED(context, info, domainNeedsLocal) {}
Brian Osmane8e54582016-11-28 10:06:27 -050029
30 /**
31 * Return the maker's "original" texture. It is the responsibility of the maker to handle any
32 * caching of the original if desired.
Stan Ilievba81af22017-06-08 15:16:53 -040033 * If "genType" argument equals AllowedTexGenType::kCheap and the texture is not trivial to
34 * construct then refOriginalTextureProxy should return nullptr (for example if texture is made
35 * by drawing into a render target).
Brian Osmane8e54582016-11-28 10:06:27 -050036 */
Brian Salomon6066b752020-02-26 15:34:27 -050037 virtual GrSurfaceProxyView refOriginalTextureProxyView(bool willBeMipped) = 0;
Robert Phillips0c984a02017-03-16 07:51:56 -040038
Brian Osmane8e54582016-11-28 10:06:27 -050039private:
Brian Salomonc8d092a2020-02-24 10:14:21 -050040 GrSurfaceProxyView onRefTextureProxyViewForParams(GrSamplerState, bool willBeMipped) override;
Brian Salomon2a943df2018-05-04 13:43:19 -040041
Brian Osmane8e54582016-11-28 10:06:27 -050042 typedef GrTextureProducer INHERITED;
43};
44
45#endif