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

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

Issue 2072813002: Revert of Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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, *fTexture->getContext ()->caps()); 114 GrPixelConfig config = SkImageInfo2GrPixelConfig(info.colorType(), info.alph aType(),
115 info.profileType(),
116 *fTexture->getContext()->ca ps());
115 uint32_t flags = 0; 117 uint32_t flags = 0;
116 if (kUnpremul_SkAlphaType == info.alphaType() && kPremul_SkAlphaType == fAlp haType) { 118 if (kUnpremul_SkAlphaType == info.alphaType() && kPremul_SkAlphaType == fAlp haType) {
117 // let the GPU perform this transformation for us 119 // let the GPU perform this transformation for us
118 flags = GrContext::kUnpremul_PixelOpsFlag; 120 flags = GrContext::kUnpremul_PixelOpsFlag;
119 } 121 }
120 if (!fTexture->readPixels(srcX, srcY, info.width(), info.height(), config, 122 if (!fTexture->readPixels(srcX, srcY, info.width(), info.height(), config,
121 pixels, rowBytes, flags)) { 123 pixels, rowBytes, flags)) {
122 return false; 124 return false;
123 } 125 }
124 // do we have to manually fix-up the alpha channel? 126 // do we have to manually fix-up the alpha channel?
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (!ctx) { 537 if (!ctx) {
536 return nullptr; 538 return nullptr;
537 } 539 }
538 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 540 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
539 if (!texture) { 541 if (!texture) {
540 return nullptr; 542 return nullptr;
541 } 543 }
542 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, 544 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID,
543 info.alphaType(), texture, budgeted); 545 info.alphaType(), texture, budgeted);
544 } 546 }
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