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

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

Issue 248473006: stop using deprecated bitmap::config for gpu (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/gpu/SkGr.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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 info.fColorType = kN32_SkColorType; 232 info.fColorType = kN32_SkColorType;
233 if (kOpaque_SkAlphaType != info.alphaType()) { 233 if (kOpaque_SkAlphaType != info.alphaType()) {
234 info.fAlphaType = kPremul_SkAlphaType; // force this setting 234 info.fAlphaType = kPremul_SkAlphaType; // force this setting
235 } 235 }
236 } 236 }
237 237
238 GrTextureDesc desc; 238 GrTextureDesc desc;
239 desc.fFlags = kRenderTarget_GrTextureFlagBit; 239 desc.fFlags = kRenderTarget_GrTextureFlagBit;
240 desc.fWidth = info.width(); 240 desc.fWidth = info.width();
241 desc.fHeight = info.height(); 241 desc.fHeight = info.height();
242 desc.fConfig = SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType()) ; 242 desc.fConfig = SkImageInfo2GrPixelConfig(info);
243 desc.fSampleCnt = sampleCount; 243 desc.fSampleCnt = sampleCount;
244 244
245 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0 )); 245 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NULL, 0 ));
246 if (!texture.get()) { 246 if (!texture.get()) {
247 return NULL; 247 return NULL;
248 } 248 }
249 249
250 return SkNEW_ARGS(SkGpuDevice, (context, texture.get())); 250 return SkNEW_ARGS(SkGpuDevice, (context, texture.get()));
251 } 251 }
252 252
(...skipping 26 matching lines...) Expand all
279 fContext->setRenderTarget(fRenderTarget); 279 fContext->setRenderTarget(fRenderTarget);
280 } 280 }
281 281
282 /////////////////////////////////////////////////////////////////////////////// 282 ///////////////////////////////////////////////////////////////////////////////
283 283
284 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes, 284 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes,
285 int x, int y) { 285 int x, int y) {
286 DO_DEFERRED_CLEAR(); 286 DO_DEFERRED_CLEAR();
287 287
288 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels 288 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels
289 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo.colorType(), dstInf o.alphaType()); 289 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo);
290 if (kUnknown_GrPixelConfig == config) { 290 if (kUnknown_GrPixelConfig == config) {
291 return false; 291 return false;
292 } 292 }
293 293
294 uint32_t flags = 0; 294 uint32_t flags = 0;
295 if (kUnpremul_SkAlphaType == dstInfo.alphaType()) { 295 if (kUnpremul_SkAlphaType == dstInfo.alphaType()) {
296 flags = GrContext::kUnpremul_PixelOpsFlag; 296 flags = GrContext::kUnpremul_PixelOpsFlag;
297 } 297 }
298 return fContext->readRenderTargetPixels(fRenderTarget, x, y, dstInfo.width() , dstInfo.height(), 298 return fContext->readRenderTargetPixels(fRenderTarget, x, y, dstInfo.width() , dstInfo.height(),
299 config, dstPixels, dstRowBytes, flag s); 299 config, dstPixels, dstRowBytes, flag s);
300 } 300 }
301 301
302 bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz e_t rowBytes, 302 bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz e_t rowBytes,
303 int x, int y) { 303 int x, int y) {
304 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels 304 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels
305 GrPixelConfig config = SkImageInfo2GrPixelConfig(info.colorType(), info.alph aType()); 305 GrPixelConfig config = SkImageInfo2GrPixelConfig(info);
306 if (kUnknown_GrPixelConfig == config) { 306 if (kUnknown_GrPixelConfig == config) {
307 return false; 307 return false;
308 } 308 }
309 uint32_t flags = 0; 309 uint32_t flags = 0;
310 if (kUnpremul_SkAlphaType == info.alphaType()) { 310 if (kUnpremul_SkAlphaType == info.alphaType()) {
311 flags = GrContext::kUnpremul_PixelOpsFlag; 311 flags = GrContext::kUnpremul_PixelOpsFlag;
312 } 312 }
313 fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels , rowBytes, flags); 313 fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels , rowBytes, flags);
314 314
315 // need to bump our genID for compatibility with clients that "know" we have a bitmap 315 // need to bump our genID for compatibility with clients that "know" we have a bitmap
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 const GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrC reate(picture, i); 1999 const GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrC reate(picture, i);
2000 2000
2001 SkDebugf("%d (%d), ", i, layer->layerID()); 2001 SkDebugf("%d (%d), ", i, layer->layerID());
2002 } 2002 }
2003 } 2003 }
2004 SkDebugf("\n"); 2004 SkDebugf("\n");
2005 #endif 2005 #endif
2006 2006
2007 return false; 2007 return false;
2008 } 2008 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698