blob: 637002eed139e7079d43a6f02c0c27182cfa47e2 [file] [log] [blame]
Brian Osmane8e54582016-11-28 10:06:27 -05001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/GrTextureMaker.h"
Brian Osmane8e54582016-11-28 10:06:27 -05009
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040010#include "include/gpu/GrRecordingContext.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrColorSpaceXform.h"
12#include "src/gpu/GrGpu.h"
13#include "src/gpu/GrProxyProvider.h"
14#include "src/gpu/GrRecordingContextPriv.h"
Brian Salomonadc9bbb2020-02-20 20:10:31 -050015#include "src/gpu/SkGr.h"
Brian Osmane8e54582016-11-28 10:06:27 -050016
Brian Salomon7e67dca2020-07-21 09:27:25 -040017GrSurfaceProxyView GrTextureMaker::onView(GrMipmapped mipMapped) {
Robert Phillips9338c602019-02-19 12:52:29 -050018 if (this->width() > this->context()->priv().caps()->maxTextureSize() ||
19 this->height() > this->context()->priv().caps()->maxTextureSize()) {
Greg Danielcc104db2020-02-03 14:17:08 -050020 return {};
Brian Osman875f7852018-04-12 13:29:08 -040021 }
Brian Salomonecbb0fb2020-02-28 18:07:32 -050022 return this->refOriginalTextureProxyView(mipMapped);
Brian Osmane8e54582016-11-28 10:06:27 -050023}
24
Brian Salomonaff329b2017-08-11 09:40:37 -040025std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
26 const SkMatrix& textureMatrix,
Brian Salomon0ea33072020-07-14 10:43:42 -040027 const SkRect* subset,
28 const SkRect* domain,
29 GrSamplerState sampler) {
Brian Salomonecbb0fb2020-02-28 18:07:32 -050030 GrSurfaceProxyView view;
Brian Salomon0ea33072020-07-14 10:43:42 -040031 return this->createFragmentProcessorForView(
32 this->view(sampler.filter()), textureMatrix, subset, domain, sampler);
33}
Michael Ludwigddeed372019-02-20 16:50:10 -050034
Brian Salomon0ea33072020-07-14 10:43:42 -040035std::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(
Brian Salomon7e67dca2020-07-21 09:27:25 -040042 this->view(GrMipmapped::kNo), textureMatrix, subset, domain, wrapX, wrapY);
Brian Osmane8e54582016-11-28 10:06:27 -050043}