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 "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" |
9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 return nullptr; | 461 return nullptr; |
462 } | 462 } |
463 | 463 |
464 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 464 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
465 const SkIPoint dstP = SkIPoint::Make(0, 0); | 465 const SkIPoint dstP = SkIPoint::Make(0, 0); |
466 ctx->copySurface(dst, src, srcR, dstP); | 466 ctx->copySurface(dst, src, srcR, dstP); |
467 ctx->flushSurfaceWrites(dst); | 467 ctx->flushSurfaceWrites(dst); |
468 return dst; | 468 return dst; |
469 } | 469 } |
470 | 470 |
| 471 sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo&
info, |
| 472 const GrMipLevel* texels, int mipL
evelCount, |
| 473 SkBudgeted budgeted) { |
| 474 if (!ctx) { |
| 475 return nullptr; |
| 476 } |
| 477 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
| 478 if (!texture) { |
| 479 return nullptr; |
| 480 } |
| 481 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
| 482 info.alphaType(), texture, budgeted); |
| 483 } |
OLD | NEW |