Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "src/gpu/GrTextureMaker.h" |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 9 | |
Robert Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 10 | #include "include/gpu/GrRecordingContext.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/gpu/GrColorSpaceXform.h" |
| 12 | #include "src/gpu/GrGpu.h" |
| 13 | #include "src/gpu/GrProxyProvider.h" |
| 14 | #include "src/gpu/GrRecordingContextPriv.h" |
Brian Salomon | adc9bbb | 2020-02-20 20:10:31 -0500 | [diff] [blame] | 15 | #include "src/gpu/SkGr.h" |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 16 | |
Brian Salomon | ecbb0fb | 2020-02-28 18:07:32 -0500 | [diff] [blame] | 17 | GrSurfaceProxyView GrTextureMaker::onView(GrMipMapped mipMapped) { |
Robert Phillips | 9338c60 | 2019-02-19 12:52:29 -0500 | [diff] [blame] | 18 | if (this->width() > this->context()->priv().caps()->maxTextureSize() || |
| 19 | this->height() > this->context()->priv().caps()->maxTextureSize()) { |
Greg Daniel | cc104db | 2020-02-03 14:17:08 -0500 | [diff] [blame] | 20 | return {}; |
Brian Osman | 875f785 | 2018-04-12 13:29:08 -0400 | [diff] [blame] | 21 | } |
Brian Salomon | ecbb0fb | 2020-02-28 18:07:32 -0500 | [diff] [blame] | 22 | return this->refOriginalTextureProxyView(mipMapped); |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 23 | } |
| 24 | |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 25 | std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor( |
| 26 | const SkMatrix& textureMatrix, |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame^] | 27 | const SkRect* subset, |
| 28 | const SkRect* domain, |
| 29 | GrSamplerState sampler) { |
Brian Salomon | ecbb0fb | 2020-02-28 18:07:32 -0500 | [diff] [blame] | 30 | GrSurfaceProxyView view; |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame^] | 31 | return this->createFragmentProcessorForView( |
| 32 | this->view(sampler.filter()), textureMatrix, subset, domain, sampler); |
| 33 | } |
Michael Ludwig | ddeed37 | 2019-02-20 16:50:10 -0500 | [diff] [blame] | 34 | |
Brian Salomon | 0ea3307 | 2020-07-14 10:43:42 -0400 | [diff] [blame^] | 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); |
Brian Osman | e8e5458 | 2016-11-28 10:06:27 -0500 | [diff] [blame] | 43 | } |