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

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 70c10d7f69db1e62e84a60437406ed23d762c57e..224518e59c73a66c7fa278170db3c72dac2d5ef7 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#include "GrLayerCache.h"
#include "GrLayerHoister.h"
+#include "GrLayerCache.h"
#include "GrRecordReplaceDraw.h"
-
#include "SkCanvas.h"
#include "SkDeviceImageFilterProxy.h"
#include "SkDeviceProperties.h"
#include "SkGpuDevice.h"
#include "SkGrPixelRef.h"
+#include "SkImagePriv.h"
#include "SkLayerInfo.h"
#include "SkRecordDraw.h"
#include "SkSurface.h"
@@ -276,13 +276,13 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
}
}
-SkBitmap wrap_texture(GrTexture* texture) {
+static SkImage* wrap_texture(GrTexture* texture) {
SkASSERT(texture);
-
SkBitmap result;
result.setInfo(texture->surfacePriv().info());
result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unref();
- return result;
+ return SkNewImageFromBitmapTexture(result, texture->desc().fSampleCnt,
+ SkSurface::kYes_Budgeted);
}
void GrLayerHoister::FilterLayer(GrContext* context,
@@ -294,7 +294,6 @@ void GrLayerHoister::FilterLayer(GrContext* context,
static const int kDefaultCacheSize = 32 * 1024 * 1024;
- SkBitmap filteredBitmap;
SkIPoint offset = SkIPoint::Make(0, 0);
const SkIPoint filterOffset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcIR().fTop);
@@ -313,15 +312,15 @@ void GrLayerHoister::FilterLayer(GrContext* context,
SkImageFilter::Context filterContext(totMat, clipBounds, cache);
SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
- const SkBitmap src = wrap_texture(layer->texture());
-
- if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitmap, &offset)) {
+ SkAutoTUnref<const SkImage> src(wrap_texture(layer->texture()));
+ SkAutoTUnref<const SkImage> filteredImage;
+ if (!layer->filter()->filterImage(&proxy, src, filterContext, filteredImage, &offset)) {
// Filtering failed. Press on with the unfiltered version.
return;
}
- SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.height());
- layer->setTexture(filteredBitmap.getTexture(), newRect);
+ SkIRect newRect = SkIRect::MakeWH(filteredImage->width(), filteredImage->height());
+ layer->setTexture(filteredImage->getTexture(), newRect);
layer->setOffset(offset);
}
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698