aboutsummaryrefslogtreecommitdiffstats
path: root/include/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/SkGpuDevice.h2
-rw-r--r--include/gpu/SkGpuDeviceFactory.h11
-rw-r--r--include/gpu/SkGr.h20
-rw-r--r--include/gpu/SkGrTexturePixelRef.h27
4 files changed, 46 insertions, 14 deletions
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 8852803..fbe5929 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -30,7 +30,7 @@ class GrTextContext;
* Subclass of SkDevice, which directs all drawing to the GrGpu owned by the
* canvas.
*/
-class SkGpuDevice : public SkDevice {
+class SK_API SkGpuDevice : public SkDevice {
public:
/**
* The SkGpuDevice will render to the GrRenderTarget, or if the paremeter is
diff --git a/include/gpu/SkGpuDeviceFactory.h b/include/gpu/SkGpuDeviceFactory.h
index 5dcba6a..6f62ad6 100644
--- a/include/gpu/SkGpuDeviceFactory.h
+++ b/include/gpu/SkGpuDeviceFactory.h
@@ -21,7 +21,7 @@
class GrContext;
-class SkGpuDeviceFactory : public SkDeviceFactory {
+class SK_API SkGpuDeviceFactory : public SkDeviceFactory {
public:
/**
* The constructor will ref() the context, passing it to each device
@@ -34,6 +34,14 @@ public:
* construction.
*/
SkGpuDeviceFactory(GrContext*, GrRenderTarget* rootRenderTarget);
+
+ /**
+ * When the root layer is both a GrRenderTarget and a GrTexture it
+ * is handy to have the factory hang on to a ref to the GrTexture object.
+ * This is because the GrTexture has a ref to the GrRenderTarget but not
+ * vice-versa.
+ */
+ SkGpuDeviceFactory(GrContext*, GrTexture* rootRenderTargetTexture);
virtual ~SkGpuDeviceFactory();
@@ -43,6 +51,7 @@ public:
private:
GrContext* fContext;
GrRenderTarget* fRootRenderTarget;
+ GrTexture* fRootTexture;
};
#endif
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 7221213..10f1bd0 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -129,10 +129,10 @@ public:
* Convert the SkBitmap::Config to the corresponding PixelConfig, or
* kUnknown_PixelConfig if the conversion cannot be done.
*/
- static GrTexture::PixelConfig BitmapConfig2PixelConfig(SkBitmap::Config,
- bool isOpaque);
+ static GrPixelConfig BitmapConfig2PixelConfig(SkBitmap::Config,
+ bool isOpaque);
- static GrTexture::PixelConfig Bitmap2PixelConfig(const SkBitmap& bm) {
+ static GrPixelConfig Bitmap2PixelConfig(const SkBitmap& bm) {
return BitmapConfig2PixelConfig(bm.config(), bm.isOpaque());
}
@@ -156,14 +156,6 @@ public:
unsigned a = SkGetPackedA32(pm);
return GrColorPackRGBA(r, g, b, a);
}
-
- /**
- * This abandons all texture caches (for bitmaps and text) associated with
- * the gpu, and frees any associated skia caches. It differs from
- * deleteAllTextures in that it assumes that the gpu has lots its context,
- * and thus the associated HW textures are no longer valid
- */
- static void AbandonAllTextures(GrContext*);
};
////////////////////////////////////////////////////////////////////////////////
@@ -207,7 +199,11 @@ public:
virtual GrSetOp getOp() const;
virtual void getRect(GrRect* rect) const {
- *rect = Sk2Gr(*fCurr->fRect);
+ if (!fCurr->fRect) {
+ rect->setEmpty();
+ } else {
+ *rect = Sk2Gr(*fCurr->fRect);
+ }
}
virtual GrPathIter* getPathIter() {
diff --git a/include/gpu/SkGrTexturePixelRef.h b/include/gpu/SkGrTexturePixelRef.h
index 1f5133f..5bc64f5 100644
--- a/include/gpu/SkGrTexturePixelRef.h
+++ b/include/gpu/SkGrTexturePixelRef.h
@@ -40,11 +40,38 @@ protected:
// override from SkPixelRef
virtual void onUnlockPixels() {}
+ virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset);
private:
GrTexture* fTexture;
typedef SkPixelRef INHERITED;
};
+class SkGrRenderTargetPixelRef : public SkPixelRef {
+public:
+ SkGrRenderTargetPixelRef(GrRenderTarget* rt);
+ virtual ~SkGrRenderTargetPixelRef();
+
+ // override from SkPixelRef
+ virtual SkGpuTexture* getTexture();
+
+protected:
+ // override from SkPixelRef
+ virtual void* onLockPixels(SkColorTable** ptr) {
+ if (ptr) {
+ *ptr = NULL;
+ }
+ return NULL;
+ }
+
+ // override from SkPixelRef
+ virtual void onUnlockPixels() {}
+ virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset);
+
+private:
+ GrRenderTarget* fRenderTarget;
+ typedef SkPixelRef INHERITED;
+};
+
#endif