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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SkBitmap src; | 126 SkBitmap src; |
127 if (!fBitmap.extractSubset(&src, subset)) { | 127 if (!fBitmap.extractSubset(&src, subset)) { |
128 return false; | 128 return false; |
129 } | 129 } |
130 return src.copyTo(dst, src.colorType()); | 130 return src.copyTo(dst, src.colorType()); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, | 134 const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, |
135 size_t* rowBytesPtr) const { | 135 size_t* rowBytesPtr) const { |
136 SkImageInfo info; | 136 const SkImageInfo info = fBitmap.info(); |
137 if (!fBitmap.asImageInfo(&info) || !fBitmap.getPixels()) { | 137 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels()) { |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 *infoPtr = info; | 140 *infoPtr = info; |
141 *rowBytesPtr = fBitmap.rowBytes(); | 141 *rowBytesPtr = fBitmap.rowBytes(); |
142 return fBitmap.getPixels(); | 142 return fBitmap.getPixels(); |
143 } | 143 } |
144 | 144 |
145 bool SkImage_Raster::getROPixels(SkBitmap* dst) const { | 145 bool SkImage_Raster::getROPixels(SkBitmap* dst) const { |
146 *dst = fBitmap; | 146 *dst = fBitmap; |
147 return true; | 147 return true; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, | 191 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, |
192 size_t rowBytes) { | 192 size_t rowBytes) { |
193 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); | 193 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); |
194 } | 194 } |
195 | 195 |
196 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { | 196 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { |
197 return ((SkImage_Raster*)image)->getPixelRef(); | 197 return ((SkImage_Raster*)image)->getPixelRef(); |
198 } | 198 } |
OLD | NEW |