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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 536003002: Hide fields in SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix qt Created 6 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/gpu/GrSurface.cpp ('k') | src/gpu/SkGrPixelRef.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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, fLeakyProp erties)); 161 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, fLeakyProp erties));
162 } 162 }
163 163
164 SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo , 164 SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo ,
165 int sampleCount) { 165 int sampleCount) {
166 if (kUnknown_SkColorType == origInfo.colorType() || 166 if (kUnknown_SkColorType == origInfo.colorType() ||
167 origInfo.width() < 0 || origInfo.height() < 0) { 167 origInfo.width() < 0 || origInfo.height() < 0) {
168 return NULL; 168 return NULL;
169 } 169 }
170 170
171 SkImageInfo info = origInfo; 171 SkColorType ct = origInfo.colorType();
172 SkAlphaType at = origInfo.alphaType();
172 // TODO: perhas we can loosen this check now that colortype is more detailed 173 // TODO: perhas we can loosen this check now that colortype is more detailed
173 // e.g. can we support both RGBA and BGRA here? 174 // e.g. can we support both RGBA and BGRA here?
174 if (kRGB_565_SkColorType == info.colorType()) { 175 if (kRGB_565_SkColorType == ct) {
175 info.fAlphaType = kOpaque_SkAlphaType; // force this setting 176 at = kOpaque_SkAlphaType; // force this setting
176 } else { 177 } else {
177 info.fColorType = kN32_SkColorType; 178 ct = kN32_SkColorType;
178 if (kOpaque_SkAlphaType != info.alphaType()) { 179 if (kOpaque_SkAlphaType != at) {
179 info.fAlphaType = kPremul_SkAlphaType; // force this setting 180 at = kPremul_SkAlphaType; // force this setting
180 } 181 }
181 } 182 }
183 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height (), ct, at);
182 184
183 GrTextureDesc desc; 185 GrTextureDesc desc;
184 desc.fFlags = kRenderTarget_GrTextureFlagBit; 186 desc.fFlags = kRenderTarget_GrTextureFlagBit;
185 desc.fWidth = info.width(); 187 desc.fWidth = info.width();
186 desc.fHeight = info.height(); 188 desc.fHeight = info.height();
187 desc.fConfig = SkImageInfo2GrPixelConfig(info); 189 desc.fConfig = SkImageInfo2GrPixelConfig(info);
188 desc.fSampleCnt = sampleCount; 190 desc.fSampleCnt = sampleCount;
189 191
190 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0 )); 192 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0 ));
191 if (!texture.get()) { 193 if (!texture.get()) {
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); 1946 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture);
1945 1947
1946 return true; 1948 return true;
1947 } 1949 }
1948 1950
1949 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1951 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1950 // We always return a transient cache, so it is freed after each 1952 // We always return a transient cache, so it is freed after each
1951 // filter traversal. 1953 // filter traversal.
1952 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1954 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1953 } 1955 }
OLDNEW
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698