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

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

Issue 1404433002: Remove image usage type enum. Use GrTextureParams instead. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix no gpu build Created 5 years, 2 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 | « src/image/SkImageShader.cpp ('k') | src/image/SkImage_Generator.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
11 #include "SkAtomics.h" 11 #include "SkAtomics.h"
12 #include "SkImage.h" 12 #include "SkImage.h"
13 #include "SkSurface.h" 13 #include "SkSurface.h"
14 14
15 #include <new> 15 #include <new>
16 16
17 class GrTextureParams;
18
17 enum { 19 enum {
18 kNeedNewImageUniqueID = 0 20 kNeedNewImageUniqueID = 0
19 }; 21 };
20 22
21 class SkImage_Base : public SkImage { 23 class SkImage_Base : public SkImage {
22 public: 24 public:
23 SkImage_Base(int width, int height, uint32_t uniqueID); 25 SkImage_Base(int width, int height, uint32_t uniqueID);
24 virtual ~SkImage_Base(); 26 virtual ~SkImage_Base();
25 27
26 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { return nullptr; } 28 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { return nullptr; }
27 29
28 // Default impl calls onDraw 30 // Default impl calls onDraw
29 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRowBytes, 31 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRowBytes,
30 int srcX, int srcY) const; 32 int srcX, int srcY) const;
31 33
32 virtual GrTexture* peekTexture() const { return nullptr; } 34 virtual GrTexture* peekTexture() const { return nullptr; }
33 35
34 // return a read-only copy of the pixels. We promise to not modify them, 36 // return a read-only copy of the pixels. We promise to not modify them,
35 // but only inspect them (or encode them). 37 // but only inspect them (or encode them).
36 virtual bool getROPixels(SkBitmap*) const = 0; 38 virtual bool getROPixels(SkBitmap*) const = 0;
37 39
38 // Caller must call unref when they are done. 40 // Caller must call unref when they are done.
39 virtual GrTexture* asTextureRef(GrContext*, SkImageUsageType) const = 0; 41 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const = 0;
40 42
41 virtual SkImage* onNewSubset(const SkIRect&) const = 0; 43 virtual SkImage* onNewSubset(const SkIRect&) const = 0;
42 44
43 virtual SkData* onRefEncoded() const { return nullptr; } 45 virtual SkData* onRefEncoded() const { return nullptr; }
44 46
45 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; 47 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
46 48
47 virtual bool onIsLazyGenerated() const { return false; } 49 virtual bool onIsLazyGenerated() const { return false; }
48 50
49 // Call when this image is part of the key to a resourcecache entry. This al lows the cache 51 // Call when this image is part of the key to a resourcecache entry. This al lows the cache
(...skipping 11 matching lines...) Expand all
61 63
62 static inline SkImage_Base* as_IB(SkImage* image) { 64 static inline SkImage_Base* as_IB(SkImage* image) {
63 return static_cast<SkImage_Base*>(image); 65 return static_cast<SkImage_Base*>(image);
64 } 66 }
65 67
66 static inline const SkImage_Base* as_IB(const SkImage* image) { 68 static inline const SkImage_Base* as_IB(const SkImage* image) {
67 return static_cast<const SkImage_Base*>(image); 69 return static_cast<const SkImage_Base*>(image);
68 } 70 }
69 71
70 #endif 72 #endif
OLDNEW
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | src/image/SkImage_Generator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698