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

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

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert Created 4 years, 6 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/gpu/SkGrPixelRef.cpp ('k') | src/views/SkWindow.cpp » ('j') | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 SkColor* row = (SkColor*)pixels; 104 SkColor* row = (SkColor*)pixels;
105 for (int y = 0; y < info.height(); ++y) { 105 for (int y = 0; y < info.height(); ++y) {
106 for (int x = 0; x < info.width(); ++x) { 106 for (int x = 0; x < info.width(); ++x) {
107 row[x] = SkPreMultiplyColor(row[x]); 107 row[x] = SkPreMultiplyColor(row[x]);
108 } 108 }
109 } 109 }
110 } 110 }
111 111
112 bool SkImage_Gpu::onReadPixels(const SkImageInfo& info, void* pixels, size_t row Bytes, 112 bool SkImage_Gpu::onReadPixels(const SkImageInfo& info, void* pixels, size_t row Bytes,
113 int srcX, int srcY, CachingHint) const { 113 int srcX, int srcY, CachingHint) const {
114 GrPixelConfig config = SkImageInfo2GrPixelConfig(info.colorType(), info.alph aType(), 114 GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getContext ()->caps());
115 info.profileType(),
116 *fTexture->getContext()->ca ps());
117 uint32_t flags = 0; 115 uint32_t flags = 0;
118 if (kUnpremul_SkAlphaType == info.alphaType() && kPremul_SkAlphaType == fAlp haType) { 116 if (kUnpremul_SkAlphaType == info.alphaType() && kPremul_SkAlphaType == fAlp haType) {
119 // let the GPU perform this transformation for us 117 // let the GPU perform this transformation for us
120 flags = GrContext::kUnpremul_PixelOpsFlag; 118 flags = GrContext::kUnpremul_PixelOpsFlag;
121 } 119 }
122 if (!fTexture->readPixels(srcX, srcY, info.width(), info.height(), config, 120 if (!fTexture->readPixels(srcX, srcY, info.width(), info.height(), config,
123 pixels, rowBytes, flags)) { 121 pixels, rowBytes, flags)) {
124 return false; 122 return false;
125 } 123 }
126 // do we have to manually fix-up the alpha channel? 124 // do we have to manually fix-up the alpha channel?
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (!ctx) { 535 if (!ctx) {
538 return nullptr; 536 return nullptr;
539 } 537 }
540 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 538 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
541 if (!texture) { 539 if (!texture) {
542 return nullptr; 540 return nullptr;
543 } 541 }
544 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, 542 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID,
545 info.alphaType(), texture, budgeted); 543 info.alphaType(), texture, budgeted);
546 } 544 }
OLDNEW
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | src/views/SkWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698