| OLD | NEW |
| 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_DEFINED | 8 #ifndef SkImage_DEFINED |
| 9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); | 66 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); |
| 67 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); | 67 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); |
| 68 static SkImage* NewEncodedData(SkData*); | 68 static SkImage* NewEncodedData(SkData*); |
| 69 static SkImage* NewTexture(GrTexture*); | 69 static SkImage* NewTexture(GrTexture*); |
| 70 | 70 |
| 71 int width() const { return fWidth; } | 71 int width() const { return fWidth; } |
| 72 int height() const { return fHeight; } | 72 int height() const { return fHeight; } |
| 73 uint32_t uniqueID() const { return fUniqueID; } | 73 uint32_t uniqueID() const { return fUniqueID; } |
| 74 | 74 |
| 75 /** |
| 76 * Return the GrTexture that stores the image pixels. Calling getTexture |
| 77 * does not affect the reference count of the GrTexture object. |
| 78 * Will return NULL if the image does not use a texture. |
| 79 */ |
| 80 GrTexture* getTexture(); |
| 81 |
| 75 SkShader* newShaderClamp() const; | 82 SkShader* newShaderClamp() const; |
| 76 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; | 83 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; |
| 77 | 84 |
| 78 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 85 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
| 79 | 86 |
| 80 protected: | 87 protected: |
| 81 SkImage(int width, int height) : | 88 SkImage(int width, int height) : |
| 82 fWidth(width), | 89 fWidth(width), |
| 83 fHeight(height), | 90 fHeight(height), |
| 84 fUniqueID(NextUniqueID()) { | 91 fUniqueID(NextUniqueID()) { |
| 85 | 92 |
| 86 SkASSERT(width >= 0); | 93 SkASSERT(width >= 0); |
| 87 SkASSERT(height >= 0); | 94 SkASSERT(height >= 0); |
| 88 } | 95 } |
| 89 | 96 |
| 90 private: | 97 private: |
| 91 const int fWidth; | 98 const int fWidth; |
| 92 const int fHeight; | 99 const int fHeight; |
| 93 const uint32_t fUniqueID; | 100 const uint32_t fUniqueID; |
| 94 | 101 |
| 95 static uint32_t NextUniqueID(); | 102 static uint32_t NextUniqueID(); |
| 96 | 103 |
| 97 typedef SkRefCnt INHERITED; | 104 typedef SkRefCnt INHERITED; |
| 98 }; | 105 }; |
| 99 | 106 |
| 100 #endif | 107 #endif |
| OLD | NEW |