| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 /** | 113 /** |
| 114 * Create a new image from the specified descriptor. Note - Skia will delet
e or recycle the | 114 * Create a new image from the specified descriptor. Note - Skia will delet
e or recycle the |
| 115 * texture when the image is released. | 115 * texture when the image is released. |
| 116 * | 116 * |
| 117 * Will return NULL if the specified descriptor is unsupported. | 117 * Will return NULL if the specified descriptor is unsupported. |
| 118 */ | 118 */ |
| 119 static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext*, const GrBackendText
ureDesc&, | 119 static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext*, const GrBackendText
ureDesc&, |
| 120 SkAlphaType = kPremul_SkAlphaTy
pe); | 120 SkAlphaType = kPremul_SkAlphaTy
pe); |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * Create a new image by copying the pixels from the specified descriptor.
No reference is | |
| 124 * kept to the original platform texture. | |
| 125 * | |
| 126 * Will return NULL if the specified descriptor is unsupported. | |
| 127 */ | |
| 128 static sk_sp<SkImage> MakeFromTextureCopy(GrContext*, const GrBackendTexture
Desc&, | |
| 129 SkAlphaType = kPremul_SkAlphaType)
; | |
| 130 | |
| 131 /** | |
| 132 * Create a new image by copying the pixels from the specified y, u, v text
ures. The data | 123 * Create a new image by copying the pixels from the specified y, u, v text
ures. The data |
| 133 * from the textures is immediately ingested into the image and the texture
s can be modified or | 124 * from the textures is immediately ingested into the image and the texture
s can be modified or |
| 134 * deleted after the function returns. The image will have the dimensions o
f the y texture. | 125 * deleted after the function returns. The image will have the dimensions o
f the y texture. |
| 135 */ | 126 */ |
| 136 static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, | 127 static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, |
| 137 const GrBackendObject yuvTextu
reHandles[3], | 128 const GrBackendObject yuvTextu
reHandles[3], |
| 138 const SkISize yuvSizes[3], | 129 const SkISize yuvSizes[3], |
| 139 GrSurfaceOrigin); | 130 GrSurfaceOrigin); |
| 140 | 131 |
| 141 /** | 132 /** |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 return NewFromTexture(ctx, desc, kPremul_SkAlphaType, NULL, NULL); | 427 return NewFromTexture(ctx, desc, kPremul_SkAlphaType, NULL, NULL); |
| 437 } | 428 } |
| 438 | 429 |
| 439 static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& d
e, SkAlphaType at) { | 430 static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& d
e, SkAlphaType at) { |
| 440 return NewFromTexture(ctx, de, at, NULL, NULL); | 431 return NewFromTexture(ctx, de, at, NULL, NULL); |
| 441 } | 432 } |
| 442 static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAl
phaType, | 433 static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAl
phaType, |
| 443 TextureReleaseProc, ReleaseContext); | 434 TextureReleaseProc, ReleaseContext); |
| 444 static SkImage* NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc
&, | 435 static SkImage* NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc
&, |
| 445 SkAlphaType = kPremul_SkAlphaType); | 436 SkAlphaType = kPremul_SkAlphaType); |
| 446 static SkImage* NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, | |
| 447 SkAlphaType = kPremul_SkAlphaType); | |
| 448 static SkImage* NewFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, | 437 static SkImage* NewFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, |
| 449 const GrBackendObject yuvTextureHandl
es[3], | 438 const GrBackendObject yuvTextureHandl
es[3], |
| 450 const SkISize yuvSizes[3], | 439 const SkISize yuvSizes[3], |
| 451 GrSurfaceOrigin); | 440 GrSurfaceOrigin); |
| 452 static SkImage* NewFromPicture(const SkPicture*, const SkISize& dimensions, | 441 static SkImage* NewFromPicture(const SkPicture*, const SkISize& dimensions, |
| 453 const SkMatrix*, const SkPaint*); | 442 const SkMatrix*, const SkPaint*); |
| 454 static SkImage* NewTextureFromPixmap(GrContext*, const SkPixmap&, SkBudgeted
budgeted); | 443 static SkImage* NewTextureFromPixmap(GrContext*, const SkPixmap&, SkBudgeted
budgeted); |
| 455 static SkImage* NewFromDeferredTextureImageData(GrContext*, const void*, SkB
udgeted); | 444 static SkImage* NewFromDeferredTextureImageData(GrContext*, const void*, SkB
udgeted); |
| 456 | 445 |
| 457 SkImage* newSubset(const SkIRect& subset) const { return this->makeSubset(su
bset).release(); } | 446 SkImage* newSubset(const SkIRect& subset) const { return this->makeSubset(su
bset).release(); } |
| 458 SkImage* newTextureImage(GrContext* ctx) const { return this->makeTextureIma
ge(ctx).release(); } | 447 SkImage* newTextureImage(GrContext* ctx) const { return this->makeTextureIma
ge(ctx).release(); } |
| 459 #endif | 448 #endif |
| 460 | 449 |
| 461 protected: | 450 protected: |
| 462 SkImage(int width, int height, uint32_t uniqueID); | 451 SkImage(int width, int height, uint32_t uniqueID); |
| 463 | 452 |
| 464 private: | 453 private: |
| 465 static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, | 454 static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, |
| 466 const GrMipLevel* texels, int mi
pLevelCount, | 455 const GrMipLevel* texels, int mi
pLevelCount, |
| 467 SkBudgeted); | 456 SkBudgeted); |
| 468 | 457 |
| 469 const int fWidth; | 458 const int fWidth; |
| 470 const int fHeight; | 459 const int fHeight; |
| 471 const uint32_t fUniqueID; | 460 const uint32_t fUniqueID; |
| 472 | 461 |
| 473 typedef SkRefCnt INHERITED; | 462 typedef SkRefCnt INHERITED; |
| 474 }; | 463 }; |
| 475 | 464 |
| 476 #endif | 465 #endif |
| OLD | NEW |