Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 197123003: Proposed SkCanvas API for preLoading textures to VRAM v2.0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: retry upload Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
===================================================================
--- src/gpu/SkGpuDevice.cpp (revision 13812)
+++ src/gpu/SkGpuDevice.cpp (working copy)
@@ -25,6 +25,7 @@
#include "SkImageFilter.h"
#include "SkMaskFilter.h"
#include "SkPathEffect.h"
+#include "SkPicture.h"
#include "SkRRect.h"
#include "SkStroke.h"
#include "SkSurface.h"
@@ -2003,3 +2004,44 @@
this->initFromRenderTarget(context, texture->asRenderTarget(), true);
fNeedClear = needClear;
}
+
+class GPUAccelData : public SkPicture::AccelData {
+public:
+ GPUAccelData(Key key) : INHERITED(key) { }
+
+protected:
+
+private:
+ typedef SkPicture::AccelData INHERITED;
+};
+
+// In the future this may not be a static method if we need to incorporate the
+// clip and matrix state into the key
+SkPicture::AccelData::Key SkGpuDevice::ComputeAccelDataKey() {
+ static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::GenerateDomain();
+
+ return gGPUID;
+}
+
+void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
+ SkPicture::AccelData::Key key = ComputeAccelDataKey();
+
+ GPUAccelData* data = SkNEW_ARGS(GPUAccelData, (key));
+
+ picture->EXPERIMENTAL_addAccelData(data);
+}
+
+bool SkGpuDevice::EXPERIMENTAL_drawPicture(const SkPicture& picture) {
+ SkPicture::AccelData::Key key = ComputeAccelDataKey();
+
+ const SkPicture::AccelData* data = picture.EXPERIMENTAL_getAccelData(key);
+ if (NULL == data) {
+ return false;
+ }
+
+#if 0
+ const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
+#endif
+
+ return false;
+}
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698