| 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 | |
| 15 | class GrRecordingContext; |
| 16 | |
| 17 | /** |
| 18 | * GrTextureProducer subclass that can be used when the user already has a texture that represents |
| 19 | * image contents. |
| 20 | */ |
| 21 | class GrTextureAdjuster final : public GrTextureProducer { |
| 22 | public: |
| 23 | GrTextureAdjuster(GrRecordingContext*, GrSurfaceProxyView, const GrColorInfo&, |
| 24 | uint32_t uniqueID); |
| 25 | |
| 26 | std::unique_ptr<GrFragmentProcessor> createFragmentProcessor( |
| 27 | const SkMatrix& textureMatrix, |
| 28 | const SkRect& constraintRect, |
| 29 | FilterConstraint, |
| 30 | bool coordsLimitedToConstraintRect, |
| 31 | GrSamplerState::WrapMode wrapX, |
| 32 | GrSamplerState::WrapMode wrapY, |
| 33 | const GrSamplerState::Filter* filterOrNullForBicubic) override; |
| 34 | |
| 35 | private: |
| 36 | GrSurfaceProxyView onView(GrMipMapped) override; |
| 37 | |
| 38 | GrSurfaceProxyView makeMippedCopy(); |
| 39 | |
| 40 | GrSurfaceProxyView fOriginal; |
| 41 | uint32_t fUniqueID; |
| 42 | |
| 43 | typedef GrTextureProducer INHERITED; |
| 44 | }; |
| 45 | |
| 46 | #endif |
| 47 |