Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1282363002: Use SkImageCacherator in SkImages (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with mutex safeness Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index c808ade6c67d7d4b03393079858311bc3a3b3aeb..f45b2dec309b2376649ba13effee75811b8219d3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1546,8 +1546,8 @@ bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
filter, ctx, result, offset);
}
-static bool wrap_as_bm(const SkImage* image, SkBitmap* bm) {
- GrTexture* tex = as_IB(image)->getTexture();
+static bool wrap_as_bm(GrContext* ctx, const SkImage* image, SkBitmap* bm) {
+ SkAutoTUnref<GrTexture> tex(as_IB(image)->asTextureRef(ctx, kUntiled_SkImageUsageType));
if (tex) {
GrWrapTextureInBitmap(tex, image->width(), image->height(), image->isOpaque(), bm);
return true;
@@ -1559,7 +1559,7 @@ static bool wrap_as_bm(const SkImage* image, SkBitmap* bm) {
void SkGpuDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x, SkScalar y,
const SkPaint& paint) {
SkBitmap bm;
- if (wrap_as_bm(image, &bm)) {
+ if (wrap_as_bm(this->context(), image, &bm)) {
this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
}
}
@@ -1568,7 +1568,7 @@ void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
const SkRect& dst, const SkPaint& paint,
SkCanvas::SrcRectConstraint constraint) {
SkBitmap bm;
- if (wrap_as_bm(image, &bm)) {
+ if (wrap_as_bm(this->context(), image, &bm)) {
this->drawBitmapRect(draw, bm, src, dst, paint, constraint);
}
}

Powered by Google App Engine
This is Rietveld 408576698