blob: 9b0b6620383203b6a07e68d17bf9d628a2e72b6d [file] [log] [blame]
robertphillipsea461502015-05-26 11:38:03 -07001/*
2 * Copyright 2015 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
Brian Osman11052242016-10-27 14:47:55 -04008#ifndef GrRenderTargetContext_DEFINED
9#define GrRenderTargetContext_DEFINED
robertphillipsea461502015-05-26 11:38:03 -070010
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkCanvas.h"
12#include "include/core/SkDrawable.h"
13#include "include/core/SkRefCnt.h"
14#include "include/core/SkSurface.h"
15#include "include/core/SkSurfaceProps.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050016#include "include/private/GrTypesPriv.h"
Greg Danielf41b2bd2019-08-22 16:19:24 -040017#include "src/gpu/GrOpsTask.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050018#include "src/gpu/GrPaint.h"
Greg Danielf91aeb22019-06-18 09:58:02 -040019#include "src/gpu/GrRenderTargetProxy.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050020#include "src/gpu/GrSurfaceContext.h"
Greg Daniela83de582019-10-22 09:33:25 -040021#include "src/gpu/GrSurfaceProxyView.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050022#include "src/gpu/GrXferProcessor.h"
Michael Ludwig61328202019-06-19 14:48:58 +000023#include "src/gpu/geometry/GrQuad.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050024#include "src/gpu/text/GrTextTarget.h"
robertphillipsea461502015-05-26 11:38:03 -070025
Greg Daniela5cb7812017-06-16 09:45:32 -040026class GrBackendSemaphore;
robertphillipsea461502015-05-26 11:38:03 -070027class GrClip;
Brian Osman2240be92017-10-18 13:15:13 -040028class GrColorSpaceXform;
Chris Dalton1a325d22017-07-14 15:17:41 -060029class GrCoverageCountingPathRenderer;
robertphillips77a2e522015-10-17 07:43:27 -070030class GrDrawingManager;
Brian Salomon9afd3712016-12-01 10:59:09 -050031class GrDrawOp;
csmartdalton29df7602016-08-31 11:55:52 -070032class GrFixedClip;
Robert Phillips0d075de2019-03-04 11:08:13 -050033class GrOp;
robertphillipsea461502015-05-26 11:38:03 -070034class GrRenderTarget;
Brian Osman45580d32016-11-23 09:37:01 -050035class GrRenderTargetContextPriv;
Brian Salomon2fad74a2017-12-20 13:28:55 -050036class GrShape;
bsalomon6663acf2016-05-10 09:14:17 -070037class GrStyle;
Robert Phillipseaa86252016-11-08 13:49:39 +000038class GrTextureProxy;
robertphillips44302392016-07-08 14:43:03 -070039struct GrUserStencilSettings;
Jim Van Verth3af1af92017-05-18 15:06:54 -040040struct SkDrawShadowRec;
Herb Derbycddab252018-07-16 11:19:04 -040041class SkGlyphRunList;
robertphillipsea461502015-05-26 11:38:03 -070042struct SkIPoint;
43struct SkIRect;
msarett10e3d9b2016-08-18 15:46:03 -070044class SkLatticeIter;
robertphillipsea461502015-05-26 11:38:03 -070045class SkMatrix;
robertphillips2334fb62015-06-17 05:43:33 -070046class SkPaint;
robertphillipsea461502015-05-26 11:38:03 -070047class SkPath;
48struct SkPoint;
49struct SkRect;
Brian Osman45580d32016-11-23 09:37:01 -050050class SkRegion;
robertphillipsea461502015-05-26 11:38:03 -070051class SkRRect;
jvanverth31ff7622015-08-07 10:09:28 -070052struct SkRSXform;
robertphillips2334fb62015-06-17 05:43:33 -070053class SkTextBlob;
Brian Salomon199fb872017-02-06 09:41:10 -050054class SkVertices;
robertphillipsea461502015-05-26 11:38:03 -070055
Brian Osman45580d32016-11-23 09:37:01 -050056/**
57 * A helper object to orchestrate commands (draws, etc...) for GrSurfaces that are GrRenderTargets.
robertphillipsea461502015-05-26 11:38:03 -070058 */
Brian Salomon57f211b2019-08-21 15:21:09 -040059class GrRenderTargetContext : public GrSurfaceContext {
robertphillipsea461502015-05-26 11:38:03 -070060public:
Brian Osman11052242016-10-27 14:47:55 -040061 ~GrRenderTargetContext() override;
robertphillips2334fb62015-06-17 05:43:33 -070062
Robert Phillipse4643cc2018-08-14 13:01:29 -040063 virtual void drawGlyphRunList(const GrClip&, const SkMatrix& viewMatrix, const SkGlyphRunList&);
robertphillipsea461502015-05-26 11:38:03 -070064
robertphillipsea461502015-05-26 11:38:03 -070065 /**
66 * Provides a perfomance hint that the render target's contents are allowed
67 * to become undefined.
68 */
robertphillips2e1e51f2015-10-15 08:01:48 -070069 void discard();
robertphillipsea461502015-05-26 11:38:03 -070070
Chris Dalton344e9032017-12-11 15:42:09 -070071 enum class CanClearFullscreen : bool {
72 kNo = false,
73 kYes = true
74 };
75
robertphillipsea461502015-05-26 11:38:03 -070076 /**
77 * Clear the entire or rect of the render target, ignoring any clips.
robertphillipsea461502015-05-26 11:38:03 -070078 * @param rect the rect to clear or the whole thing if rect is NULL.
79 * @param color the color to clear to.
Chris Dalton344e9032017-12-11 15:42:09 -070080 * @param CanClearFullscreen allows partial clears to be converted to fullscreen clears on
81 * tiling platforms where that is an optimization.
robertphillipsea461502015-05-26 11:38:03 -070082 */
Brian Osman9a9baae2018-11-05 15:06:26 -050083 void clear(const SkIRect* rect, const SkPMColor4f& color, CanClearFullscreen);
robertphillipsea461502015-05-26 11:38:03 -070084
Chris Dalton0493fbd2019-09-18 15:49:46 -060085 void clear(const SkPMColor4f& color) {
86 return this->clear(nullptr, color, CanClearFullscreen::kYes);
87 }
88
robertphillipsea461502015-05-26 11:38:03 -070089 /**
90 * Draw everywhere (respecting the clip) with the paint.
91 */
Brian Salomon82f44312017-01-11 13:42:54 -050092 void drawPaint(const GrClip&, GrPaint&&, const SkMatrix& viewMatrix);
robertphillipsea461502015-05-26 11:38:03 -070093
94 /**
Brian Salomon0e8fc8b2016-12-09 15:10:07 -050095 * Draw the rect using a paint.
96 * @param paint describes how to color pixels.
97 * @param GrAA Controls whether rect is antialiased
98 * @param viewMatrix transformation matrix
99 * @param style The style to apply. Null means fill. Currently path effects are not
100 * allowed.
101 * The rects coords are used to access the paint (through texture matrix)
robertphillipsea461502015-05-26 11:38:03 -0700102 */
robertphillips2e1e51f2015-10-15 08:01:48 -0700103 void drawRect(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500104 GrPaint&& paint,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500105 GrAA,
robertphillipsea461502015-05-26 11:38:03 -0700106 const SkMatrix& viewMatrix,
107 const SkRect&,
Brian Salomon82f44312017-01-11 13:42:54 -0500108 const GrStyle* style = nullptr);
robertphillipsea461502015-05-26 11:38:03 -0700109
110 /**
bsalomona2e69fc2015-11-05 10:41:43 -0800111 * Maps a rectangle of shader coordinates to a rectangle and fills that rectangle.
robertphillipsea461502015-05-26 11:38:03 -0700112 *
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500113 * @param paint describes how to color pixels.
114 * @param GrAA Controls whether rect is antialiased
115 * @param viewMatrix transformation matrix which applies to rectToDraw
116 * @param rectToDraw the rectangle to draw
117 * @param localRect the rectangle of shader coordinates applied to rectToDraw
robertphillipsea461502015-05-26 11:38:03 -0700118 */
Michael Ludwig136f45a2019-02-19 11:44:41 -0500119 void fillRectToRect(const GrClip& clip,
Brian Salomon82f44312017-01-11 13:42:54 -0500120 GrPaint&& paint,
Michael Ludwig136f45a2019-02-19 11:44:41 -0500121 GrAA aa,
bsalomona2e69fc2015-11-05 10:41:43 -0800122 const SkMatrix& viewMatrix,
123 const SkRect& rectToDraw,
Michael Ludwig136f45a2019-02-19 11:44:41 -0500124 const SkRect& localRect) {
Michael Ludwig61328202019-06-19 14:48:58 +0000125 this->drawFilledQuad(clip, std::move(paint), aa,
126 aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone,
127 GrQuad::MakeFromRect(rectToDraw, viewMatrix), GrQuad(localRect));
Michael Ludwig136f45a2019-02-19 11:44:41 -0500128 }
robertphillipsea461502015-05-26 11:38:03 -0700129
130 /**
bsalomona2e69fc2015-11-05 10:41:43 -0800131 * Fills a rect with a paint and a localMatrix.
robertphillipsea461502015-05-26 11:38:03 -0700132 */
bsalomona2e69fc2015-11-05 10:41:43 -0800133 void fillRectWithLocalMatrix(const GrClip& clip,
Brian Salomon82f44312017-01-11 13:42:54 -0500134 GrPaint&& paint,
Michael Ludwig61328202019-06-19 14:48:58 +0000135 GrAA aa,
bsalomona2e69fc2015-11-05 10:41:43 -0800136 const SkMatrix& viewMatrix,
137 const SkRect& rect,
Michael Ludwig61328202019-06-19 14:48:58 +0000138 const SkMatrix& localMatrix) {
139 this->drawFilledQuad(clip, std::move(paint), aa,
140 aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone,
141 GrQuad::MakeFromRect(rect, viewMatrix),
142 GrQuad::MakeFromRect(rect, localMatrix));
143 }
robertphillipsea461502015-05-26 11:38:03 -0700144
Michael Ludwig75451902019-01-23 11:14:29 -0500145 /**
146 * Creates an op that draws a fill rect with per-edge control over anti-aliasing.
Michael Ludwigce62dec2019-02-19 11:48:46 -0500147 *
148 * This is a specialized version of fillQuadWithEdgeAA, but is kept separate since knowing
149 * the geometry is a rectangle affords more optimizations.
Michael Ludwig75451902019-01-23 11:14:29 -0500150 */
Michael Ludwig136f45a2019-02-19 11:44:41 -0500151 void fillRectWithEdgeAA(const GrClip& clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
152 const SkMatrix& viewMatrix, const SkRect& rect,
Michael Ludwig61328202019-06-19 14:48:58 +0000153 const SkRect* optionalLocalRect = nullptr) {
154 const SkRect& localRect = optionalLocalRect ? *optionalLocalRect : rect;
155 this->drawFilledQuad(clip, std::move(paint), aa, edgeAA,
156 GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(localRect));
157 }
Michael Ludwig75451902019-01-23 11:14:29 -0500158
Michael Ludwigce62dec2019-02-19 11:48:46 -0500159 /**
160 * Similar to fillRectWithEdgeAA but draws an arbitrary 2D convex quadrilateral transformed
161 * by 'viewMatrix', with per-edge control over anti-aliasing. The quad should follow the
162 * ordering used by SkRect::toQuad(), which determines how the edge AA is applied:
163 * - "top" = points [0] and [1]
164 * - "right" = points[1] and [2]
165 * - "bottom" = points[2] and [3]
166 * - "left" = points[3] and [0]
167 *
168 * The last argument, 'optionalLocalQuad', can be null if no separate local coordinates are
169 * necessary.
170 */
171 void fillQuadWithEdgeAA(const GrClip& clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
172 const SkMatrix& viewMatrix, const SkPoint quad[4],
Michael Ludwig61328202019-06-19 14:48:58 +0000173 const SkPoint optionalLocalQuad[4]) {
174 const SkPoint* localQuad = optionalLocalQuad ? optionalLocalQuad : quad;
175 this->drawFilledQuad(clip, std::move(paint), aa, edgeAA,
176 GrQuad::MakeFromSkQuad(quad, viewMatrix),
177 GrQuad::MakeFromSkQuad(localQuad, SkMatrix::I()));
178 }
Michael Ludwigce62dec2019-02-19 11:48:46 -0500179
Michael Ludwig69858532018-11-28 15:34:34 -0500180 /** Used with drawQuadSet */
181 struct QuadSetEntry {
182 SkRect fRect;
183 SkPMColor4f fColor; // Overrides any color on the GrPaint
184 SkMatrix fLocalMatrix;
185 GrQuadAAFlags fAAFlags;
186 };
187
Michael Ludwig75451902019-01-23 11:14:29 -0500188 // TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
Michael Ludwig69858532018-11-28 15:34:34 -0500189 void drawQuadSet(const GrClip& clip, GrPaint&& paint, GrAA aa, const SkMatrix& viewMatrix,
190 const QuadSetEntry[], int cnt);
191
robertphillipsea461502015-05-26 11:38:03 -0700192 /**
Brian Salomon34169692017-08-28 15:32:01 -0400193 * Creates an op that draws a subrectangle of a texture. The passed color is modulated by the
194 * texture's color. 'srcRect' specifies the rectangle of the texture to draw. 'dstRect'
195 * specifies the rectangle to draw in local coords which will be transformed by 'viewMatrix' to
Brian Salomonbe3c1d22018-05-21 12:54:39 -0400196 * device space.
Brian Salomon34169692017-08-28 15:32:01 -0400197 */
Greg Danielc594e622019-10-15 14:01:49 -0400198 void drawTexture(const GrClip& clip, sk_sp<GrTextureProxy> proxy, GrColorType srcColorType,
Brian Salomon078e8fa2019-11-22 04:10:18 +0000199 GrSamplerState::Filter filter, SkBlendMode mode, const SkPMColor4f& color,
200 const SkRect& srcRect, const SkRect& dstRect, GrAA aa, GrQuadAAFlags edgeAA,
201 SkCanvas::SrcRectConstraint constraint, const SkMatrix& viewMatrix,
202 sk_sp<GrColorSpaceXform> texXform) {
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000203 const SkRect* domain = constraint == SkCanvas::kStrict_SrcRectConstraint ?
204 &srcRect : nullptr;
Greg Daniel549325c2019-10-30 16:19:20 -0400205 GrSurfaceOrigin origin = proxy->origin();
206 const GrSwizzle& swizzle = proxy->textureSwizzle();
207 GrSurfaceProxyView proxyView(std::move(proxy), origin, swizzle);
Brian Salomon078e8fa2019-11-22 04:10:18 +0000208 this->drawTexturedQuad(clip, std::move(proxyView), srcColorType, std::move(texXform),
Greg Daniel549325c2019-10-30 16:19:20 -0400209 filter, color, mode, aa, edgeAA,
210 GrQuad::MakeFromRect(dstRect, viewMatrix), GrQuad(srcRect), domain);
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000211 }
Brian Salomon34169692017-08-28 15:32:01 -0400212
Michael Ludwigce62dec2019-02-19 11:48:46 -0500213 /**
214 * Variant of drawTexture that instead draws the texture applied to 'dstQuad' transformed by
215 * 'viewMatrix', using the 'srcQuad' texture coordinates clamped to the optional 'domain'. If
216 * 'domain' is null, it's equivalent to using the fast src rect constraint. If 'domain' is
217 * provided, the strict src rect constraint is applied using 'domain'.
218 */
Greg Danielc594e622019-10-15 14:01:49 -0400219 void drawTextureQuad(const GrClip& clip, sk_sp<GrTextureProxy> proxy, GrColorType srcColorType,
Brian Salomon078e8fa2019-11-22 04:10:18 +0000220 GrSamplerState::Filter filter, SkBlendMode mode, const SkPMColor4f& color,
221 const SkPoint srcQuad[4], const SkPoint dstQuad[4], GrAA aa,
222 GrQuadAAFlags edgeAA, const SkRect* domain, const SkMatrix& viewMatrix,
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000223 sk_sp<GrColorSpaceXform> texXform) {
Greg Daniel549325c2019-10-30 16:19:20 -0400224 GrSurfaceOrigin origin = proxy->origin();
225 const GrSwizzle& swizzle = proxy->textureSwizzle();
226 GrSurfaceProxyView proxyView(std::move(proxy), origin, swizzle);
Brian Salomon078e8fa2019-11-22 04:10:18 +0000227 this->drawTexturedQuad(clip, std::move(proxyView), srcColorType, std::move(texXform),
Greg Daniel549325c2019-10-30 16:19:20 -0400228 filter, color, mode, aa, edgeAA,
229 GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000230 GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain);
231 }
Michael Ludwigce62dec2019-02-19 11:48:46 -0500232
Brian Salomond7065e72018-10-12 11:42:02 -0400233 /** Used with drawTextureSet */
234 struct TextureSetEntry {
Greg Daniel549325c2019-10-30 16:19:20 -0400235 GrSurfaceProxyView fProxyView;
Brian Salomon078e8fa2019-11-22 04:10:18 +0000236 GrColorType fSrcColorType;
Brian Salomond7065e72018-10-12 11:42:02 -0400237 SkRect fSrcRect;
238 SkRect fDstRect;
Michael Ludwig1433cfd2019-02-27 17:12:30 -0500239 const SkPoint* fDstClipQuad; // Must be null, or point to an array of 4 points
Michael Ludwig7ae2ab52019-03-05 16:00:20 -0500240 const SkMatrix* fPreViewMatrix; // If not null, entry's CTM is 'viewMatrix' * fPreViewMatrix
Brian Salomon1da5cad2018-11-21 09:21:18 -0500241 float fAlpha;
Brian Salomond7065e72018-10-12 11:42:02 -0400242 GrQuadAAFlags fAAFlags;
243 };
244 /**
245 * Draws a set of textures with a shared filter, color, view matrix, color xform, and
246 * texture color xform. The textures must all have the same GrTextureType and GrConfig.
Michael Ludwigce62dec2019-02-19 11:48:46 -0500247 *
248 * If any entries provide a non-null fDstClip array, it will be read from immediately based on
249 * fDstClipCount, so the pointer can become invalid after this returns.
Brian Salomond7065e72018-10-12 11:42:02 -0400250 */
251 void drawTextureSet(const GrClip&, const TextureSetEntry[], int cnt, GrSamplerState::Filter,
Michael Ludwig31ba7182019-04-03 10:38:06 -0400252 SkBlendMode mode, GrAA aa, SkCanvas::SrcRectConstraint,
253 const SkMatrix& viewMatrix, sk_sp<GrColorSpaceXform> texXform);
Brian Salomond7065e72018-10-12 11:42:02 -0400254
Brian Salomon34169692017-08-28 15:32:01 -0400255 /**
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500256 * Draw a roundrect using a paint.
robertphillipsea461502015-05-26 11:38:03 -0700257 *
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500258 * @param paint describes how to color pixels.
259 * @param GrAA Controls whether rrect is antialiased.
260 * @param viewMatrix transformation matrix
261 * @param rrect the roundrect to draw
262 * @param style style to apply to the rrect. Currently path effects are not allowed.
robertphillipsea461502015-05-26 11:38:03 -0700263 */
robertphillips2e1e51f2015-10-15 08:01:48 -0700264 void drawRRect(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500265 GrPaint&&,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500266 GrAA,
robertphillipsea461502015-05-26 11:38:03 -0700267 const SkMatrix& viewMatrix,
268 const SkRRect& rrect,
bsalomon6663acf2016-05-10 09:14:17 -0700269 const GrStyle& style);
robertphillipsea461502015-05-26 11:38:03 -0700270
271 /**
Jim Van Verth3af1af92017-05-18 15:06:54 -0400272 * Use a fast method to render the ambient and spot shadows for a path.
273 * Will return false if not possible for the given path.
Jim Van Verthc5903412016-11-17 15:27:09 -0500274 *
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500275 * @param viewMatrix transformation matrix
Jim Van Verth3af1af92017-05-18 15:06:54 -0400276 * @param path the path to shadow
277 * @param rec parameters for shadow rendering
Jim Van Verthc5903412016-11-17 15:27:09 -0500278 */
Jim Van Verth3af1af92017-05-18 15:06:54 -0400279 bool drawFastShadow(const GrClip&,
Jim Van Verth3af1af92017-05-18 15:06:54 -0400280 const SkMatrix& viewMatrix,
281 const SkPath& path,
282 const SkDrawShadowRec& rec);
Jim Van Verthc5903412016-11-17 15:27:09 -0500283
284 /**
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500285 * Shortcut for filling a SkPath consisting of nested rrects using a paint. The result is
286 * undefined if outer does not contain inner.
robertphillips00095892016-02-29 13:50:40 -0800287 *
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500288 * @param paint describes how to color pixels.
289 * @param GrAA Controls whether rrects edges are antialiased
290 * @param viewMatrix transformation matrix
291 * @param outer the outer roundrect
292 * @param inner the inner roundrect
robertphillips00095892016-02-29 13:50:40 -0800293 */
294 void drawDRRect(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500295 GrPaint&&,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500296 GrAA,
robertphillips00095892016-02-29 13:50:40 -0800297 const SkMatrix& viewMatrix,
298 const SkRRect& outer,
299 const SkRRect& inner);
300
301 /**
robertphillipsea461502015-05-26 11:38:03 -0700302 * Draws a path.
303 *
304 * @param paint describes how to color pixels.
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500305 * @param GrAA Controls whether the path is antialiased.
robertphillipsea461502015-05-26 11:38:03 -0700306 * @param viewMatrix transformation matrix
307 * @param path the path to draw
bsalomon6663acf2016-05-10 09:14:17 -0700308 * @param style style to apply to the path.
robertphillipsea461502015-05-26 11:38:03 -0700309 */
robertphillips2e1e51f2015-10-15 08:01:48 -0700310 void drawPath(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500311 GrPaint&&,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500312 GrAA,
robertphillipsea461502015-05-26 11:38:03 -0700313 const SkMatrix& viewMatrix,
314 const SkPath&,
Robert Phillips20390c32018-08-17 11:01:03 -0400315 const GrStyle&);
316
317 /**
318 * Draws a shape.
319 *
320 * @param paint describes how to color pixels.
321 * @param GrAA Controls whether the path is antialiased.
322 * @param viewMatrix transformation matrix
323 * @param shape the shape to draw
324 */
325 void drawShape(const GrClip&,
326 GrPaint&&,
327 GrAA,
328 const SkMatrix& viewMatrix,
329 const GrShape&);
330
robertphillipsea461502015-05-26 11:38:03 -0700331
332 /**
333 * Draws vertices with a paint.
334 *
Brian Osmanae0c50c2017-05-25 16:56:34 -0400335 * @param paint describes how to color pixels.
336 * @param viewMatrix transformation matrix
337 * @param vertices specifies the mesh to draw.
Ruiqi Mao4ec72f72018-07-10 17:21:07 -0400338 * @param bones bone deformation matrices.
339 * @param boneCount number of bone matrices.
Brian Osmanae0c50c2017-05-25 16:56:34 -0400340 * @param overridePrimType primitive type to draw. If NULL, derive prim type from vertices.
robertphillipsea461502015-05-26 11:38:03 -0700341 */
robertphillips2e1e51f2015-10-15 08:01:48 -0700342 void drawVertices(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500343 GrPaint&& paint,
robertphillipsea461502015-05-26 11:38:03 -0700344 const SkMatrix& viewMatrix,
Brian Osmanae0c50c2017-05-25 16:56:34 -0400345 sk_sp<SkVertices> vertices,
Ruiqi Maoc97a3392018-08-15 10:44:19 -0400346 const SkVertices::Bone bones[],
Ruiqi Mao4ec72f72018-07-10 17:21:07 -0400347 int boneCount,
Brian Osmanae0c50c2017-05-25 16:56:34 -0400348 GrPrimitiveType* overridePrimType = nullptr);
Brian Salomon199fb872017-02-06 09:41:10 -0500349
350 /**
Brian Osman4d92b892019-03-24 00:53:23 +0000351 * Draws textured sprites from an atlas with a paint. This currently does not support AA for the
352 * sprite rectangle edges.
353 *
354 * @param paint describes how to color pixels.
355 * @param viewMatrix transformation matrix
356 * @param spriteCount number of sprites.
357 * @param xform array of compressed transformation data, required.
358 * @param texRect array of texture rectangles used to access the paint.
359 * @param colors optional array of per-sprite colors, supercedes
360 * the paint's color field.
361 */
362 void drawAtlas(const GrClip&,
363 GrPaint&& paint,
364 const SkMatrix& viewMatrix,
365 int spriteCount,
366 const SkRSXform xform[],
367 const SkRect texRect[],
368 const SkColor colors[]);
369
370 /**
msarettcc319b92016-08-25 18:07:18 -0700371 * Draws a region.
372 *
373 * @param paint describes how to color pixels
374 * @param viewMatrix transformation matrix
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500375 * @param aa should the rects of the region be antialiased.
msarettcc319b92016-08-25 18:07:18 -0700376 * @param region the region to be drawn
377 * @param style style to apply to the region
378 */
379 void drawRegion(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500380 GrPaint&& paint,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500381 GrAA aa,
msarettcc319b92016-08-25 18:07:18 -0700382 const SkMatrix& viewMatrix,
383 const SkRegion& region,
Stan Iliev73d8fd92017-08-02 15:36:24 -0400384 const GrStyle& style,
385 const GrUserStencilSettings* ss = nullptr);
msarettcc319b92016-08-25 18:07:18 -0700386
jvanverth31ff7622015-08-07 10:09:28 -0700387 /**
robertphillipsea461502015-05-26 11:38:03 -0700388 * Draws an oval.
389 *
390 * @param paint describes how to color pixels.
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500391 * @param GrAA Controls whether the oval is antialiased.
robertphillipsea461502015-05-26 11:38:03 -0700392 * @param viewMatrix transformation matrix
393 * @param oval the bounding rect of the oval.
bsalomon6663acf2016-05-10 09:14:17 -0700394 * @param style style to apply to the oval. Currently path effects are not allowed.
robertphillipsea461502015-05-26 11:38:03 -0700395 */
robertphillips2e1e51f2015-10-15 08:01:48 -0700396 void drawOval(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500397 GrPaint&& paint,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500398 GrAA,
robertphillipsea461502015-05-26 11:38:03 -0700399 const SkMatrix& viewMatrix,
400 const SkRect& oval,
bsalomon6663acf2016-05-10 09:14:17 -0700401 const GrStyle& style);
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500402 /**
403 * Draws a partial arc of an oval.
404 *
405 * @param paint describes how to color pixels.
Brian Salomon99504082016-12-09 15:51:31 -0500406 * @param GrGrAA Controls whether the arc is antialiased.
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500407 * @param viewMatrix transformation matrix.
408 * @param oval the bounding rect of the oval.
409 * @param startAngle starting angle in degrees.
410 * @param sweepAngle angle to sweep in degrees. Must be in (-360, 360)
411 * @param useCenter true means that the implied path begins at the oval center, connects as
412 * a line to the point indicated by the start contains the arc indicated by
413 * the sweep angle. If false the line beginning at the center point is
414 * omitted.
415 * @param style style to apply to the oval.
416 */
bsalomon4f3a0ca2016-08-22 13:14:26 -0700417 void drawArc(const GrClip&,
Brian Salomon82f44312017-01-11 13:42:54 -0500418 GrPaint&& paint,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500419 GrAA,
bsalomon4f3a0ca2016-08-22 13:14:26 -0700420 const SkMatrix& viewMatrix,
421 const SkRect& oval,
422 SkScalar startAngle,
423 SkScalar sweepAngle,
424 bool useCenter,
425 const GrStyle& style);
robertphillipsea461502015-05-26 11:38:03 -0700426
joshualitt33a5fce2015-11-18 13:28:51 -0800427 /**
bsalomon4f3a0ca2016-08-22 13:14:26 -0700428 * Draw the image as a set of rects, specified by |iter|.
joshualitt33a5fce2015-11-18 13:28:51 -0800429 */
msarett10e3d9b2016-08-18 15:46:03 -0700430 void drawImageLattice(const GrClip&,
Brian Salomon2a943df2018-05-04 13:43:19 -0400431 GrPaint&&,
msarett10e3d9b2016-08-18 15:46:03 -0700432 const SkMatrix& viewMatrix,
Brian Salomon2a943df2018-05-04 13:43:19 -0400433 sk_sp<GrTextureProxy>,
Greg Danielc594e622019-10-15 14:01:49 -0400434 GrColorType srcColorType,
Brian Salomon2a943df2018-05-04 13:43:19 -0400435 sk_sp<GrColorSpaceXform>,
436 GrSamplerState::Filter,
437 std::unique_ptr<SkLatticeIter>,
msarett10e3d9b2016-08-18 15:46:03 -0700438 const SkRect& dst);
robertphillipsea461502015-05-26 11:38:03 -0700439
robertphillips8c523e02016-07-26 07:41:00 -0700440 /**
Greg Daniel46cfbc62019-06-07 11:43:30 -0400441 * Draws the src texture with no matrix. The dstRect is the dstPoint with the width and height
442 * of the srcRect. The srcRect and dstRect are clipped to the bounds of the src and dst surfaces
443 * respectively.
444 */
Brian Salomon078e8fa2019-11-22 04:10:18 +0000445 bool blitTexture(GrTextureProxy* src, GrColorType srcColorType, const SkIRect& srcRect,
446 const SkIPoint& dstPoint);
Greg Daniel46cfbc62019-06-07 11:43:30 -0400447
448 /**
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400449 * Adds the necessary signal and wait semaphores and adds the passed in SkDrawable to the
450 * command stream.
451 */
452 void drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
453
Brian Salomonab32f652019-05-10 14:24:50 -0400454 using ReadPixelsCallback = SkSurface::ReadPixelsCallback;
455 using ReadPixelsContext = SkSurface::ReadPixelsContext;
Brian Salomon024bd002019-06-11 11:38:16 -0400456 using RescaleGamma = SkSurface::RescaleGamma;
457
458 // GPU implementation for SkSurface::asyncRescaleAndReadPixels.
Brian Salomon031b0ba2019-05-23 11:05:26 -0400459 void asyncRescaleAndReadPixels(const SkImageInfo& info, const SkIRect& srcRect,
Brian Salomon024bd002019-06-11 11:38:16 -0400460 RescaleGamma rescaleGamma, SkFilterQuality rescaleQuality,
461 ReadPixelsCallback callback, ReadPixelsContext context);
462 // GPU implementation for SkSurface::asyncRescaleAndReadPixelsYUV420.
463 void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
Brian Salomon9241a6d2019-10-03 13:26:54 -0400464 sk_sp<SkColorSpace> dstColorSpace,
465 const SkIRect& srcRect,
466 const SkISize& dstSize,
467 RescaleGamma rescaleGamma,
Brian Salomon024bd002019-06-11 11:38:16 -0400468 SkFilterQuality rescaleQuality,
Brian Salomon9241a6d2019-10-03 13:26:54 -0400469 ReadPixelsCallback callback,
Brian Salomon024bd002019-06-11 11:38:16 -0400470 ReadPixelsContext context);
Brian Salomonab32f652019-05-10 14:24:50 -0400471
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400472 /**
robertphillips8c523e02016-07-26 07:41:00 -0700473 * After this returns any pending surface IO will be issued to the backend 3D API and
474 * if the surface has MSAA it will be resolved.
475 */
Greg Daniele6bfb7d2019-04-17 15:26:11 -0400476 GrSemaphoresSubmitted flush(SkSurface::BackendSurfaceAccess access, const GrFlushInfo&);
Greg Daniela5cb7812017-06-16 09:45:32 -0400477
478 /**
479 * The next time this GrRenderTargetContext is flushed, the gpu will wait on the passed in
480 * semaphores before executing any commands.
481 */
Robert Phillipsbc4994a2019-02-14 08:36:56 -0500482 bool waitOnSemaphores(int numSemaphores, const GrBackendSemaphore waitSemaphores[]);
robertphillips8c523e02016-07-26 07:41:00 -0700483
Robert Phillips65a88fa2017-08-08 08:36:22 -0400484 void insertEventMarker(const SkString&);
485
Chris Daltoneffee202019-07-01 22:28:03 -0600486 const GrRenderTargetProxy* proxy() const { return fRenderTargetProxy.get(); }
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400487 int width() const { return fRenderTargetProxy->width(); }
488 int height() const { return fRenderTargetProxy->height(); }
Chris Dalton6ce447a2019-06-23 18:07:38 -0600489 int numSamples() const { return fRenderTargetProxy->numSamples(); }
robertphillipsca6eafc2016-05-17 09:57:46 -0700490 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
Greg Danielb46add82019-01-02 14:51:29 -0500491 bool wrapsVkSecondaryCB() const { return fRenderTargetProxy->wrapsVkSecondaryCB(); }
Greg Daniele252f082017-10-23 16:05:23 -0400492 GrMipMapped mipMapped() const;
robertphillips7bceedc2015-12-01 12:51:26 -0800493
Greg Daniela83de582019-10-22 09:33:25 -0400494 GrSurfaceProxyView outputSurfaceView() {
495 return { fRenderTargetProxy, fOrigin, fOutputSwizzle };
496 }
Greg Daniela83de582019-10-22 09:33:25 -0400497
Robert Phillipsbe9aff22019-02-15 11:33:22 -0500498 // This entry point should only be called if the backing GPU object is known to be
499 // instantiated.
500 GrRenderTarget* accessRenderTarget() { return fRenderTargetProxy->peekRenderTarget(); }
robertphillips6c7e3252016-04-27 10:47:51 -0700501
Robert Phillipsf200a902017-01-30 13:27:37 -0500502 GrSurfaceProxy* asSurfaceProxy() override { return fRenderTargetProxy.get(); }
503 const GrSurfaceProxy* asSurfaceProxy() const override { return fRenderTargetProxy.get(); }
504 sk_sp<GrSurfaceProxy> asSurfaceProxyRef() override { return fRenderTargetProxy; }
505
506 GrTextureProxy* asTextureProxy() override;
Greg Daniele252f082017-10-23 16:05:23 -0400507 const GrTextureProxy* asTextureProxy() const override;
Robert Phillipsf200a902017-01-30 13:27:37 -0500508 sk_sp<GrTextureProxy> asTextureProxyRef() override;
509
510 GrRenderTargetProxy* asRenderTargetProxy() override { return fRenderTargetProxy.get(); }
511 sk_sp<GrRenderTargetProxy> asRenderTargetProxyRef() override { return fRenderTargetProxy; }
Robert Phillipseaa86252016-11-08 13:49:39 +0000512
Robert Phillipsd46697a2017-01-25 12:10:37 -0500513 GrRenderTargetContext* asRenderTargetContext() override { return this; }
514
robertphillips391395d2016-03-02 09:26:36 -0800515 // Provides access to functions that aren't part of the public API.
Brian Osman693a5402016-10-27 15:13:22 -0400516 GrRenderTargetContextPriv priv();
517 const GrRenderTargetContextPriv priv() const;
joshualittf5883a62016-01-13 07:47:38 -0800518
Herb Derbyc1b482c2018-08-09 15:02:27 -0400519 GrTextTarget* textTarget() { return fTextTarget.get(); }
Brian Salomonf18b1d82017-10-27 11:30:49 -0400520
Robert Phillipsb5204762019-06-19 14:12:13 -0400521#if GR_TEST_UTILS
522 bool testingOnly_IsInstantiated() const { return fRenderTargetProxy->isInstantiated(); }
Chris Dalton6b982802019-06-27 13:53:46 -0600523 void testingOnly_SetPreserveOpsOnFullClear() { fPreserveOpsOnFullClear_TestingOnly = true; }
Greg Danielf41b2bd2019-08-22 16:19:24 -0400524 GrOpsTask* testingOnly_PeekLastOpsTask() { return fOpsTask.get(); }
Robert Phillipsb5204762019-06-19 14:12:13 -0400525#endif
Robert Phillipseaa86252016-11-08 13:49:39 +0000526
robertphillipsea461502015-05-26 11:38:03 -0700527private:
Brian Salomonf18b1d82017-10-27 11:30:49 -0400528 class TextTarget;
Michael Ludwig61328202019-06-19 14:48:58 +0000529 enum class QuadOptimization;
Brian Salomonf18b1d82017-10-27 11:30:49 -0400530
Chris Dalton7d6748e2019-03-13 00:34:52 -0600531 GrAAType chooseAAType(GrAA);
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500532
Brian Salomon649a3412017-03-09 13:50:43 -0500533 friend class GrAtlasTextBlob; // for access to add[Mesh]DrawOp
Greg Danielf41b2bd2019-08-22 16:19:24 -0400534 friend class GrClipStackClip; // for access to getOpsTask
Chris Daltonc4b47352019-08-23 10:10:36 -0600535 friend class GrOnFlushResourceProvider; // for access to getOpsTask (http://skbug.com/9357)
robertphillips55fdccc2016-06-06 06:16:20 -0700536
robertphillips77a2e522015-10-17 07:43:27 -0700537 friend class GrDrawingManager; // for ctor
Brian Osman11052242016-10-27 14:47:55 -0400538 friend class GrRenderTargetContextPriv;
robertphillips976f5f02016-06-03 10:59:20 -0700539
Brian Salomon42521e82016-12-07 16:44:58 -0500540 // All the path renderers currently make their own ops
Brian Salomon649a3412017-03-09 13:50:43 -0500541 friend class GrSoftwarePathRenderer; // for access to add[Mesh]DrawOp
542 friend class GrAAConvexPathRenderer; // for access to add[Mesh]DrawOp
543 friend class GrDashLinePathRenderer; // for access to add[Mesh]DrawOp
544 friend class GrAAHairLinePathRenderer; // for access to add[Mesh]DrawOp
545 friend class GrAALinearizingConvexPathRenderer; // for access to add[Mesh]DrawOp
Jim Van Verth83010462017-03-16 08:45:39 -0400546 friend class GrSmallPathRenderer; // for access to add[Mesh]DrawOp
Brian Salomon649a3412017-03-09 13:50:43 -0500547 friend class GrDefaultPathRenderer; // for access to add[Mesh]DrawOp
Brian Salomon649a3412017-03-09 13:50:43 -0500548 friend class GrStencilAndCoverPathRenderer; // for access to add[Mesh]DrawOp
549 friend class GrTessellatingPathRenderer; // for access to add[Mesh]DrawOp
Chris Dalton9414c962018-06-14 10:14:50 -0600550 friend class GrCCPerFlushResources; // for access to addDrawOp
Chris Dalton1a325d22017-07-14 15:17:41 -0600551 friend class GrCoverageCountingPathRenderer; // for access to addDrawOp
Robert Phillips438d9862019-11-14 12:46:05 -0500552 friend class GrFillRectOp; // for access to addDrawOp
Robert Phillipse837e612019-11-15 11:02:50 -0500553 friend class GrTextureOp; // for access to addDrawOp
Robert Phillips438d9862019-11-14 12:46:05 -0500554
Brian Salomon078e8fa2019-11-22 04:10:18 +0000555#if GR_TEST_UTILS
556 // for a unit test
557 friend void test_draw_op(GrContext*,
558 GrRenderTargetContext*,
559 std::unique_ptr<GrFragmentProcessor>,
560 sk_sp<GrTextureProxy>,
561 GrColorType);
562#endif
563
Greg Daniela83de582019-10-22 09:33:25 -0400564 GrRenderTargetContext(GrRecordingContext*, sk_sp<GrRenderTargetProxy>, GrColorType,
565 GrSurfaceOrigin, GrSwizzle texSwizzle, GrSwizzle outSwizzle,
566 sk_sp<SkColorSpace>, const SkSurfaceProps*, bool managedOpsTask = true);
567
568 SkDEBUGCODE(void validate() const override;)
569
570
Greg Danielf41b2bd2019-08-22 16:19:24 -0400571 GrOpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const;
Chris Dalton858cf232019-10-14 16:20:00 -0600572 void setNeedsStencil(bool useMixedSamplesIfNotMSAA);
Chris Dalton6b982802019-06-27 13:53:46 -0600573
Brian Osman9a9baae2018-11-05 15:06:26 -0500574 void internalClear(const GrFixedClip&, const SkPMColor4f&, CanClearFullscreen);
Michael Ludwigc39d0c82019-01-15 10:03:43 -0500575 void internalStencilClear(const GrFixedClip&, bool insideStencilMask);
csmartdalton29df7602016-08-31 11:55:52 -0700576
Brian Salomon82f44312017-01-11 13:42:54 -0500577 // Only consumes the GrPaint if successful.
robertphillips00095892016-02-29 13:50:40 -0800578 bool drawFilledDRRect(const GrClip& clip,
Brian Salomon82f44312017-01-11 13:42:54 -0500579 GrPaint&& paint,
Brian Salomon0e8fc8b2016-12-09 15:10:07 -0500580 GrAA,
robertphillips00095892016-02-29 13:50:40 -0800581 const SkMatrix& viewMatrix,
582 const SkRRect& origOuter,
583 const SkRRect& origInner);
584
Michael Ludwig61328202019-06-19 14:48:58 +0000585 // If the drawn quad's paint is a const blended color, provide it as a non-null pointer to
586 // 'constColor', which enables the draw-as-clear optimization. Otherwise it is assumed the paint
587 // requires some form of shading that invalidates using a clear op.
588 //
589 // The non-const pointers should be the original draw request on input, and will be updated as
590 // appropriate depending on the returned optimization level.
591 //
Michael Ludwige08b4432019-06-19 18:00:48 -0400592 // 'stencilSettings' are provided merely for decision making purposes; When non-null,
593 // optimization strategies that submit special ops are avoided.
Michael Ludwig61328202019-06-19 14:48:58 +0000594 QuadOptimization attemptQuadOptimization(const GrClip& clip,
595 const SkPMColor4f* constColor,
Michael Ludwige08b4432019-06-19 18:00:48 -0400596 const GrUserStencilSettings* stencilSettings,
Michael Ludwig61328202019-06-19 14:48:58 +0000597 GrAA* aa,
598 GrQuadAAFlags* edgeFlags,
599 GrQuad* deviceQuad,
600 GrQuad* localQuad);
robertphillips44302392016-07-08 14:43:03 -0700601
Michael Ludwig61328202019-06-19 14:48:58 +0000602 // If stencil settings, 'ss', are non-null, AA controls MSAA or no AA. If they are null, then AA
603 // can choose between coverage, MSAA as per chooseAAType(). This will always attempt to apply
604 // quad optimizations, so all quad/rect public APIs should rely on this function for consistent
605 // clipping behavior.
606 void drawFilledQuad(const GrClip& clip,
607 GrPaint&& paint,
608 GrAA aa,
609 GrQuadAAFlags edgeFlags,
610 const GrQuad& deviceQuad,
611 const GrQuad& localQuad,
612 const GrUserStencilSettings* ss = nullptr);
Brian Salomon7694b902019-06-18 21:00:21 +0000613
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000614 // Like drawFilledQuad but does not require using a GrPaint or FP for texturing
615 void drawTexturedQuad(const GrClip& clip,
Greg Daniel549325c2019-10-30 16:19:20 -0400616 GrSurfaceProxyView proxyView,
Brian Salomon078e8fa2019-11-22 04:10:18 +0000617 GrColorType srcColorType,
Michael Ludwigaee26ea2019-07-08 16:22:48 +0000618 sk_sp<GrColorSpaceXform> textureXform,
619 GrSamplerState::Filter filter,
620 const SkPMColor4f& color,
621 SkBlendMode blendMode,
622 GrAA aa,
623 GrQuadAAFlags edgeFlags,
624 const GrQuad& deviceQuad,
625 const GrQuad& localQuad,
626 const SkRect* domain = nullptr);
627
Brian Salomon2fad74a2017-12-20 13:28:55 -0500628 void drawShapeUsingPathRenderer(const GrClip&, GrPaint&&, GrAA, const SkMatrix&,
629 const GrShape&);
robertphillipsea461502015-05-26 11:38:03 -0700630
Chris Dalton08755122019-08-05 16:13:47 -0600631 void addOp(std::unique_ptr<GrOp>);
632
Brian Salomon348a0372018-10-31 10:42:18 -0400633 // Allows caller of addDrawOp to know which op list an op will be added to.
Greg Danielf41b2bd2019-08-22 16:19:24 -0400634 using WillAddOpFn = void(GrOp*, uint32_t opsTaskID);
Brian Salomon348a0372018-10-31 10:42:18 -0400635 // These perform processing specific to GrDrawOp-derived ops before recording them into an
636 // op list. Before adding the op to an op list the WillAddOpFn is called. Note that it
637 // will not be called in the event that the op is discarded. Moreover, the op may merge into
638 // another op after the function is called (either before addDrawOp returns or some time later).
639 void addDrawOp(const GrClip&, std::unique_ptr<GrDrawOp>,
640 const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
robertphillips2334fb62015-06-17 05:43:33 -0700641
Robert Phillipsbf25d432017-04-07 10:08:53 -0400642 // Makes a copy of the proxy if it is necessary for the draw and places the texture that should
643 // be used by GrXferProcessor to access the destination color in 'result'. If the return
644 // value is false then a texture copy could not be made.
Greg Daniel524e28b2019-11-01 11:48:53 -0400645 bool SK_WARN_UNUSED_RESULT setupDstProxyView(const GrClip&, const GrOp& op,
646 GrXferProcessor::DstProxyView* result);
Brian Salomon467921e2017-03-06 16:17:12 -0500647
Brian Salomon9241a6d2019-10-03 13:26:54 -0400648 class AsyncReadResult;
649
Brian Salomon024bd002019-06-11 11:38:16 -0400650 // The async read step of asyncRescaleAndReadPixels()
651 void asyncReadPixels(const SkIRect& rect, SkColorType colorType, ReadPixelsCallback callback,
652 ReadPixelsContext context);
653
Greg Danielf41b2bd2019-08-22 16:19:24 -0400654 GrOpsTask* getOpsTask();
robertphillipsa106c622015-10-16 09:07:06 -0700655
Herb Derbyc1b482c2018-08-09 15:02:27 -0400656 std::unique_ptr<GrTextTarget> fTextTarget;
Greg Daniela83de582019-10-22 09:33:25 -0400657
Brian Salomonf18b1d82017-10-27 11:30:49 -0400658 sk_sp<GrRenderTargetProxy> fRenderTargetProxy;
Greg Daniela83de582019-10-22 09:33:25 -0400659 GrSwizzle fOutputSwizzle;
robertphillipsa106c622015-10-16 09:07:06 -0700660
Greg Danielf41b2bd2019-08-22 16:19:24 -0400661 // In MDB-mode the GrOpsTask can be closed by some other renderTargetContext that has picked
662 // it up. For this reason, the GrOpsTask should only ever be accessed via 'getOpsTask'.
663 sk_sp<GrOpsTask> fOpsTask;
robertphillips2334fb62015-06-17 05:43:33 -0700664
Brian Salomonf18b1d82017-10-27 11:30:49 -0400665 SkSurfaceProps fSurfaceProps;
Greg Danielf41b2bd2019-08-22 16:19:24 -0400666 bool fManagedOpsTask;
Robert Phillipse305cc1f2016-12-14 12:19:05 -0500667
Chris Daltoneffee202019-07-01 22:28:03 -0600668 int fNumStencilSamples = 0;
Chris Dalton6b982802019-06-27 13:53:46 -0600669#if GR_TEST_UTILS
670 bool fPreserveOpsOnFullClear_TestingOnly = false;
671#endif
672
Robert Phillipse305cc1f2016-12-14 12:19:05 -0500673 typedef GrSurfaceContext INHERITED;
robertphillipsea461502015-05-26 11:38:03 -0700674};
675
676#endif