aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-02 19:34:16 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-02 19:34:16 +0000
commit1a8ddf0a35bfb6c21a1184f81d2fdd50053acf31 (patch)
tree6c1148f08fe38ca8bcca95ae47472ed4f6910fc0 /include/gpu
parentc8e51782f89ba79497578c1f683b7eb471c34bc0 (diff)
Changes the SkCanvas::readPixels API. Allows caller to read into prealloced bitmap pixels. Changes how clipping to device bounds is handled.
Review URL: http://codereview.appspot.com/5307077/ git-svn-id: http://skia.googlecode.com/svn/trunk@2584 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrContext.h5
-rw-r--r--include/gpu/GrGLDefines.h4
-rw-r--r--include/gpu/SkGpuDevice.h6
3 files changed, 12 insertions, 3 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index f980702dd6..d61b8bb5a0 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -432,6 +432,8 @@ public:
* @param height height of rectangle to read in pixels.
* @param config the pixel config of the destination buffer
* @param buffer memory to read the rectangle into.
+ * @param rowBytes number of bytes bewtween consecueive rows. Zero
+ * means rows are tightly packed.
*
* @return true if the read succeeded, false if not. The read can fail
* because of a unsupported pixel config or because no render
@@ -439,7 +441,8 @@ public:
*/
bool readRenderTargetPixels(GrRenderTarget* target,
int left, int top, int width, int height,
- GrPixelConfig config, void* buffer);
+ GrPixelConfig config, void* buffer,
+ size_t rowBytes = 0);
/**
* Reads a rectangle of pixels from a texture.
diff --git a/include/gpu/GrGLDefines.h b/include/gpu/GrGLDefines.h
index 7a3d6767fa..5d11b9f27e 100644
--- a/include/gpu/GrGLDefines.h
+++ b/include/gpu/GrGLDefines.h
@@ -348,7 +348,9 @@
#define GR_GL_EXTENSIONS 0x1F03
/* Pixel Mode / Transfer */
-#define GR_GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GR_GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GR_GL_PACK_ROW_LENGTH 0x0D02
+
/* TextureMagFilter */
#define GR_GL_NEAREST 0x2600
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index f5613a7fd8..047fd0740c 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -68,7 +68,6 @@ public:
// overrides from SkDevice
virtual void clear(SkColor color);
- virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
virtual void writePixels(const SkBitmap& bitmap, int x, int y);
virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& clip,
@@ -140,6 +139,11 @@ protected:
TexCache fTex;
};
friend class SkAutoTexCache;
+
+ // overrides from SkDevice
+ virtual bool onReadPixels(const SkBitmap* bitmap,
+ int x, int y) SK_OVERRIDE;
+
private:
GrContext* fContext;