blob: 5b6a45a2e87f6eb0853133ba3dcae1108ea1152b [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 Salomon0ea33072020-07-14 10:43:42 -040019 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 Salomonaff329b2017-08-11 09:40:37 -040025 const SkMatrix& textureMatrix,
Brian Salomon0ea33072020-07-14 10:43:42 -040026 const SkRect* subset,
27 const SkRect* domain,
Brian Salomon777e1462020-02-28 21:10:31 -050028 GrSamplerState::WrapMode wrapX,
Mike Reed3867c702020-09-01 13:28:10 -040029 GrSamplerState::WrapMode wrapY,
30 SkImage::CubicResampler) override;
Brian Osmane8e54582016-11-28 10:06:27 -050031
32protected:
Brian Salomon777e1462020-02-28 21:10:31 -050033 GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info)
34 : INHERITED(context, info) {}
Brian Osmane8e54582016-11-28 10:06:27 -050035
Brian Salomonb62cee32020-02-28 13:34:16 -050036private:
Brian Osmane8e54582016-11-28 10:06:27 -050037 /**
38 * Return the maker's "original" texture. It is the responsibility of the maker to handle any
39 * caching of the original if desired.
40 */
Brian Salomon7e67dca2020-07-21 09:27:25 -040041 virtual GrSurfaceProxyView refOriginalTextureProxyView(GrMipmapped) = 0;
Robert Phillips0c984a02017-03-16 07:51:56 -040042
Brian Salomon7e67dca2020-07-21 09:27:25 -040043 GrSurfaceProxyView onView(GrMipmapped) final;
Brian Salomon2a943df2018-05-04 13:43:19 -040044
Brian Osmane8e54582016-11-28 10:06:27 -050045 typedef GrTextureProducer INHERITED;
46};
47
48#endif