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

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: 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
Index: src/gpu/SkGpuDevice.cpp
===================================================================
--- src/gpu/SkGpuDevice.cpp (revision 13762)
+++ 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"
@@ -1999,3 +2000,37 @@
this->initFromRenderTarget(context, texture->asRenderTarget(), true);
fNeedClear = needClear;
}
+
+class SkGPUAccelData : public SkPicture::SkAccelData {
+public:
+ static const int32_t kGPUID = 0x01;
bsalomon 2014/03/12 15:34:34 Maybe can grab this from an atomic inc at runtime
robertphillips 2014/03/13 12:43:42 Done.
+
+ SkGPUAccelData() : INHERITED(kGPUID) { }
+
+protected:
+
+private:
+ typedef SkPicture::SkAccelData INHERITED;
+};
+
+void SkGpuDevice::optimize(SkPicture* picture) {
+ SkGPUAccelData* data = SkNEW(SkGPUAccelData);
+
+ picture->setAccelData(data);
+}
+
+bool SkGpuDevice::optimizedRender(SkPicture& picture) {
+ const SkPicture::SkAccelData* data = picture.getAccelData();
+ if (NULL == data) {
+ return false;
+ }
+
+ if (SkGPUAccelData::kGPUID != data->getID()) {
+ return false;
+ }
+
+ const SkGPUAccelData *gpuData = static_cast<const SkGPUAccelData*>(data);
+ gpuData;
+
+ return false;
+}
« include/core/SkPicture.h ('K') | « src/core/SkPicture.cpp ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698