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 "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag; | 421 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag; |
422 | 422 |
423 GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRe
f, NULL, 0); | 423 GrTexture* result = create_texture_for_bmp(ctx, optionalKey, rtDesc, pixelRe
f, NULL, 0); |
424 if (!result) { | 424 if (!result) { |
425 return NULL; | 425 return NULL; |
426 } | 426 } |
427 | 427 |
428 GrRenderTarget* renderTarget = result->asRenderTarget(); | 428 GrRenderTarget* renderTarget = result->asRenderTarget(); |
429 SkASSERT(renderTarget); | 429 SkASSERT(renderTarget); |
430 | 430 |
| 431 GrPaint paint; |
431 SkAutoTUnref<GrFragmentProcessor> | 432 SkAutoTUnref<GrFragmentProcessor> |
432 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1
], yuvTextures[2], | 433 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager
(), yuvTextures[0], |
| 434 yuvTextures[1], yuvTextures[2
], |
433 yuvInfo.fSize, yuvInfo.fColor
Space)); | 435 yuvInfo.fSize, yuvInfo.fColor
Space)); |
434 GrPaint paint; | |
435 paint.addColorProcessor(yuvToRgbProcessor); | 436 paint.addColorProcessor(yuvToRgbProcessor); |
436 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), | 437 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), |
437 SkIntToScalar(yuvInfo.fSize[0].fHeight)); | 438 SkIntToScalar(yuvInfo.fSize[0].fHeight)); |
438 | 439 |
439 GrDrawContext* drawContext = ctx->drawContext(); | 440 GrDrawContext* drawContext = ctx->drawContext(); |
440 if (!drawContext) { | 441 if (!drawContext) { |
441 return NULL; | 442 return NULL; |
442 } | 443 } |
443 | 444 |
444 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I()
, r); | 445 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I()
, r); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 } | 801 } |
801 return SkImageInfo::Make(w, h, ct, at); | 802 return SkImageInfo::Make(w, h, ct, at); |
802 } | 803 } |
803 | 804 |
804 | 805 |
805 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 806 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
806 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 807 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
807 dst->setInfo(info); | 808 dst->setInfo(info); |
808 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 809 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
809 } | 810 } |
OLD | NEW |