impl getROPixels for gpu SkImage

BUG=skia:
R=jvanverth@google.com

Review URL: https://codereview.chromium.org/150513005

git-svn-id: http://skia.googlecode.com/svn/trunk@13352 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2014-02-06 22:00:58 +00:00
parent 0e8c8ef8d1
commit ace135453d
2 changed files with 6 additions and 5 deletions

View File

@ -154,7 +154,7 @@ static void saveFile(const char name[], const char config[], const char dir[],
SkString path = SkOSPath::SkPathJoin(dir, filename.c_str());
::remove(path.c_str());
SkFILEWStream stream(filename.c_str());
SkFILEWStream stream(path.c_str());
stream.write(data->data(), data->size());
}

View File

@ -23,10 +23,7 @@ public:
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE;
virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint*) SK_OVERRIDE;
virtual GrTexture* onGetTexture() SK_OVERRIDE;
virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE {
// TODO
return false;
}
virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
GrTexture* getTexture() { return fBitmap.getTexture(); }
@ -61,6 +58,10 @@ GrTexture* SkImage_Gpu::onGetTexture() {
return fBitmap.getTexture();
}
bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
return fBitmap.copyTo(dst, SkBitmap::kARGB_8888_Config);
}
///////////////////////////////////////////////////////////////////////////////
SkImage* SkImage::NewTexture(const SkBitmap& bitmap) {