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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return NULL; | 246 return NULL; |
247 } | 247 } |
248 unrefCopy.reset(tex); | 248 unrefCopy.reset(tex); |
249 } | 249 } |
250 const SkImageInfo info = bm.info(); | 250 const SkImageInfo info = bm.info(); |
251 return SkNEW_ARGS(SkImage_Gpu, (info.width(), info.height(), info.alphaT
ype(), | 251 return SkNEW_ARGS(SkImage_Gpu, (info.width(), info.height(), info.alphaT
ype(), |
252 tex, 0, SkSurface::kNo_Budgeted)); | 252 tex, 0, SkSurface::kNo_Budgeted)); |
253 } | 253 } |
254 #endif | 254 #endif |
255 | 255 |
256 // Encoded version? | |
257 if (SkData* encoded = pr->refEncodedData()) { | |
258 SkAutoTUnref<SkData> data(encoded); | |
259 return SkImage::NewFromEncoded(encoded); // todo: add origin/subset/et
c? | |
260 } | |
261 | |
262 // This will check for immutable (share or copy) | 256 // This will check for immutable (share or copy) |
263 return SkNewImageFromRasterBitmap(bm, false, NULL); | 257 return SkNewImageFromRasterBitmap(bm, false, NULL); |
264 } | 258 } |
265 | 259 |
266 ////////////////////////////////////////////////////////////////////////////////
////// | 260 ////////////////////////////////////////////////////////////////////////////////
////// |
267 | 261 |
268 #if !SK_SUPPORT_GPU | 262 #if !SK_SUPPORT_GPU |
269 | 263 |
270 SkImage* SkImage::NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlph
aType, | 264 SkImage* SkImage::NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlph
aType, |
271 TextureReleaseProc, ReleaseContext) { | 265 TextureReleaseProc, ReleaseContext) { |
272 return NULL; | 266 return NULL; |
273 } | 267 } |
274 | 268 |
275 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&,
SkAlphaType) { | 269 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&,
SkAlphaType) { |
276 return NULL; | 270 return NULL; |
277 } | 271 } |
278 | 272 |
279 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk
AlphaType) { | 273 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk
AlphaType) { |
280 return NULL; | 274 return NULL; |
281 } | 275 } |
282 | 276 |
283 #endif | 277 #endif |
OLD | NEW |