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
11#include "src/gpu/GrTextureProducer.h"
12
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:
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(
25 const SkMatrix& textureMatrix,
26 const SkRect* subset,
27 const SkRect* domain,
28 GrSamplerState::WrapMode wrapX,
29 GrSamplerState::WrapMode wrapY) override;
30
31protected:
32 GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info)
33 : INHERITED(context, info) {}
34
35private:
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 */
40 virtual GrSurfaceProxyView refOriginalTextureProxyView(GrMipmapped) = 0;
41
42 GrSurfaceProxyView onView(GrMipmapped) final;
43
44 typedef GrTextureProducer INHERITED;
45};
46
47#endif
48