Line-endings only change (some windows line-endings snuck in)
git-svn-id: http://skia.googlecode.com/svn/trunk@2588 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
910267dde2
commit
daba14b7d4
@ -105,35 +105,35 @@ public:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On success (returns true), copy the canvas pixels into the bitmap.
|
* On success (returns true), copy the canvas pixels into the bitmap.
|
||||||
* On failure, the bitmap parameter is left unchanged and false is
|
* On failure, the bitmap parameter is left unchanged and false is
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
* If the canvas is backed by a non-raster device (e.g. PDF) then
|
* If the canvas is backed by a non-raster device (e.g. PDF) then
|
||||||
* readPixels will fail.
|
* readPixels will fail.
|
||||||
*
|
*
|
||||||
* If the bitmap has pixels already allocated, the canvas pixels will be
|
* If the bitmap has pixels already allocated, the canvas pixels will be
|
||||||
* written there. If not, bitmap->allocPixels() will be called
|
* written there. If not, bitmap->allocPixels() will be called
|
||||||
* automatically. If the bitmap is backed by a texture readPixels will
|
* automatically. If the bitmap is backed by a texture readPixels will
|
||||||
* fail.
|
* fail.
|
||||||
*
|
*
|
||||||
* The canvas' pixels are converted to the bitmap's config. The only
|
* The canvas' pixels are converted to the bitmap's config. The only
|
||||||
* supported config is kARGB_8888_Config, though this may be relaxed in
|
* supported config is kARGB_8888_Config, though this may be relaxed in
|
||||||
* future.
|
* future.
|
||||||
*
|
*
|
||||||
* The actual pixels written is the intersection of the canvas' bounds, and
|
* 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.
|
* 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
|
* If bitmap pixels extend outside of that intersection, they will not be
|
||||||
* modified.
|
* modified.
|
||||||
*
|
*
|
||||||
* Example that reads the entire canvas into a bitmap:
|
* Example that reads the entire canvas into a bitmap:
|
||||||
* SkISize size = canvas->getDeviceSize();
|
* SkISize size = canvas->getDeviceSize();
|
||||||
* bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
|
* bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
|
||||||
* size.fHeight);
|
* size.fHeight);
|
||||||
* if (canvas->readPixels(bitmap, 0, 0)) {
|
* if (canvas->readPixels(bitmap, 0, 0)) {
|
||||||
* // use the pixels
|
* // use the pixels
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
bool readPixels(SkBitmap* bitmap, int x, int y);
|
bool readPixels(SkBitmap* bitmap, int x, int y);
|
||||||
|
|
||||||
|
@ -560,11 +560,11 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
|
|||||||
|
|
||||||
bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
|
bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
|
||||||
SkDevice* device = this->getDevice();
|
SkDevice* device = this->getDevice();
|
||||||
|
|
||||||
SkIRect bounds;
|
SkIRect bounds;
|
||||||
bounds.set(0, 0, device->width(), device->height());
|
bounds.set(0, 0, device->width(), device->height());
|
||||||
if (!bounds.intersect(srcRect)) {
|
if (!bounds.intersect(srcRect)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkBitmap tmp;
|
SkBitmap tmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user