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

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

Issue 211043002: remove all references to legacy Config8888 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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/device/xps/SkXPSDevice.cpp ('k') | src/pdf/SkPDFDevice.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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 /////////////////////////////////////////////////////////////////////////////// 337 ///////////////////////////////////////////////////////////////////////////////
338 338
339 void SkGpuDevice::makeRenderTargetCurrent() { 339 void SkGpuDevice::makeRenderTargetCurrent() {
340 DO_DEFERRED_CLEAR(); 340 DO_DEFERRED_CLEAR();
341 fContext->setRenderTarget(fRenderTarget); 341 fContext->setRenderTarget(fRenderTarget);
342 } 342 }
343 343
344 /////////////////////////////////////////////////////////////////////////////// 344 ///////////////////////////////////////////////////////////////////////////////
345 345
346 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
347 namespace {
348 GrPixelConfig config8888_to_grconfig_and_flags(SkCanvas::Config8888 config8888, uint32_t* flags) {
349 switch (config8888) {
350 case SkCanvas::kNative_Premul_Config8888:
351 *flags = 0;
352 return kSkia8888_GrPixelConfig;
353 case SkCanvas::kNative_Unpremul_Config8888:
354 *flags = GrContext::kUnpremul_PixelOpsFlag;
355 return kSkia8888_GrPixelConfig;
356 case SkCanvas::kBGRA_Premul_Config8888:
357 *flags = 0;
358 return kBGRA_8888_GrPixelConfig;
359 case SkCanvas::kBGRA_Unpremul_Config8888:
360 *flags = GrContext::kUnpremul_PixelOpsFlag;
361 return kBGRA_8888_GrPixelConfig;
362 case SkCanvas::kRGBA_Premul_Config8888:
363 *flags = 0;
364 return kRGBA_8888_GrPixelConfig;
365 case SkCanvas::kRGBA_Unpremul_Config8888:
366 *flags = GrContext::kUnpremul_PixelOpsFlag;
367 return kRGBA_8888_GrPixelConfig;
368 default:
369 GrCrash("Unexpected Config8888.");
370 *flags = 0; // suppress warning
371 return kSkia8888_GrPixelConfig;
372 }
373 }
374 }
375
376 bool SkGpuDevice::onReadPixels(const SkBitmap& bitmap,
377 int x, int y,
378 SkCanvas::Config8888 config8888) {
379 DO_DEFERRED_CLEAR();
380 SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
381 SkASSERT(!bitmap.isNull());
382 SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::Ma keXYWH(x, y, bitmap.width(), bitmap.height())));
383
384 SkAutoLockPixels alp(bitmap);
385 GrPixelConfig config;
386 uint32_t flags;
387 config = config8888_to_grconfig_and_flags(config8888, &flags);
388 return fContext->readRenderTargetPixels(fRenderTarget,
389 x, y,
390 bitmap.width(),
391 bitmap.height(),
392 config,
393 bitmap.getPixels(),
394 bitmap.rowBytes(),
395 flags);
396 }
397 #endif
398
399 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes, 346 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes,
400 int x, int y) { 347 int x, int y) {
401 DO_DEFERRED_CLEAR(); 348 DO_DEFERRED_CLEAR();
402 349
403 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels 350 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels
404 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo.colorType(), dstInf o.alphaType()); 351 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo.colorType(), dstInf o.alphaType());
405 if (kUnknown_GrPixelConfig == config) { 352 if (kUnknown_GrPixelConfig == config) {
406 return false; 353 return false;
407 } 354 }
408 355
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 if (NULL == data) { 1977 if (NULL == data) {
2031 return false; 1978 return false;
2032 } 1979 }
2033 1980
2034 #if 0 1981 #if 0
2035 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); 1982 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
2036 #endif 1983 #endif
2037 1984
2038 return false; 1985 return false;
2039 } 1986 }
OLDNEW
« no previous file with comments | « src/device/xps/SkXPSDevice.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698