aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-02 19:39:51 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-02 19:39:51 +0000
commitace7bd5623354ffabbd224d5b76550bab159c296 (patch)
treeecdfbbd957509e31c8b1313fc6b73d301865630d /include
parent1a8ddf0a35bfb6c21a1184f81d2fdd50053acf31 (diff)
Revert r2584 (new test fails in fixed pt builds)
git-svn-id: http://skia.googlecode.com/svn/trunk@2585 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h15
-rw-r--r--include/core/SkCanvas.h41
-rw-r--r--include/core/SkDevice.h31
-rw-r--r--include/device/xps/SkXPSDevice.h11
-rw-r--r--include/gpu/GrContext.h5
-rw-r--r--include/gpu/GrGLDefines.h4
-rw-r--r--include/gpu/SkGpuDevice.h6
-rw-r--r--include/pdf/SkPDFDevice.h11
8 files changed, 28 insertions, 96 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index ae56739c5f..e98a294bde 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -225,11 +225,12 @@ public:
/** Copies the bitmap's pixels to the location pointed at by dst and returns
true if possible, returns false otherwise.
- In the case when the dstRowBytes matches the bitmap's rowBytes, the copy
- may be made faster by copying over the dst's per-row padding (for all
- rows but the last). By setting preserveDstPad to true the caller can
- disable this optimization and ensure that pixels in the padding are not
- overwritten.
+ In the event that the bitmap's stride is equal to dstRowBytes, and if
+ it is greater than strictly required by the bitmap's current config
+ (this may happen if the bitmap is an extracted subset of another), then
+ this function will copy bytes past the eand of each row, excluding the
+ last row. No copies are made outside of the declared size of dst,
+ however.
Always returns false for RLE formats.
@@ -238,10 +239,8 @@ public:
pixels using indicated stride.
@param dstRowBytes Width of each line in the buffer. If -1, uses
bitmap's internal stride.
- @param preserveDstPad Must we preserve padding in the dst
*/
- bool copyPixelsTo(void* const dst, size_t dstSize, int dstRowBytes = -1,
- bool preserveDstPad = false)
+ bool copyPixelsTo(void* const dst, size_t dstSize, int dstRowBytes = -1)
const;
/** Use the standard HeapAllocator to create the pixelref that manages the
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 90bc1f433e..b2bdafe738 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -105,45 +105,14 @@ public:
///////////////////////////////////////////////////////////////////////////
- /**
- * On success (returns true), copy the canvas pixels into the bitmap.
- * On failure, the bitmap parameter is left unchanged and false is
- * returned.
- *
- * If the canvas is backed by a non-raster device (e.g. PDF) then
- * readPixels will fail.
- *
- * If the bitmap has pixels already allocated, the canvas pixels will be
- * written there. If not, bitmap->allocPixels() will be called
- * automatically. If the bitmap is backed by a texture readPixels will
- * fail.
- *
- * The canvas' pixels are converted to the bitmap's config. The only
- * supported config is kARGB_8888_Config, though this may be relaxed in
- * future.
- *
- * The actual pixels written is the intersection of the canvas' bounds, and
- * the rectangle formed by the bitmap's width,height and the specified x,y.
- * If bitmap pixels extend outside of that intersection, they will not be
- * modified.
- *
- * Example that reads the entire canvas into a bitmap:
- * SkISize size = canvas->getDeviceSize();
- * bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
- * size.fHeight);
- * if (canvas->readPixels(bitmap, 0, 0)) {
- * // use the pixels
- * }
- */
- bool readPixels(SkBitmap* bitmap, int x, int y);
-
/**
- * DEPRECATED: This will be removed as soon as webkit is no longer relying
- * on it. The bitmap is resized to the intersection of srcRect and the
- * canvas bounds. New pixels are always allocated on success. Bitmap is
- * unmodified on failure.
+ * Copy the pixels from the device into bitmap. Returns true on success.
+ * If false is returned, then the bitmap parameter is left unchanged.
+ * The bitmap parameter is treated as output-only, and will be completely
+ * overwritten (if the method returns true).
*/
bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
+ bool readPixels(SkBitmap* bitmap);
/**
* Similar to draw sprite, this method will copy the pixels in bitmap onto
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 5d184e478f..95b63892ae 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -108,23 +108,11 @@ public:
/**
* Copy the pixels from the device into bitmap. Returns true on success.
- * If false is returned, then the bitmap parameter is left unchanged. The
- * rectangle read is defined by x, y and the bitmap's width and height.
- *
- * If the bitmap has pixels allocated the canvas will write directly to
- * into that memory (if the call succeeds).
- *
- * The read is clipped to the device bounds. If bitmap pixels were
- * preallocated then pixels outside the clip are left unmodified. If the
- * call allocates bitmap pixels then pixels outside the clip will be
- * uninitialized.
- *
- * Currently bitmap must have kARGB_8888_Config or readPixels will fail.
- * This will likely be relaxed in the future.
- *
- * The bitmap parameter is not modified if the call fails.
+ * If false is returned, then the bitmap parameter is left unchanged.
+ * The bitmap parameter is treated as output-only, and will be completely
+ * overwritten (if the method returns true).
*/
- bool readPixels(SkBitmap* bitmap, int x, int y);
+ virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
/**
* Similar to draw sprite, this method will copy the pixels in bitmap onto
@@ -268,17 +256,6 @@ protected:
fBitmap.setPixelRef(pr, offset);
return pr;
}
-
- /**
- * Implements readPixels API. The caller will ensure that:
- * 1. bitmap has pixel config kARGB_8888_Config.
- * 2. bitmap has pixels.
- * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
- * contained in the device bounds.
- * 4. the bitmap struct is safe to partially overwrite in case of failure
- */
- virtual bool onReadPixels(const SkBitmap* bitmap, int x, int y);
-
/** Called when this device is installed into a Canvas. Balanaced by a call
to unlockPixels() when the device is removed from a Canvas.
diff --git a/include/device/xps/SkXPSDevice.h b/include/device/xps/SkXPSDevice.h
index ed61ced8d0..1fb9220d15 100644
--- a/include/device/xps/SkXPSDevice.h
+++ b/include/device/xps/SkXPSDevice.h
@@ -71,6 +71,11 @@ public:
return kVector_Capability;
}
+ virtual bool readPixels(const SkIRect& srcRect,
+ SkBitmap* bitmap) SK_OVERRIDE {
+ return false;
+ }
+
protected:
virtual void clear(SkColor color) SK_OVERRIDE;
@@ -141,12 +146,6 @@ protected:
int x, int y,
const SkPaint& paint) SK_OVERRIDE;
- virtual bool onReadPixels(const SkBitmap* bitmap,
- int x,
- int y) SK_OVERRIDE {
- return false;
- }
-
private:
class TypefaceUse : ::SkNoncopyable {
public:
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index d61b8bb5a0..f980702dd6 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -432,8 +432,6 @@ 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
@@ -441,8 +439,7 @@ public:
*/
bool readRenderTargetPixels(GrRenderTarget* target,
int left, int top, int width, int height,
- GrPixelConfig config, void* buffer,
- size_t rowBytes = 0);
+ GrPixelConfig config, void* buffer);
/**
* Reads a rectangle of pixels from a texture.
diff --git a/include/gpu/GrGLDefines.h b/include/gpu/GrGLDefines.h
index 5d11b9f27e..7a3d6767fa 100644
--- a/include/gpu/GrGLDefines.h
+++ b/include/gpu/GrGLDefines.h
@@ -348,9 +348,7 @@
#define GR_GL_EXTENSIONS 0x1F03
/* Pixel Mode / Transfer */
-#define GR_GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GR_GL_PACK_ROW_LENGTH 0x0D02
-
+#define GR_GL_UNPACK_ROW_LENGTH 0x0CF2
/* TextureMagFilter */
#define GR_GL_NEAREST 0x2600
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 047fd0740c..f5613a7fd8 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -68,6 +68,7 @@ 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,
@@ -139,11 +140,6 @@ protected:
TexCache fTex;
};
friend class SkAutoTexCache;
-
- // overrides from SkDevice
- virtual bool onReadPixels(const SkBitmap* bitmap,
- int x, int y) SK_OVERRIDE;
-
private:
GrContext* fContext;
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index b25e39a7d0..9e985e7702 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -66,6 +66,10 @@ public:
virtual void clear(SkColor color);
+ virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
+ return false;
+ }
+
/** These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations,
and are handling any looping from the paint, and any effects from the
@@ -156,13 +160,6 @@ public:
const SkPDFGlyphSetMap& getFontGlyphUsage() const {
return *(fFontGlyphUsage.get());
}
-
-protected:
- virtual bool onReadPixels(const SkBitmap* bitmap,
- int x, int y) SK_OVERRIDE {
- return false;
- }
-
private:
// TODO(vandebo): push most of SkPDFDevice's state into a core object in