Don't flush on read/write pixels unless necessary
BUG=skia:2889
Committed: https://skia.googlesource.com/skia/+/150723b9298772a5096bec7acd2999c5c9d66239
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/586073002
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 52ab4fd..d15cbdf 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -44,3 +44,39 @@
return true;
}
+
+bool GrSurface::hasPendingRead() const {
+ const GrTexture* thisTex = this->asTexture();
+ if (thisTex && thisTex->internalHasPendingRead()) {
+ return true;
+ }
+ const GrRenderTarget* thisRT = this->asRenderTarget();
+ if (thisRT && thisRT->internalHasPendingRead()) {
+ return true;
+ }
+ return false;
+}
+
+bool GrSurface::hasPendingWrite() const {
+ const GrTexture* thisTex = this->asTexture();
+ if (thisTex && thisTex->internalHasPendingWrite()) {
+ return true;
+ }
+ const GrRenderTarget* thisRT = this->asRenderTarget();
+ if (thisRT && thisRT->internalHasPendingWrite()) {
+ return true;
+ }
+ return false;
+}
+
+bool GrSurface::hasPendingIO() const {
+ const GrTexture* thisTex = this->asTexture();
+ if (thisTex && thisTex->internalHasPendingIO()) {
+ return true;
+ }
+ const GrRenderTarget* thisRT = this->asRenderTarget();
+ if (thisRT && thisRT->internalHasPendingIO()) {
+ return true;
+ }
+ return false;
+}