diff options
author | 2016-08-31 14:54:15 -0700 | |
---|---|---|
committer | 2016-08-31 14:54:15 -0700 | |
commit | 1da3ecd07836a72c9225c896d2516625906b4bda (patch) | |
tree | 98e9aa5df3644d7ab383cd89b168a95650ea4719 /include/gpu/GrDrawContext.h | |
parent | 30b9fdd6a1d607bde20c793af65b5e2e8a1737ca (diff) |
Add read/write-Pixels to GrDrawContext
Although not absolutely required this does remove another case where the drawContext's backing store is accessed.
Broken out of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus))
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2298253002
Review-Url: https://codereview.chromium.org/2298253002
Diffstat (limited to 'include/gpu/GrDrawContext.h')
-rw-r--r-- | include/gpu/GrDrawContext.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index cfdb9104d8..f3af2eb27d 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -285,6 +285,34 @@ public: */ void prepareForExternalIO(); + /** + * Reads a rectangle of pixels from the draw context. + * @param dstInfo image info for the destination + * @param dstBuffer destination pixels for the read + * @param dstRowBytes bytes in a row of 'dstBuffer' + * @param x x offset w/in the draw context from which to read + * @param y y offset w/in the draw context from which to read + * + * @return true if the read succeeded, false if not. The read can fail because of an + * unsupported pixel config. + */ + bool readPixels(const SkImageInfo& dstInfo, void* dstBuffer, size_t dstRowBytes, int x, int y); + + /** + * Writes a rectangle of pixels [srcInfo, srcBuffer, srcRowbytes] into the + * drawContext at the specified position. + * @param srcInfo image info for the source pixels + * @param srcBuffer source for the write + * @param srcRowBytes bytes in a row of 'srcBuffer' + * @param x x offset w/in the draw context at which to write + * @param y y offset w/in the draw context at which to write + * + * @return true if the write succeeded, false if not. The write can fail because of an + * unsupported pixel config. + */ + bool writePixels(const SkImageInfo& srcInfo, const void* srcBuffer, size_t srcRowBytes, + int x, int y); + bool isStencilBufferMultisampled() const { return fRenderTarget->isStencilBufferMultisampled(); } |