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

Side by Side Diff: src/image/SkImage_Base.h

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 unified diff | Download patch
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/image/SkImage_Gpu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkImage_Base_DEFINED 8 #ifndef SkImage_Base_DEFINED
9 #define SkImage_Base_DEFINED 9 #define SkImage_Base_DEFINED
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const = 0; 48 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const = 0;
49 49
50 virtual SkImage* onNewSubset(const SkIRect&) const = 0; 50 virtual SkImage* onNewSubset(const SkIRect&) const = 0;
51 51
52 virtual SkData* onRefEncoded() const { return nullptr; } 52 virtual SkData* onRefEncoded() const { return nullptr; }
53 53
54 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; 54 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
55 55
56 virtual bool onIsLazyGenerated() const { return false; } 56 virtual bool onIsLazyGenerated() const { return false; }
57 57
58 // Return a bitmap suitable for passing to image-filters
59 // For now, that means wrapping textures into SkGrPixelRefs...
60 virtual bool asBitmapForImageFilters(SkBitmap* bitmap) const {
61 return this->getROPixels(bitmap, kAllow_CachingHint);
62 }
63
58 // Call when this image is part of the key to a resourcecache entry. This al lows the cache 64 // Call when this image is part of the key to a resourcecache entry. This al lows the cache
59 // to know automatically those entries can be purged when this SkImage delet ed. 65 // to know automatically those entries can be purged when this SkImage delet ed.
60 void notifyAddedToCache() const { 66 void notifyAddedToCache() const {
61 fAddedToCache.store(true); 67 fAddedToCache.store(true);
62 } 68 }
63 69
64 private: 70 private:
65 // Set true by caches when they cache content that's derived from the curren t pixels. 71 // Set true by caches when they cache content that's derived from the curren t pixels.
66 mutable SkAtomic<bool> fAddedToCache; 72 mutable SkAtomic<bool> fAddedToCache;
67 73
68 typedef SkImage INHERITED; 74 typedef SkImage INHERITED;
69 }; 75 };
70 76
71 static inline SkImage_Base* as_IB(SkImage* image) { 77 static inline SkImage_Base* as_IB(SkImage* image) {
72 return static_cast<SkImage_Base*>(image); 78 return static_cast<SkImage_Base*>(image);
73 } 79 }
74 80
75 static inline const SkImage_Base* as_IB(const SkImage* image) { 81 static inline const SkImage_Base* as_IB(const SkImage* image) {
76 return static_cast<const SkImage_Base*>(image); 82 return static_cast<const SkImage_Base*>(image);
77 } 83 }
78 84
79 #endif 85 #endif
OLDNEW
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/image/SkImage_Gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698