aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-22 08:17:02 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-22 08:17:02 -0700
commit150723b9298772a5096bec7acd2999c5c9d66239 (patch)
treee3df3dd490dc1fa001d5f6d3fbf887f2f9b4adf5 /include
parent4a8126e7f81384526629b1e21bf89b632ea13cd9 (diff)
Don't flush on read/write pixels unless necessary
BUG=skia:2889 R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/586073002
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrGpuResource.h5
-rw-r--r--include/gpu/GrSurface.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index f20bad3e9f..61849e7232 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -80,9 +80,14 @@ public:
#endif
}
+
protected:
GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {}
+ bool internalHasPendingRead() const { return SkToBool(fPendingReads); }
+ bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); }
+ bool internalHasPendingIO() const { return SkToBool(fPendingWrites | fPendingReads); }
+
private:
void addPendingRead() const {
this->validate();
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 8315c63fbf..24eb39a81b 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -135,6 +135,10 @@ public:
*/
bool savePixels(const char* filename);
+ bool hasPendingRead() const;
+ bool hasPendingWrite() const;
+ bool hasPendingIO() const;
+
protected:
GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
: INHERITED(gpu, isWrapped)