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

Unified Diff: src/image/SkImage_Gpu.cpp

Issue 1491293002: detect when we can filter bitmaps/images directly, w/o a tmp layer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move include to the top Created 5 years 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/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Gpu.cpp
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 346f7983b71eff2838ebf132c44111554fd24048..55a82bba8701b86e059fd7283f73941bf55d4911 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -5,16 +5,18 @@
* found in the LICENSE file.
*/
-#include "SkBitmapCache.h"
-#include "SkImage_Gpu.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrDrawContext.h"
#include "GrTextureParamsAdjuster.h"
#include "effects/GrYUVtoRGBEffect.h"
#include "SkCanvas.h"
+#include "SkBitmapCache.h"
#include "SkGpuDevice.h"
+#include "SkGrPixelRef.h"
#include "SkGrPriv.h"
+#include "SkImageFilter.h"
+#include "SkImage_Gpu.h"
#include "SkPixelRef.h"
SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
@@ -69,6 +71,13 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst, CachingHint chint) const {
return true;
}
+bool SkImage_Gpu::asBitmapForImageFilters(SkBitmap* bitmap) const {
+ bitmap->setInfo(make_info(this->width(), this->height(), this->isOpaque()));
+ bitmap->setPixelRef(new SkGrPixelRef(bitmap->info(), fTexture))->unref();
+ bitmap->pixelRef()->setImmutableWithID(this->uniqueID());
+ return true;
+}
+
class GpuImage_GrTextureAdjuster : public GrTextureAdjuster {
public:
GpuImage_GrTextureAdjuster(const SkImage_Gpu* image)
@@ -166,9 +175,6 @@ SkImage* SkImage_Gpu::onNewSubset(const SkIRect& subset) const {
///////////////////////////////////////////////////////////////////////////////////////////////////
-#include "SkGrPixelRef.h"
-#include "SkImageFilter.h"
-
class SkGpuImageFilterProxy : public SkImageFilter::Proxy {
GrContext* fCtx;
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698