OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 #include "GrXferProcessor.h" | 10 #include "GrXferProcessor.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 GrSurfaceDesc yuvDesc; | 363 GrSurfaceDesc yuvDesc; |
364 yuvDesc.fConfig = kAlpha_8_GrPixelConfig; | 364 yuvDesc.fConfig = kAlpha_8_GrPixelConfig; |
365 SkAutoTUnref<GrTexture> yuvTextures[3]; | 365 SkAutoTUnref<GrTexture> yuvTextures[3]; |
366 for (int i = 0; i < 3; ++i) { | 366 for (int i = 0; i < 3; ++i) { |
367 yuvDesc.fWidth = yuvInfo.fSize[i].fWidth; | 367 yuvDesc.fWidth = yuvInfo.fSize[i].fWidth; |
368 yuvDesc.fHeight = yuvInfo.fSize[i].fHeight; | 368 yuvDesc.fHeight = yuvInfo.fSize[i].fHeight; |
369 bool needsExactTexture = | 369 bool needsExactTexture = |
370 (yuvDesc.fWidth != yuvInfo.fSize[0].fWidth) || | 370 (yuvDesc.fWidth != yuvInfo.fSize[0].fWidth) || |
371 (yuvDesc.fHeight != yuvInfo.fSize[0].fHeight); | 371 (yuvDesc.fHeight != yuvInfo.fSize[0].fHeight); |
372 yuvTextures[i].reset(ctx->textureProvider()->refScratchTexture(yuvDesc, | 372 yuvTextures[i].reset(ctx->textureProvider()->refScratchTexture(yuvDesc, |
373 needsExactTexture ? GrTextureProvider::kExact_ScratchTexMatch : | 373 needsExactTexture ? GrTextureProvider::kExact_ScratchMatch : |
374 GrTextureProvider::kApprox_ScratchTexMatch)); | 374 GrTextureProvider::kApprox_ScratchMatch)); |
375 if (!yuvTextures[i] || | 375 if (!yuvTextures[i] || |
376 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, | 376 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, |
377 yuvDesc.fConfig, planes[i], yuvInfo.fRo
wBytes[i])) { | 377 yuvDesc.fConfig, planes[i], yuvInfo.fRo
wBytes[i])) { |
378 return NULL; | 378 return NULL; |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 GrSurfaceDesc rtDesc = desc; | 382 GrSurfaceDesc rtDesc = desc; |
383 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag; | 383 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag; |
384 | 384 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 753 } |
754 return SkImageInfo::Make(w, h, ct, at); | 754 return SkImageInfo::Make(w, h, ct, at); |
755 } | 755 } |
756 | 756 |
757 | 757 |
758 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 758 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
759 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 759 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
760 dst->setInfo(info); | 760 dst->setInfo(info); |
761 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 761 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
762 } | 762 } |
OLD | NEW |