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 #include "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // exposed for SkSurface_Raster via SkNewImageFromPixelRef | 64 // exposed for SkSurface_Raster via SkNewImageFromPixelRef |
65 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes); | 65 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes); |
66 | 66 |
67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } | 67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } |
68 | 68 |
69 virtual SkShader* onNewShader(SkShader::TileMode, | 69 virtual SkShader* onNewShader(SkShader::TileMode, |
70 SkShader::TileMode, | 70 SkShader::TileMode, |
71 const SkMatrix* localMatrix) const SK_OVERRIDE
; | 71 const SkMatrix* localMatrix) const SK_OVERRIDE
; |
72 | 72 |
| 73 virtual bool isOpaque() const SK_OVERRIDE; |
| 74 |
73 SkImage_Raster(const SkBitmap& bm) | 75 SkImage_Raster(const SkBitmap& bm) |
74 : INHERITED(bm.width(), bm.height()) | 76 : INHERITED(bm.width(), bm.height()) |
75 , fBitmap(bm) {} | 77 , fBitmap(bm) {} |
76 | 78 |
77 private: | 79 private: |
78 SkImage_Raster() : INHERITED(0, 0) {} | 80 SkImage_Raster() : INHERITED(0, 0) {} |
79 | 81 |
80 SkBitmap fBitmap; | 82 SkBitmap fBitmap; |
81 | 83 |
82 typedef SkImage_Base INHERITED; | 84 typedef SkImage_Base INHERITED; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 214 } |
213 | 215 |
214 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, | 216 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, |
215 size_t rowBytes) { | 217 size_t rowBytes) { |
216 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); | 218 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); |
217 } | 219 } |
218 | 220 |
219 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { | 221 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { |
220 return ((SkImage_Raster*)image)->getPixelRef(); | 222 return ((SkImage_Raster*)image)->getPixelRef(); |
221 } | 223 } |
| 224 |
| 225 bool SkImage_Raster::isOpaque() const { |
| 226 return fBitmap.isOpaque(); |
| 227 } |
OLD | NEW |