diff options
author | 2016-02-11 11:42:31 -0800 | |
---|---|---|
committer | 2016-02-11 11:42:31 -0800 | |
commit | 7ea5e28065e5eb797e95f5d81c1a65cf3209d741 (patch) | |
tree | b239caa1224b79d021154265e44ebbc4a945b7d1 /include | |
parent | e1745a1efc02de4964a430cf9fd02d7652b3ed5e (diff) |
Make copySurface work for texture dsts, return a bool, & add unit test.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1684313002
Review URL: https://codereview.chromium.org/1684313002
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 15 | ||||
-rw-r--r-- | include/gpu/GrDrawContext.h | 2 |
2 files changed, 5 insertions, 12 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 00a92836c5..4245b7fa94 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -278,24 +278,17 @@ public: * @param src the surface to copy from. * @param srcRect the rectangle of the src that should be copied. * @param dstPoint the translation applied when writing the srcRect's pixels to the dst. - * @param pixelOpsFlags see PixelOpsFlags enum above. (kUnpremul_PixelOpsFlag is not allowed). */ - void copySurface(GrSurface* dst, + bool copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect, - const SkIPoint& dstPoint, - uint32_t pixelOpsFlags = 0); + const SkIPoint& dstPoint); /** Helper that copies the whole surface but fails when the two surfaces are not identically sized. */ bool copySurface(GrSurface* dst, GrSurface* src) { - if (NULL == dst || NULL == src || dst->width() != src->width() || - dst->height() != src->height()) { - return false; - } - this->copySurface(dst, src, SkIRect::MakeWH(dst->width(), dst->height()), - SkIPoint::Make(0,0)); - return true; + return this->copySurface(dst, src, SkIRect::MakeWH(dst->width(), dst->height()), + SkIPoint::Make(0,0)); } /** diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 24e38b8494..4c884154e3 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -47,7 +47,7 @@ class SK_API GrDrawContext : public SkRefCnt { public: ~GrDrawContext() override; - void copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint); + bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint); // TODO: it is odd that we need both the SkPaint in the following 3 methods. // We should extract the text parameters from SkPaint and pass them separately |