Brian Osman | 45580d3 | 2016-11-23 09:37:01 -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 | |
| 8 | #ifndef GrSurfaceContext_DEFINED |
| 9 | #define GrSurfaceContext_DEFINED |
| 10 | |
Brian Salomon | e9ad998 | 2019-07-22 16:17:41 -0400 | [diff] [blame] | 11 | #include "include/core/SkFilterQuality.h" |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 12 | #include "include/core/SkImage.h" |
Brian Salomon | e9ad998 | 2019-07-22 16:17:41 -0400 | [diff] [blame] | 13 | #include "include/core/SkRect.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "include/core/SkRefCnt.h" |
Brian Salomon | e9ad998 | 2019-07-22 16:17:41 -0400 | [diff] [blame] | 15 | #include "include/core/SkSurface.h" |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 16 | #include "src/gpu/GrClientMappedBufferManager.h" |
Brian Salomon | 4bc0c1f | 2019-09-30 15:12:27 -0400 | [diff] [blame] | 17 | #include "src/gpu/GrColorInfo.h" |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 18 | #include "src/gpu/GrDataUtils.h" |
Brian Salomon | 6aa6505 | 2020-01-28 12:16:53 -0500 | [diff] [blame] | 19 | #include "src/gpu/GrImageInfo.h" |
Brian Salomon | dd4087d | 2020-12-23 20:36:44 -0500 | [diff] [blame^] | 20 | #include "src/gpu/GrPixmap.h" |
Greg Daniel | f91aeb2 | 2019-06-18 09:58:02 -0400 | [diff] [blame] | 21 | #include "src/gpu/GrSurfaceProxy.h" |
Greg Daniel | 901b98e | 2019-10-22 09:54:02 -0400 | [diff] [blame] | 22 | #include "src/gpu/GrSurfaceProxyView.h" |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 23 | |
| 24 | class GrAuditTrail; |
Robert Phillips | 7215283 | 2017-01-25 17:31:35 -0500 | [diff] [blame] | 25 | class GrDrawingManager; |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 26 | class GrRecordingContext; |
Robert Phillips | 2734136 | 2016-12-14 08:46:47 -0500 | [diff] [blame] | 27 | class GrRenderTargetProxy; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 28 | class GrSingleOwner; |
| 29 | class GrSurface; |
Brian Salomon | 590f567 | 2020-12-16 11:44:47 -0500 | [diff] [blame] | 30 | class GrSurfaceDrawContext; |
| 31 | class GrSurfaceFillContext; |
Robert Phillips | 2734136 | 2016-12-14 08:46:47 -0500 | [diff] [blame] | 32 | class GrSurfaceProxy; |
| 33 | class GrTextureProxy; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 34 | struct SkIPoint; |
| 35 | struct SkIRect; |
| 36 | |
| 37 | /** |
| 38 | * A helper object to orchestrate commands for a particular surface |
| 39 | */ |
Brian Salomon | 57f211b | 2019-08-21 15:21:09 -0400 | [diff] [blame] | 40 | class GrSurfaceContext { |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 41 | public: |
Brian Salomon | eebe735 | 2020-12-09 16:37:04 -0500 | [diff] [blame] | 42 | // If the passed in GrSurfaceProxy is renderable this will return a GrSurfaceDrawContext, |
Greg Daniel | bfa19c4 | 2019-12-19 16:41:40 -0500 | [diff] [blame] | 43 | // otherwise it will return a GrSurfaceContext. |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 44 | static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*, |
| 45 | GrSurfaceProxyView readView, |
Brian Salomon | 14f99fc | 2020-12-07 12:19:47 -0500 | [diff] [blame] | 46 | const GrColorInfo&); |
Greg Daniel | bfa19c4 | 2019-12-19 16:41:40 -0500 | [diff] [blame] | 47 | |
Brian Salomon | 590f567 | 2020-12-16 11:44:47 -0500 | [diff] [blame] | 48 | // Makes either a GrSurfaceContext, GrFillDrawContext, or a GrSurfaceDrawContext, depending on |
| 49 | // GrRenderable and the GrImageInfo. |
Brian Salomon | 14f99fc | 2020-12-07 12:19:47 -0500 | [diff] [blame] | 50 | static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*, |
| 51 | const GrImageInfo&, |
| 52 | const GrBackendFormat&, |
| 53 | SkBackingFit = SkBackingFit::kExact, |
| 54 | GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin, |
| 55 | GrRenderable = GrRenderable::kNo, |
| 56 | int renderTargetSampleCnt = 1, |
| 57 | GrMipmapped = GrMipmapped::kNo, |
| 58 | GrProtected = GrProtected::kNo, |
| 59 | SkBudgeted = SkBudgeted::kYes); |
| 60 | |
Brian Salomon | 590f567 | 2020-12-16 11:44:47 -0500 | [diff] [blame] | 61 | // Same as the above but chooses the texture format using the default format for the color type. |
Brian Salomon | 14f99fc | 2020-12-07 12:19:47 -0500 | [diff] [blame] | 62 | static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*, |
| 63 | const GrImageInfo&, |
| 64 | SkBackingFit = SkBackingFit::kExact, |
| 65 | GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin, |
| 66 | GrRenderable = GrRenderable::kNo, |
| 67 | int renderTargetSampleCnt = 1, |
| 68 | GrMipmapped = GrMipmapped::kNo, |
| 69 | GrProtected = GrProtected::kNo, |
| 70 | SkBudgeted = SkBudgeted::kYes); |
Greg Daniel | bfa19c4 | 2019-12-19 16:41:40 -0500 | [diff] [blame] | 71 | |
| 72 | // If it is known that the GrSurfaceProxy is not renderable, you can directly call the the ctor |
| 73 | // here to make a GrSurfaceContext on the stack. |
Brian Salomon | 14f99fc | 2020-12-07 12:19:47 -0500 | [diff] [blame] | 74 | GrSurfaceContext(GrRecordingContext*, GrSurfaceProxyView readView, const GrColorInfo&); |
Greg Daniel | bfa19c4 | 2019-12-19 16:41:40 -0500 | [diff] [blame] | 75 | |
Brian Salomon | bf6b979 | 2019-08-21 09:38:10 -0400 | [diff] [blame] | 76 | virtual ~GrSurfaceContext() = default; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 77 | |
Brian Salomon | 70fe17e | 2020-11-30 14:33:58 -0500 | [diff] [blame] | 78 | GrRecordingContext* recordingContext() { return fContext; } |
| 79 | |
Brian Salomon | 4bc0c1f | 2019-09-30 15:12:27 -0400 | [diff] [blame] | 80 | const GrColorInfo& colorInfo() const { return fColorInfo; } |
Brian Salomon | 6aa6505 | 2020-01-28 12:16:53 -0500 | [diff] [blame] | 81 | GrImageInfo imageInfo() const { return {fColorInfo, fReadView.proxy()->dimensions()}; } |
| 82 | |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 83 | GrSurfaceOrigin origin() const { return fReadView.origin(); } |
| 84 | GrSwizzle readSwizzle() const { return fReadView.swizzle(); } |
| 85 | // TODO: See if it makes sense for this to return a const& instead and require the callers to |
| 86 | // make a copy (which refs the proxy) if needed. |
| 87 | GrSurfaceProxyView readSurfaceView() { return fReadView; } |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 88 | |
Brian Salomon | c524378 | 2020-04-02 12:50:34 -0400 | [diff] [blame] | 89 | SkISize dimensions() const { return fReadView.dimensions(); } |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 90 | int width() const { return fReadView.proxy()->width(); } |
| 91 | int height() const { return fReadView.proxy()->height(); } |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 92 | |
Brian Salomon | 4d2d6f4 | 2019-07-26 14:15:11 -0400 | [diff] [blame] | 93 | const GrCaps* caps() const; |
| 94 | |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 95 | /** |
Brian Salomon | dd4087d | 2020-12-23 20:36:44 -0500 | [diff] [blame^] | 96 | * Reads a rectangle of pixels from the surface context. |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 97 | * @param dContext The direct context to use |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 98 | * @param dst destination pixels for the read |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 99 | * @param srcPt offset w/in the surface context from which to read |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 100 | * is a GrDirectContext and fail otherwise. |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 101 | */ |
Brian Salomon | dd4087d | 2020-12-23 20:36:44 -0500 | [diff] [blame^] | 102 | bool readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoint srcPt); |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 103 | |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 104 | using ReadPixelsCallback = SkImage::ReadPixelsCallback; |
| 105 | using ReadPixelsContext = SkImage::ReadPixelsContext; |
| 106 | using RescaleGamma = SkImage::RescaleGamma; |
| 107 | |
| 108 | // GPU implementation for SkImage:: and SkSurface::asyncRescaleAndReadPixels. |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 109 | void asyncRescaleAndReadPixels(GrDirectContext*, |
| 110 | const SkImageInfo& info, |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 111 | const SkIRect& srcRect, |
| 112 | RescaleGamma rescaleGamma, |
| 113 | SkFilterQuality rescaleQuality, |
| 114 | ReadPixelsCallback callback, |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 115 | ReadPixelsContext callbackContext); |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 116 | |
| 117 | // GPU implementation for SkImage:: and SkSurface::asyncRescaleAndReadPixelsYUV420. |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 118 | void asyncRescaleAndReadPixelsYUV420(GrDirectContext*, |
| 119 | SkYUVColorSpace yuvColorSpace, |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 120 | sk_sp<SkColorSpace> dstColorSpace, |
| 121 | const SkIRect& srcRect, |
| 122 | SkISize dstSize, |
| 123 | RescaleGamma rescaleGamma, |
| 124 | SkFilterQuality rescaleQuality, |
| 125 | ReadPixelsCallback callback, |
| 126 | ReadPixelsContext context); |
| 127 | |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 128 | /** |
Robert Phillips | b726d58 | 2017-03-09 16:36:32 -0500 | [diff] [blame] | 129 | * Writes a rectangle of pixels [srcInfo, srcBuffer, srcRowbytes] into the |
Brian Salomon | 1aa1f5f | 2020-12-11 17:25:17 -0500 | [diff] [blame] | 130 | * surfaceDrawContext at the specified position. |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 131 | * @param dContext The direct context to use |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 132 | * @param src source for the write |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 133 | * @param dstPt offset w/in the surface context at which to write |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 134 | */ |
Brian Salomon | dd4087d | 2020-12-23 20:36:44 -0500 | [diff] [blame^] | 135 | bool writePixels(GrDirectContext* dContext, GrPixmap src, SkIPoint dstPt); |
Greg Daniel | 6eb8c24 | 2019-06-05 10:22:24 -0400 | [diff] [blame] | 136 | |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 137 | GrSurfaceProxy* asSurfaceProxy() { return fReadView.proxy(); } |
| 138 | const GrSurfaceProxy* asSurfaceProxy() const { return fReadView.proxy(); } |
Greg Daniel | c61d7e3 | 2020-02-04 14:27:45 -0500 | [diff] [blame] | 139 | sk_sp<GrSurfaceProxy> asSurfaceProxyRef() { return fReadView.refProxy(); } |
Robert Phillips | f200a90 | 2017-01-30 13:27:37 -0500 | [diff] [blame] | 140 | |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 141 | GrTextureProxy* asTextureProxy() { return fReadView.asTextureProxy(); } |
| 142 | const GrTextureProxy* asTextureProxy() const { return fReadView.asTextureProxy(); } |
| 143 | sk_sp<GrTextureProxy> asTextureProxyRef() { return fReadView.asTextureProxyRef(); } |
Robert Phillips | f200a90 | 2017-01-30 13:27:37 -0500 | [diff] [blame] | 144 | |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 145 | GrRenderTargetProxy* asRenderTargetProxy() { return fReadView.asRenderTargetProxy(); } |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 146 | const GrRenderTargetProxy* asRenderTargetProxy() const { |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 147 | return fReadView.asRenderTargetProxy(); |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 148 | } |
| 149 | sk_sp<GrRenderTargetProxy> asRenderTargetProxyRef() { |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 150 | return fReadView.asRenderTargetProxyRef(); |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 151 | } |
Robert Phillips | 2734136 | 2016-12-14 08:46:47 -0500 | [diff] [blame] | 152 | |
Brian Salomon | eebe735 | 2020-12-09 16:37:04 -0500 | [diff] [blame] | 153 | virtual GrSurfaceDrawContext* asRenderTargetContext() { return nullptr; } |
Brian Salomon | 590f567 | 2020-12-16 11:44:47 -0500 | [diff] [blame] | 154 | virtual GrSurfaceFillContext* asFillContext() { return nullptr; } |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 155 | |
Brian Salomon | 11ad4cc | 2020-05-15 12:07:59 -0400 | [diff] [blame] | 156 | /** |
| 157 | * Rescales the contents of srcRect. The gamma in which the rescaling occurs is controlled by |
| 158 | * RescaleGamma. It is always in the original gamut. The result is converted to the color type |
| 159 | * and color space of info after rescaling. Note: this currently requires that the info have a |
| 160 | * different size than srcRect. Though, it could be relaxed to allow non-scaling color |
| 161 | * conversions. |
| 162 | */ |
Brian Salomon | eebe735 | 2020-12-09 16:37:04 -0500 | [diff] [blame] | 163 | std::unique_ptr<GrSurfaceDrawContext> rescale(const GrImageInfo& info, |
| 164 | GrSurfaceOrigin, |
| 165 | SkIRect srcRect, |
| 166 | SkImage::RescaleGamma, |
| 167 | SkFilterQuality); |
Brian Salomon | 11ad4cc | 2020-05-15 12:07:59 -0400 | [diff] [blame] | 168 | |
Brian Salomon | 1c86b63 | 2020-12-11 12:36:01 -0500 | [diff] [blame] | 169 | /** |
Brian Salomon | dd4087d | 2020-12-23 20:36:44 -0500 | [diff] [blame^] | 170 | * Like the above but allows the caller ot specify a destination draw context and |
Brian Salomon | 1c86b63 | 2020-12-11 12:36:01 -0500 | [diff] [blame] | 171 | * rect within that context. The dst rect must be contained by the dst or this will fail. |
| 172 | */ |
| 173 | bool rescaleInto(GrSurfaceDrawContext* dst, |
| 174 | SkIRect dstRect, |
| 175 | SkIRect srcRect, |
| 176 | SkImage::RescaleGamma, |
| 177 | SkFilterQuality); |
| 178 | |
Robert Phillips | 0d075de | 2019-03-04 11:08:13 -0500 | [diff] [blame] | 179 | GrAuditTrail* auditTrail(); |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 180 | |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 181 | #if GR_TEST_UTILS |
Brian Salomon | c524378 | 2020-04-02 12:50:34 -0400 | [diff] [blame] | 182 | bool testCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) { |
| 183 | return this->copy(src, srcRect, dstPoint); |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 184 | } |
| 185 | |
Brian Salomon | c524378 | 2020-04-02 12:50:34 -0400 | [diff] [blame] | 186 | bool testCopy(GrSurfaceProxy* src) { |
| 187 | return this->copy(src, SkIRect::MakeSize(src->dimensions()), {0, 0}); |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 188 | } |
| 189 | #endif |
| 190 | |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 191 | protected: |
Robert Phillips | 0d075de | 2019-03-04 11:08:13 -0500 | [diff] [blame] | 192 | GrDrawingManager* drawingManager(); |
| 193 | const GrDrawingManager* drawingManager() const; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 194 | |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 195 | SkDEBUGCODE(void validate() const;) |
Robert Phillips | 2de8cfa | 2017-06-28 10:33:41 -0400 | [diff] [blame] | 196 | |
Brian Salomon | 70fe17e | 2020-11-30 14:33:58 -0500 | [diff] [blame] | 197 | SkDEBUGCODE(GrSingleOwner* singleOwner() const;) |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 198 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 199 | GrRecordingContext* fContext; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 200 | |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 201 | GrSurfaceProxyView fReadView; |
Greg Daniel | 901b98e | 2019-10-22 09:54:02 -0400 | [diff] [blame] | 202 | |
Brian Salomon | 4d2d6f4 | 2019-07-26 14:15:11 -0400 | [diff] [blame] | 203 | // Inserts a transfer, part of the implementation of asyncReadPixels and |
| 204 | // asyncRescaleAndReadPixelsYUV420(). |
| 205 | struct PixelTransferResult { |
| 206 | using ConversionFn = void(void* dst, const void* mappedBuffer); |
| 207 | // If null then the transfer could not be performed. Otherwise this buffer will contain |
| 208 | // the pixel data when the transfer is complete. |
| 209 | sk_sp<GrGpuBuffer> fTransferBuffer; |
| 210 | // If this is null then the transfer buffer will contain the data in the requested |
| 211 | // color type. Otherwise, when the transfer is done this must be called to convert |
| 212 | // from the transfer buffer's color type to the requested color type. |
| 213 | std::function<ConversionFn> fPixelConverter; |
| 214 | }; |
| 215 | PixelTransferResult transferPixels(GrColorType colorType, const SkIRect& rect); |
| 216 | |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 217 | // The async read step of asyncRescaleAndReadPixels() |
Adlai Holler | c95b589 | 2020-08-11 12:02:22 -0400 | [diff] [blame] | 218 | void asyncReadPixels(GrDirectContext*, |
| 219 | const SkIRect& srcRect, |
| 220 | SkColorType, |
| 221 | ReadPixelsCallback, |
| 222 | ReadPixelsContext); |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 223 | |
Robert Phillips | e305cc1f | 2016-12-14 12:19:05 -0500 | [diff] [blame] | 224 | private: |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 225 | friend class GrSurfaceProxy; // for copy |
| 226 | |
Greg Daniel | 46e366a | 2019-12-16 14:38:36 -0500 | [diff] [blame] | 227 | SkDEBUGCODE(virtual void onValidate() const {}) |
| 228 | |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 229 | /** |
| 230 | * Copy 'src' into the proxy backing this context. This call will not do any draw fallback. |
| 231 | * Currently only writePixels and replaceRenderTarget call this directly. All other copies |
| 232 | * should go through GrSurfaceProxy::Copy. |
| 233 | * @param src src of pixels |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 234 | * @param dstPoint the origin of the 'srcRect' in the destination coordinate space |
| 235 | * @return true if the copy succeeded; false otherwise |
| 236 | * |
| 237 | * Note: Notionally, 'srcRect' is clipped to 'src's extent with 'dstPoint' being adjusted. |
| 238 | * Then the 'srcRect' offset by 'dstPoint' is clipped against the dst's extent. |
| 239 | * The end result is only valid src pixels and dst pixels will be touched but the copied |
| 240 | * regions will not be shifted. The 'src' must have the same origin as the backing proxy |
| 241 | * of fSurfaceContext. |
| 242 | */ |
Brian Salomon | c524378 | 2020-04-02 12:50:34 -0400 | [diff] [blame] | 243 | bool copy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint); |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 244 | |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 245 | class AsyncReadResult; |
| 246 | |
Brian Salomon | 4bc0c1f | 2019-09-30 15:12:27 -0400 | [diff] [blame] | 247 | GrColorInfo fColorInfo; |
Brian Salomon | f3569f0 | 2017-10-24 12:52:33 -0400 | [diff] [blame] | 248 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 249 | using INHERITED = SkRefCnt; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 250 | }; |
| 251 | |
| 252 | #endif |