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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1785643003: Switch SkBlurImageFilter over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indent Created 4 years, 9 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
« src/effects/SkBlurImageFilter.cpp ('K') | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index c2d8bdad325adc8ab5b09008ec5d7a9e90784568..ffe4a08560e571a94b7a161b192687a3a147c057 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -220,6 +220,33 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(
return texture->asRenderTarget();
}
+void SkGpuDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap,
reed1 2016/03/21 20:41:35 // Want to ensure that we always have a texture-ba
robertphillips 2016/03/21 21:32:40 Done.
+ int x, int y, const SkPaint& paint) {
+ if (bitmap.getTexture()) {
+ INHERITED::drawBitmapAsSprite(draw, bitmap, x, y, paint);
+ return;
+ }
+
+ SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
+ if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
+ return;
+ }
+
+ GrTexture* texture;
+ // draw sprite neither filters nor tiles.
+ AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(), &texture);
+ if (!texture) {
+ return;
+ }
+
+ SkBitmap newBitmap;
+
+ GrWrapTextureInBitmap(texture, texture->width(), texture->height(),
+ bitmap.isOpaque(), &newBitmap);
+
+ INHERITED::drawBitmapAsSprite(draw, newBitmap, x, y, paint);
+}
+
///////////////////////////////////////////////////////////////////////////////
bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
« src/effects/SkBlurImageFilter.cpp ('K') | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698