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

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

Issue 1348023004: have raster-image return itself as a texture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unneeded includes Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/image/SkImage_Raster.cpp » ('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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 // Default impl calls onDraw 51 // Default impl calls onDraw
52 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRowBytes, 52 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRowBytes,
53 int srcX, int srcY) const; 53 int srcX, int srcY) const;
54 54
55 virtual GrTexture* peekTexture() const { return nullptr; } 55 virtual GrTexture* peekTexture() const { return nullptr; }
56 56
57 // return a read-only copy of the pixels. We promise to not modify them, 57 // return a read-only copy of the pixels. We promise to not modify them,
58 // but only inspect them (or encode them). 58 // but only inspect them (or encode them).
59 virtual bool getROPixels(SkBitmap*) const { return false; } 59 virtual bool getROPixels(SkBitmap*) const = 0;
60
61 // Caller must call unref when they are done.
62 virtual GrTexture* asTextureRef(GrContext*, SkImageUsageType) const = 0;
60 63
61 virtual SkShader* onNewShader(SkShader::TileMode, 64 virtual SkShader* onNewShader(SkShader::TileMode,
62 SkShader::TileMode, 65 SkShader::TileMode,
63 const SkMatrix* localMatrix) const { return nu llptr; } 66 const SkMatrix* localMatrix) const { return nu llptr; }
64 67
65 // newWidth > 0, newHeight > 0, subset either nullptr or a proper subset of this bounds 68 // newWidth > 0, newHeight > 0, subset either nullptr or a proper subset of this bounds
66 virtual SkImage* onNewImage(int newWidth, int newHeight, const SkIRect* subs et, 69 virtual SkImage* onNewImage(int newWidth, int newHeight, const SkIRect* subs et,
67 SkFilterQuality) const; 70 SkFilterQuality) const;
68 virtual SkData* onRefEncoded() const { return nullptr; } 71 virtual SkData* onRefEncoded() const { return nullptr; }
69 72
70 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; 73 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
71 74
72 virtual bool onIsLazyGenerated() const { return false; } 75 virtual bool onIsLazyGenerated() const { return false; }
73 76
74 // Caller must call unref when they are done.
75 virtual GrTexture* asTextureRef(GrContext*, SkImageUsageType) const { return nullptr; }
76
77 private: 77 private:
78 const SkSurfaceProps fProps; 78 const SkSurfaceProps fProps;
79 79
80 typedef SkImage INHERITED; 80 typedef SkImage INHERITED;
81 }; 81 };
82 82
83 static inline SkImage_Base* as_IB(SkImage* image) { 83 static inline SkImage_Base* as_IB(SkImage* image) {
84 return static_cast<SkImage_Base*>(image); 84 return static_cast<SkImage_Base*>(image);
85 } 85 }
86 86
87 static inline const SkImage_Base* as_IB(const SkImage* image) { 87 static inline const SkImage_Base* as_IB(const SkImage* image) {
88 return static_cast<const SkImage_Base*>(image); 88 return static_cast<const SkImage_Base*>(image);
89 } 89 }
90 90
91 #endif 91 #endif
OLDNEW
« no previous file with comments | « no previous file | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698