blob: 992a0331f13915ea69bd3a1b385cd8ae0e91ef22 [file] [log] [blame]
Brian Salomon34169692017-08-28 15:32:01 -04001/*
2 * Copyright 2017 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 "GrColor.h"
Brian Salomon2bbdcc42017-09-07 12:36:34 -04009#include "GrSamplerState.h"
Brian Salomon485b8c62018-01-12 15:11:06 -050010#include "GrTypesPriv.h"
Brian Salomonb80ffee2018-05-23 16:39:39 -040011#include "SkCanvas.h"
Brian Osmand49e9462017-10-16 13:17:48 -040012#include "SkRefCnt.h"
Brian Salomon34169692017-08-28 15:32:01 -040013
Brian Osmand49e9462017-10-16 13:17:48 -040014class GrColorSpaceXform;
Brian Salomon34169692017-08-28 15:32:01 -040015class GrDrawOp;
16class GrTextureProxy;
17struct SkRect;
18class SkMatrix;
19
20namespace GrTextureOp {
Brian Salomonb80ffee2018-05-23 16:39:39 -040021
Brian Salomon34169692017-08-28 15:32:01 -040022/**
23 * Creates an op that draws a sub-rectangle of a texture. The passed color is modulated by the
24 * texture's color. 'srcRect' specifies the rectangle of the texture to draw. 'dstRect' specifies
25 * the rectangle to draw in local coords which will be transformed by 'viewMatrix' to be in device
Brian Salomon2213ee92018-10-02 10:44:21 -040026 * space. 'viewMatrix' must be affine. If GrAAType is kCoverage then AA is applied to the edges
27 * indicated by GrQuadAAFlags. Otherwise, GrQuadAAFlags is ignored.
Brian Salomon34169692017-08-28 15:32:01 -040028 */
Robert Phillips7c525e62018-06-12 10:11:12 -040029std::unique_ptr<GrDrawOp> Make(GrContext*,
30 sk_sp<GrTextureProxy>,
31 GrSamplerState::Filter,
32 GrColor,
33 const SkRect& srcRect,
34 const SkRect& dstRect,
35 GrAAType,
Brian Salomon2213ee92018-10-02 10:44:21 -040036 GrQuadAAFlags,
Robert Phillips7c525e62018-06-12 10:11:12 -040037 SkCanvas::SrcRectConstraint,
38 const SkMatrix& viewMatrix,
Brian Osman3ebd3542018-07-30 14:36:53 -040039 sk_sp<GrColorSpaceXform> textureXform,
40 sk_sp<GrColorSpaceXform> paintXform);
Brian Salomon34169692017-08-28 15:32:01 -040041}