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 GrTextureAdjuster_DEFINED
9#define GrTextureAdjuster_DEFINED
10
11#include "src/core/SkTLazy.h"
12#include "src/gpu/GrTextureProducer.h"
13#include "src/gpu/GrTextureProxy.h"
14
15class GrRecordingContext;
16
17/**
18 * GrTextureProducer subclass that can be used when the user already has a texture that represents
19 * image contents.
20 */
21class GrTextureAdjuster final : public GrTextureProducer {
22public:
23 GrTextureAdjuster(GrRecordingContext*, GrSurfaceProxyView, const GrColorInfo&,
24 uint32_t uniqueID);
25
26 std::unique_ptr<GrFragmentProcessor> createFragmentProcessor(const SkMatrix& textureMatrix,
27 const SkRect* subset,
28 const SkRect* domain,
29 GrSamplerState) override;
30
31 std::unique_ptr<GrFragmentProcessor> createBicubicFragmentProcessor(
32 const SkMatrix& textureMatrix,
33 const SkRect* subset,
34 const SkRect* domain,
35 GrSamplerState::WrapMode wrapX,
36 GrSamplerState::WrapMode wrapY) override;
37
38private:
39 GrSurfaceProxyView onView(GrMipmapped) override;
40
41 GrSurfaceProxyView makeMippedCopy();
42
43 GrSurfaceProxyView fOriginal;
44 uint32_t fUniqueID;
45
46 typedef GrTextureProducer INHERITED;
47};
48
49#endif
50