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 "SkBitmapCache.h" | 9 #include "SkBitmapCache.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) { | 281 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) { |
282 SkPixelRef* pr = bm.pixelRef(); | 282 SkPixelRef* pr = bm.pixelRef(); |
283 if (nullptr == pr) { | 283 if (nullptr == pr) { |
284 return nullptr; | 284 return nullptr; |
285 } | 285 } |
286 | 286 |
287 #if SK_SUPPORT_GPU | 287 #if SK_SUPPORT_GPU |
288 if (GrTexture* tex = pr->getTexture()) { | 288 if (GrTexture* tex = pr->getTexture()) { |
289 SkAutoTUnref<GrTexture> unrefCopy; | 289 SkAutoTUnref<GrTexture> unrefCopy; |
290 if (!bm.isImmutable()) { | 290 if (!bm.isImmutable()) { |
291 tex = GrDeepCopyTexture(tex, SkBudgeted::kNo); | 291 const bool notBudgeted = false; |
| 292 tex = GrDeepCopyTexture(tex, notBudgeted); |
292 if (nullptr == tex) { | 293 if (nullptr == tex) { |
293 return nullptr; | 294 return nullptr; |
294 } | 295 } |
295 unrefCopy.reset(tex); | 296 unrefCopy.reset(tex); |
296 } | 297 } |
297 const SkImageInfo info = bm.info(); | 298 const SkImageInfo info = bm.info(); |
298 return new SkImage_Gpu(info.width(), info.height(), bm.getGenerationID()
, info.alphaType(), | 299 return new SkImage_Gpu(info.width(), info.height(), bm.getGenerationID()
, info.alphaType(), |
299 tex, SkBudgeted::kNo); | 300 tex, SkSurface::kNo_Budgeted); |
300 } | 301 } |
301 #endif | 302 #endif |
302 | 303 |
303 // This will check for immutable (share or copy) | 304 // This will check for immutable (share or copy) |
304 return SkNewImageFromRasterBitmap(bm); | 305 return SkNewImageFromRasterBitmap(bm); |
305 } | 306 } |
306 | 307 |
307 bool SkImage::asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) const { | 308 bool SkImage::asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) const { |
308 return as_IB(this)->onAsLegacyBitmap(bitmap, mode); | 309 return as_IB(this)->onAsLegacyBitmap(bitmap, mode); |
309 } | 310 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 355 |
355 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk
AlphaType) { | 356 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk
AlphaType) { |
356 return nullptr; | 357 return nullptr; |
357 } | 358 } |
358 | 359 |
359 SkImage* SkImage::newTextureImage(GrContext*) const { | 360 SkImage* SkImage::newTextureImage(GrContext*) const { |
360 return nullptr; | 361 return nullptr; |
361 } | 362 } |
362 | 363 |
363 #endif | 364 #endif |
OLD | NEW |