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

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

Issue 1205643002: Make SkGpuDevice know its alpha type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix bench pictures :( Created 5 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/SkGpuDevice.cpp ('k') | src/image/SkSurface_Gpu.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 "SkImage_Gpu.h" 8 #include "SkImage_Gpu.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return false; 54 return false;
55 } 55 }
56 if (!fTexture->readPixels(0, 0, dst->width(), dst->height(), kSkia8888_GrPix elConfig, 56 if (!fTexture->readPixels(0, 0, dst->width(), dst->height(), kSkia8888_GrPix elConfig,
57 dst->getPixels(), dst->rowBytes())) { 57 dst->getPixels(), dst->rowBytes())) {
58 return false; 58 return false;
59 } 59 }
60 return true; 60 return true;
61 } 61 }
62 62
63 bool SkImage_Gpu::isOpaque() const { 63 bool SkImage_Gpu::isOpaque() const {
64 return GrPixelConfigIsOpaque(fTexture->config()); 64 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk AlphaType;
65 } 65 }
66 66
67 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) { 67 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
68 switch (info.colorType()) { 68 switch (info.colorType()) {
69 case kRGBA_8888_SkColorType: 69 case kRGBA_8888_SkColorType:
70 case kBGRA_8888_SkColorType: 70 case kBGRA_8888_SkColorType:
71 break; 71 break;
72 default: 72 default:
73 return; // nothing to do 73 return; // nothing to do
74 } 74 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 colorSpace))->unref(); 249 colorSpace))->unref();
250 250
251 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), 251 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
252 SkIntToScalar(dstDesc.fHeight)); 252 SkIntToScalar(dstDesc.fHeight));
253 GrDrawContext* drawContext = ctx->drawContext(); 253 GrDrawContext* drawContext = ctx->drawContext();
254 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMa trix::I(), rect); 254 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMa trix::I(), rect);
255 ctx->flushSurfaceWrites(dst); 255 ctx->flushSurfaceWrites(dst);
256 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA lphaType, dst, 0, 256 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA lphaType, dst, 0,
257 budgeted)); 257 budgeted));
258 } 258 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698