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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 * If the result image cannot be created, or the result would be transparen
t black, null | 358 * If the result image cannot be created, or the result would be transparen
t black, null |
359 * is returned, in which case the offset and outSubset parameters should be
ignored by the | 359 * is returned, in which case the offset and outSubset parameters should be
ignored by the |
360 * caller. | 360 * caller. |
361 */ | 361 */ |
362 sk_sp<SkImage> makeWithFilter(const SkImageFilter* filter, const SkIRect& su
bset, | 362 sk_sp<SkImage> makeWithFilter(const SkImageFilter* filter, const SkIRect& su
bset, |
363 const SkIRect& clipBounds, SkIRect* outSubset, | 363 const SkIRect& clipBounds, SkIRect* outSubset, |
364 SkIPoint* offset) const; | 364 SkIPoint* offset) const; |
365 | 365 |
366 /** Drawing params for which a deferred texture image data should be optimiz
ed. */ | 366 /** Drawing params for which a deferred texture image data should be optimiz
ed. */ |
367 struct DeferredTextureImageUsageParams { | 367 struct DeferredTextureImageUsageParams { |
368 DeferredTextureImageUsageParams() : fPreScaleMipLevel(0) {} | 368 DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQua
lity quality, |
369 DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQua
lity quality, | |
370 int preScaleMipLevel) | 369 int preScaleMipLevel) |
371 : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipL
evel) {} | 370 : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipL
evel) {} |
372 SkMatrix fMatrix; | 371 SkMatrix fMatrix; |
373 SkFilterQuality fQuality; | 372 SkFilterQuality fQuality; |
374 int fPreScaleMipLevel; | 373 int fPreScaleMipLevel; |
375 }; | 374 }; |
376 | 375 |
377 /** | 376 /** |
378 * This method allows clients to capture the data necessary to turn a SkImag
e into a texture- | 377 * This method allows clients to capture the data necessary to turn a SkImag
e into a texture- |
379 * backed image. If the original image is codec-backed this will decode into
a format optimized | 378 * backed image. If the original image is codec-backed this will decode into
a format optimized |
(...skipping 10 matching lines...) Expand all Loading... |
390 * to create deferred texture data for this image (or zero if this is an ina
ppropriate | 389 * to create deferred texture data for this image (or zero if this is an ina
ppropriate |
391 * candidate). The buffer allocated by the client should be 8 byte aligned. | 390 * candidate). The buffer allocated by the client should be 8 byte aligned. |
392 * | 391 * |
393 * When buffer is not null this fills in the deferred texture data for this
image in the | 392 * When buffer is not null this fills in the deferred texture data for this
image in the |
394 * provided buffer (assuming this is an appropriate candidate image and the
buffer is | 393 * provided buffer (assuming this is an appropriate candidate image and the
buffer is |
395 * appropriately aligned). Upon success the size written is returned, otherw
ise 0. | 394 * appropriately aligned). Upon success the size written is returned, otherw
ise 0. |
396 */ | 395 */ |
397 size_t getDeferredTextureImageData(const GrContextThreadSafeProxy&, | 396 size_t getDeferredTextureImageData(const GrContextThreadSafeProxy&, |
398 const DeferredTextureImageUsageParams[], | 397 const DeferredTextureImageUsageParams[], |
399 int paramCnt, | 398 int paramCnt, |
400 void* buffer) const; | 399 void* buffer, |
| 400 SkSourceGammaTreatment treatment = |
| 401 SkSourceGammaTreatment::kIgnore) const; |
401 | 402 |
402 /** | 403 /** |
403 * Returns a texture-backed image from data produced in SkImage::getDeferred
TextureImageData. | 404 * Returns a texture-backed image from data produced in SkImage::getDeferred
TextureImageData. |
404 * The context must be the context that provided the proxy passed to | 405 * The context must be the context that provided the proxy passed to |
405 * getDeferredTextureImageData. | 406 * getDeferredTextureImageData. |
406 */ | 407 */ |
407 static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext*, const voi
d*, SkBudgeted); | 408 static sk_sp<SkImage> MakeFromDeferredTextureImageData(GrContext*, const voi
d*, SkBudgeted); |
408 | 409 |
409 // Helper functions to convert to SkBitmap | 410 // Helper functions to convert to SkBitmap |
410 | 411 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 SkImage* newSubset(const SkIRect& subset) const { return this->makeSubset(su
bset).release(); } | 464 SkImage* newSubset(const SkIRect& subset) const { return this->makeSubset(su
bset).release(); } |
464 SkImage* newTextureImage(GrContext* ctx) const { return this->makeTextureIma
ge(ctx).release(); } | 465 SkImage* newTextureImage(GrContext* ctx) const { return this->makeTextureIma
ge(ctx).release(); } |
465 #endif | 466 #endif |
466 | 467 |
467 protected: | 468 protected: |
468 SkImage(int width, int height, uint32_t uniqueID); | 469 SkImage(int width, int height, uint32_t uniqueID); |
469 | 470 |
470 private: | 471 private: |
471 static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, | 472 static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, |
472 const GrMipLevel* texels, int mi
pLevelCount, | 473 const GrMipLevel* texels, int mi
pLevelCount, |
473 SkBudgeted); | 474 SkBudgeted, SkSourceGammaTreatme
nt); |
474 | 475 |
475 const int fWidth; | 476 const int fWidth; |
476 const int fHeight; | 477 const int fHeight; |
477 const uint32_t fUniqueID; | 478 const uint32_t fUniqueID; |
478 | 479 |
479 typedef SkRefCnt INHERITED; | 480 typedef SkRefCnt INHERITED; |
480 }; | 481 }; |
481 | 482 |
482 #endif | 483 #endif |
OLD | NEW |