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 | #include "src/gpu/GrTextureMaker.h" |
9 | |
10 | #include "include/gpu/GrRecordingContext.h" |
11 | #include "src/gpu/GrColorSpaceXform.h" |
12 | #include "src/gpu/GrGpu.h" |
13 | #include "src/gpu/GrProxyProvider.h" |
14 | #include "src/gpu/GrRecordingContextPriv.h" |
15 | #include "src/gpu/SkGr.h" |
16 | |
17 | GrSurfaceProxyView GrTextureMaker::onView(GrMipmapped mipMapped) { |
18 | if (this->width() > this->context()->priv().caps()->maxTextureSize() || |
19 | this->height() > this->context()->priv().caps()->maxTextureSize()) { |
20 | return {}; |
21 | } |
22 | return this->refOriginalTextureProxyView(mipMapped); |
23 | } |
24 | |
25 | std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor( |
26 | const SkMatrix& textureMatrix, |
27 | const SkRect* subset, |
28 | const SkRect* domain, |
29 | GrSamplerState sampler) { |
30 | GrSurfaceProxyView view; |
31 | return this->createFragmentProcessorForView( |
32 | this->view(sampler.mipmapped()), textureMatrix, subset, domain, sampler); |
33 | } |
34 | |
35 | std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createBicubicFragmentProcessor( |
36 | const SkMatrix& textureMatrix, |
37 | const SkRect* subset, |
38 | const SkRect* domain, |
39 | GrSamplerState::WrapMode wrapX, |
40 | GrSamplerState::WrapMode wrapY) { |
41 | return this->createBicubicFragmentProcessorForView( |
42 | this->view(GrMipmapped::kNo), textureMatrix, subset, domain, wrapX, wrapY); |
43 | } |
44 | |