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(
20 const SkMatrix& textureMatrix,
21 const SkRect& constraintRect,
22 FilterConstraint filterConstraint,
23 bool coordsLimitedToConstraintRect,
24 GrSamplerState::WrapMode wrapX,
25 GrSamplerState::WrapMode wrapY,
26 const GrSamplerState::Filter* filterOrNullForBicubic) override;
27
28protected:
29 GrTextureMaker(GrRecordingContext* context, const GrImageInfo& info)
30 : INHERITED(context, info) {}
31
32private:
33 /**
34 * Return the maker's "original" texture. It is the responsibility of the maker to handle any
35 * caching of the original if desired.
36 */
37 virtual GrSurfaceProxyView refOriginalTextureProxyView(GrMipMapped) = 0;
38
39 GrSurfaceProxyView onView(GrMipMapped) final;
40
41 typedef GrTextureProducer INHERITED;
42};
43
44#endif
45