robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 8 | #ifndef GrDrawContext_DEFINED |
| 9 | #define GrDrawContext_DEFINED |
| 10 | |
| 11 | #include "GrColor.h" |
robertphillips | 7bceedc | 2015-12-01 12:51:26 -0800 | [diff] [blame] | 12 | #include "GrRenderTarget.h" |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 13 | #include "SkRefCnt.h" |
robertphillips | 391395d | 2016-03-02 09:26:36 -0800 | [diff] [blame] | 14 | #include "SkRegion.h" |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 15 | #include "SkSurfaceProps.h" |
joshualitt | 1de610a | 2016-01-06 08:26:09 -0800 | [diff] [blame] | 16 | #include "../private/GrSingleOwner.h" |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 17 | |
joshualitt | 8e84a1e | 2016-02-16 11:09:25 -0800 | [diff] [blame] | 18 | class GrAtlasTextContext; |
joshualitt | bc90735 | 2016-01-13 06:45:40 -0800 | [diff] [blame] | 19 | class GrAuditTrail; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 20 | class GrClip; |
| 21 | class GrContext; |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 22 | class GrDrawBatch; |
robertphillips | 391395d | 2016-03-02 09:26:36 -0800 | [diff] [blame] | 23 | class GrDrawContextPriv; |
cdalton | 8ff8d24 | 2015-12-08 10:20:32 -0800 | [diff] [blame] | 24 | class GrDrawPathBatchBase; |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 25 | class GrDrawingManager; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 26 | class GrDrawTarget; |
| 27 | class GrPaint; |
| 28 | class GrPathProcessor; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 29 | class GrPipelineBuilder; |
| 30 | class GrRenderTarget; |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 31 | class GrStyle; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 32 | class GrSurface; |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 33 | class SkDrawFilter; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 34 | struct SkIPoint; |
| 35 | struct SkIRect; |
| 36 | class SkMatrix; |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 37 | class SkPaint; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 38 | class SkPath; |
| 39 | struct SkPoint; |
| 40 | struct SkRect; |
| 41 | class SkRRect; |
jvanverth | 31ff762 | 2015-08-07 10:09:28 -0700 | [diff] [blame] | 42 | struct SkRSXform; |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 43 | class SkTextBlob; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * A helper object to orchestrate draws |
| 47 | */ |
| 48 | class SK_API GrDrawContext : public SkRefCnt { |
| 49 | public: |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 50 | ~GrDrawContext() override; |
| 51 | |
bsalomon | b8fea97 | 2016-02-16 07:34:17 -0800 | [diff] [blame] | 52 | bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 53 | |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 54 | // TODO: it is odd that we need both the SkPaint in the following 3 methods. |
| 55 | // We should extract the text parameters from SkPaint and pass them separately |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 56 | // akin to GrStyle (GrTextInfo?) |
joshualitt | 96880d9 | 2016-02-16 10:36:53 -0800 | [diff] [blame] | 57 | virtual void drawText(const GrClip&, const GrPaint&, const SkPaint&, |
| 58 | const SkMatrix& viewMatrix, const char text[], size_t byteLength, |
| 59 | SkScalar x, SkScalar y, const SkIRect& clipBounds); |
| 60 | virtual void drawPosText(const GrClip&, const GrPaint&, const SkPaint&, |
| 61 | const SkMatrix& viewMatrix, const char text[], size_t byteLength, |
| 62 | const SkScalar pos[], int scalarsPerPosition, |
| 63 | const SkPoint& offset, const SkIRect& clipBounds); |
| 64 | virtual void drawTextBlob(const GrClip&, const SkPaint&, |
| 65 | const SkMatrix& viewMatrix, const SkTextBlob*, |
| 66 | SkScalar x, SkScalar y, |
| 67 | SkDrawFilter*, const SkIRect& clipBounds); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 68 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 69 | /** |
| 70 | * Provides a perfomance hint that the render target's contents are allowed |
| 71 | * to become undefined. |
| 72 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 73 | void discard(); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Clear the entire or rect of the render target, ignoring any clips. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 77 | * @param rect the rect to clear or the whole thing if rect is NULL. |
| 78 | * @param color the color to clear to. |
| 79 | * @param canIgnoreRect allows partial clears to be converted to whole |
| 80 | * clears on platforms for which that is cheap |
| 81 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 82 | void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * Draw everywhere (respecting the clip) with the paint. |
| 86 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 87 | void drawPaint(const GrClip&, const GrPaint&, const SkMatrix& viewMatrix); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Draw the rect using a paint. |
| 91 | * @param paint describes how to color pixels. |
| 92 | * @param viewMatrix transformation matrix |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 93 | * @param style The style to apply. Null means fill. Currently path effects are not |
| 94 | * allowed. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 95 | * The rects coords are used to access the paint (through texture matrix) |
| 96 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 97 | void drawRect(const GrClip&, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 98 | const GrPaint& paint, |
| 99 | const SkMatrix& viewMatrix, |
| 100 | const SkRect&, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 101 | const GrStyle* style = nullptr); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 102 | |
| 103 | /** |
bsalomon | a2e69fc | 2015-11-05 10:41:43 -0800 | [diff] [blame] | 104 | * Maps a rectangle of shader coordinates to a rectangle and fills that rectangle. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 105 | * |
| 106 | * @param paint describes how to color pixels. |
| 107 | * @param viewMatrix transformation matrix which applies to rectToDraw |
| 108 | * @param rectToDraw the rectangle to draw |
| 109 | * @param localRect the rectangle of shader coordinates applied to rectToDraw |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 110 | */ |
bsalomon | a2e69fc | 2015-11-05 10:41:43 -0800 | [diff] [blame] | 111 | void fillRectToRect(const GrClip&, |
| 112 | const GrPaint& paint, |
| 113 | const SkMatrix& viewMatrix, |
| 114 | const SkRect& rectToDraw, |
| 115 | const SkRect& localRect); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 116 | |
| 117 | /** |
bsalomon | a2e69fc | 2015-11-05 10:41:43 -0800 | [diff] [blame] | 118 | * Fills a rect with a paint and a localMatrix. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 119 | */ |
bsalomon | a2e69fc | 2015-11-05 10:41:43 -0800 | [diff] [blame] | 120 | void fillRectWithLocalMatrix(const GrClip& clip, |
| 121 | const GrPaint& paint, |
| 122 | const SkMatrix& viewMatrix, |
| 123 | const SkRect& rect, |
| 124 | const SkMatrix& localMatrix); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * Draw a roundrect using a paint. |
| 128 | * |
| 129 | * @param paint describes how to color pixels. |
| 130 | * @param viewMatrix transformation matrix |
| 131 | * @param rrect the roundrect to draw |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 132 | * @param style style to apply to the rrect. Currently path effects are not allowed. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 133 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 134 | void drawRRect(const GrClip&, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 135 | const GrPaint&, |
| 136 | const SkMatrix& viewMatrix, |
| 137 | const SkRRect& rrect, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 138 | const GrStyle& style); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 139 | |
| 140 | /** |
robertphillips | 0009589 | 2016-02-29 13:50:40 -0800 | [diff] [blame] | 141 | * Shortcut for drawing an SkPath consisting of nested rrects using a paint. |
| 142 | * Does not support stroking. The result is undefined if outer does not contain |
| 143 | * inner. |
| 144 | * |
| 145 | * @param paint describes how to color pixels. |
| 146 | * @param viewMatrix transformation matrix |
| 147 | * @param outer the outer roundrect |
| 148 | * @param inner the inner roundrect |
| 149 | */ |
| 150 | void drawDRRect(const GrClip&, |
| 151 | const GrPaint&, |
| 152 | const SkMatrix& viewMatrix, |
| 153 | const SkRRect& outer, |
| 154 | const SkRRect& inner); |
| 155 | |
| 156 | /** |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 157 | * Draws a path. |
| 158 | * |
| 159 | * @param paint describes how to color pixels. |
| 160 | * @param viewMatrix transformation matrix |
| 161 | * @param path the path to draw |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 162 | * @param style style to apply to the path. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 163 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 164 | void drawPath(const GrClip&, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 165 | const GrPaint&, |
| 166 | const SkMatrix& viewMatrix, |
| 167 | const SkPath&, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 168 | const GrStyle& style); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 169 | |
| 170 | /** |
| 171 | * Draws vertices with a paint. |
| 172 | * |
| 173 | * @param paint describes how to color pixels. |
| 174 | * @param viewMatrix transformation matrix |
| 175 | * @param primitiveType primitives type to draw. |
| 176 | * @param vertexCount number of vertices. |
| 177 | * @param positions array of vertex positions, required. |
| 178 | * @param texCoords optional array of texture coordinates used |
| 179 | * to access the paint. |
| 180 | * @param colors optional array of per-vertex colors, supercedes |
| 181 | * the paint's color field. |
| 182 | * @param indices optional array of indices. If NULL vertices |
| 183 | * are drawn non-indexed. |
| 184 | * @param indexCount if indices is non-null then this is the |
| 185 | * number of indices. |
| 186 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 187 | void drawVertices(const GrClip&, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 188 | const GrPaint& paint, |
| 189 | const SkMatrix& viewMatrix, |
| 190 | GrPrimitiveType primitiveType, |
| 191 | int vertexCount, |
| 192 | const SkPoint positions[], |
| 193 | const SkPoint texs[], |
| 194 | const GrColor colors[], |
| 195 | const uint16_t indices[], |
| 196 | int indexCount); |
| 197 | |
| 198 | /** |
jvanverth | 31ff762 | 2015-08-07 10:09:28 -0700 | [diff] [blame] | 199 | * Draws textured sprites from an atlas with a paint. |
| 200 | * |
| 201 | * @param paint describes how to color pixels. |
| 202 | * @param viewMatrix transformation matrix |
| 203 | * @param spriteCount number of sprites. |
| 204 | * @param xform array of compressed transformation data, required. |
| 205 | * @param texRect array of texture rectangles used to access the paint. |
| 206 | * @param colors optional array of per-sprite colors, supercedes |
| 207 | * the paint's color field. |
| 208 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 209 | void drawAtlas(const GrClip&, |
jvanverth | 31ff762 | 2015-08-07 10:09:28 -0700 | [diff] [blame] | 210 | const GrPaint& paint, |
| 211 | const SkMatrix& viewMatrix, |
| 212 | int spriteCount, |
| 213 | const SkRSXform xform[], |
| 214 | const SkRect texRect[], |
| 215 | const SkColor colors[]); |
| 216 | |
| 217 | /** |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 218 | * Draws an oval. |
| 219 | * |
| 220 | * @param paint describes how to color pixels. |
| 221 | * @param viewMatrix transformation matrix |
| 222 | * @param oval the bounding rect of the oval. |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 223 | * @param style style to apply to the oval. Currently path effects are not allowed. |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 224 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 225 | void drawOval(const GrClip&, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 226 | const GrPaint& paint, |
| 227 | const SkMatrix& viewMatrix, |
| 228 | const SkRect& oval, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 229 | const GrStyle& style); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 230 | |
joshualitt | 33a5fce | 2015-11-18 13:28:51 -0800 | [diff] [blame] | 231 | /** |
| 232 | * Draw the image stretched differentially to fit into dst. |
| 233 | * center is a rect within the image, and logically divides the image |
| 234 | * into 9 sections (3x3). For example, if the middle pixel of a [5x5] |
| 235 | * image is the "center", then the center-rect should be [2, 2, 3, 3]. |
| 236 | * |
| 237 | * If the dst is >= the image size, then... |
| 238 | * - The 4 corners are not stretched at all. |
| 239 | * - The sides are stretched in only one axis. |
| 240 | * - The center is stretched in both axes. |
| 241 | * Else, for each axis where dst < image, |
| 242 | * - The corners shrink proportionally |
| 243 | * - The sides (along the shrink axis) and center are not drawn |
| 244 | */ |
| 245 | void drawImageNine(const GrClip&, |
| 246 | const GrPaint& paint, |
| 247 | const SkMatrix& viewMatrix, |
| 248 | int imageWidth, |
| 249 | int imageHeight, |
| 250 | const SkIRect& center, |
| 251 | const SkRect& dst); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 252 | |
joshualitt | b7ee1bf | 2015-08-10 11:59:02 -0700 | [diff] [blame] | 253 | /** |
| 254 | * Draws a batch |
| 255 | * |
| 256 | * @param paint describes how to color pixels. |
| 257 | * @param batch the batch to draw |
| 258 | */ |
robertphillips | 2e1e51f | 2015-10-15 08:01:48 -0700 | [diff] [blame] | 259 | void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); |
joshualitt | b7ee1bf | 2015-08-10 11:59:02 -0700 | [diff] [blame] | 260 | |
robertphillips | 7bceedc | 2015-12-01 12:51:26 -0800 | [diff] [blame] | 261 | int width() const { return fRenderTarget->width(); } |
| 262 | int height() const { return fRenderTarget->height(); } |
| 263 | int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
brianosman | b461d34 | 2016-04-13 13:10:14 -0700 | [diff] [blame] | 264 | bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
robertphillips | 7bceedc | 2015-12-01 12:51:26 -0800 | [diff] [blame] | 265 | |
robertphillips | 6c7e325 | 2016-04-27 10:47:51 -0700 | [diff] [blame] | 266 | GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } |
| 267 | |
| 268 | sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } |
| 269 | |
| 270 | sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); } |
robertphillips | 433625e | 2015-12-04 06:58:16 -0800 | [diff] [blame] | 271 | |
robertphillips | 391395d | 2016-03-02 09:26:36 -0800 | [diff] [blame] | 272 | // Provides access to functions that aren't part of the public API. |
| 273 | GrDrawContextPriv drawContextPriv(); |
| 274 | const GrDrawContextPriv drawContextPriv() const; |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 275 | |
joshualitt | 96880d9 | 2016-02-16 10:36:53 -0800 | [diff] [blame] | 276 | protected: |
robertphillips | 6c7e325 | 2016-04-27 10:47:51 -0700 | [diff] [blame] | 277 | GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, |
joshualitt | 96880d9 | 2016-02-16 10:36:53 -0800 | [diff] [blame] | 278 | const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*); |
| 279 | |
| 280 | GrDrawingManager* drawingManager() { return fDrawingManager; } |
| 281 | GrAuditTrail* auditTrail() { return fAuditTrail; } |
| 282 | const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
| 283 | |
| 284 | SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
| 285 | SkDEBUGCODE(void validate() const;) |
| 286 | |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 287 | private: |
joshualitt | 2e2202e | 2015-12-10 11:22:08 -0800 | [diff] [blame] | 288 | friend class GrAtlasTextBlob; // for access to drawBatch |
cdalton | 193d9cf | 2016-05-12 11:52:02 -0700 | [diff] [blame^] | 289 | friend class GrStencilAndCoverTextContext; // for access to drawBatch |
robertphillips | 77a2e52 | 2015-10-17 07:43:27 -0700 | [diff] [blame] | 290 | friend class GrDrawingManager; // for ctor |
robertphillips | 391395d | 2016-03-02 09:26:36 -0800 | [diff] [blame] | 291 | friend class GrDrawContextPriv; |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 292 | |
robertphillips | 0009589 | 2016-02-29 13:50:40 -0800 | [diff] [blame] | 293 | bool drawFilledDRRect(const GrClip& clip, |
| 294 | const GrPaint& paint, |
| 295 | const SkMatrix& viewMatrix, |
| 296 | const SkRRect& origOuter, |
| 297 | const SkRRect& origInner); |
| 298 | |
robertphillips | 391395d | 2016-03-02 09:26:36 -0800 | [diff] [blame] | 299 | GrDrawBatch* getFillRectBatch(const GrPaint& paint, |
| 300 | const SkMatrix& viewMatrix, |
| 301 | const SkRect& rect); |
| 302 | |
robertphillips | 4bc3181 | 2016-03-01 12:22:49 -0800 | [diff] [blame] | 303 | void internalDrawPath(const GrClip& clip, |
| 304 | const GrPaint& paint, |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 305 | const SkMatrix& viewMatrix, |
robertphillips | 4bc3181 | 2016-03-01 12:22:49 -0800 | [diff] [blame] | 306 | const SkPath& path, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 307 | const GrStyle& style); |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 308 | |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 309 | // This entry point allows the GrTextContext-derived classes to add their batches to |
| 310 | // the drawTarget. |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 311 | void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 312 | |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 313 | GrDrawTarget* getDrawTarget(); |
| 314 | |
joshualitt | 8db8678 | 2016-02-17 05:40:00 -0800 | [diff] [blame] | 315 | GrDrawingManager* fDrawingManager; |
robertphillips | 6c7e325 | 2016-04-27 10:47:51 -0700 | [diff] [blame] | 316 | sk_sp<GrRenderTarget> fRenderTarget; |
robertphillips | a106c62 | 2015-10-16 09:07:06 -0700 | [diff] [blame] | 317 | |
| 318 | // In MDB-mode the drawTarget can be closed by some other drawContext that has picked |
| 319 | // it up. For this reason, the drawTarget should only ever be accessed via 'getDrawTarget'. |
joshualitt | 8db8678 | 2016-02-17 05:40:00 -0800 | [diff] [blame] | 320 | GrDrawTarget* fDrawTarget; |
| 321 | SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; |
| 322 | GrContext* fContext; |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 323 | |
joshualitt | 8db8678 | 2016-02-17 05:40:00 -0800 | [diff] [blame] | 324 | SkSurfaceProps fSurfaceProps; |
| 325 | GrAuditTrail* fAuditTrail; |
joshualitt | 1de610a | 2016-01-06 08:26:09 -0800 | [diff] [blame] | 326 | |
| 327 | // In debug builds we guard against improper thread handling |
joshualitt | 6d0872d | 2016-01-11 08:27:48 -0800 | [diff] [blame] | 328 | SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
robertphillips | ea46150 | 2015-05-26 11:38:03 -0700 | [diff] [blame] | 329 | }; |
| 330 | |
| 331 | #endif |