Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 2264293003: Remove SkPixelRef::getTexture() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/image/SkImage.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 SkImageInfo info = SkImageInfo::Make(dti->fWidth, dti->fHeight, 533 SkImageInfo info = SkImageInfo::Make(dti->fWidth, dti->fHeight,
534 dti->fColorType, dti->fAlphaType, color Space); 534 dti->fColorType, dti->fAlphaType, color Space);
535 SkPixmap pixmap; 535 SkPixmap pixmap;
536 pixmap.reset(info, dti->fMipMapLevelData[0].fPixelData, 536 pixmap.reset(info, dti->fMipMapLevelData[0].fPixelData,
537 dti->fMipMapLevelData[0].fRowBytes, colorTable.get()); 537 dti->fMipMapLevelData[0].fRowBytes, colorTable.get());
538 return SkImage::MakeTextureFromPixmap(context, pixmap, budgeted); 538 return SkImage::MakeTextureFromPixmap(context, pixmap, budgeted);
539 } 539 }
540 540
541 //////////////////////////////////////////////////////////////////////////////// /////////////////// 541 //////////////////////////////////////////////////////////////////////////////// ///////////////////
542 542
543 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) {
544 GrContext* ctx = src->getContext();
545
546 GrSurfaceDesc desc = src->desc();
547 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullp tr, 0);
548 if (!dst) {
549 return nullptr;
550 }
551
552 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
553 const SkIPoint dstP = SkIPoint::Make(0, 0);
554 ctx->copySurface(dst, src, srcR, dstP);
555 ctx->flushSurfaceWrites(dst);
556 return dst;
557 }
558
559 sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& info, 543 sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& info,
560 const GrMipLevel* texels, int mipL evelCount, 544 const GrMipLevel* texels, int mipL evelCount,
561 SkBudgeted budgeted) { 545 SkBudgeted budgeted) {
562 if (!ctx) { 546 if (!ctx) {
563 return nullptr; 547 return nullptr;
564 } 548 }
565 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 549 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
566 if (!texture) { 550 if (!texture) {
567 return nullptr; 551 return nullptr;
568 } 552 }
569 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, 553 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID,
570 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), 554 info.alphaType(), texture, sk_ref_sp(info.col orSpace()),
571 budgeted); 555 budgeted);
572 } 556 }
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698