| OLD | NEW |
| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return fContext->readRenderTargetPixels(fRenderTarget, | 387 return fContext->readRenderTargetPixels(fRenderTarget, |
| 388 x, y, | 388 x, y, |
| 389 bitmap.width(), | 389 bitmap.width(), |
| 390 bitmap.height(), | 390 bitmap.height(), |
| 391 config, | 391 config, |
| 392 bitmap.getPixels(), | 392 bitmap.getPixels(), |
| 393 bitmap.rowBytes(), | 393 bitmap.rowBytes(), |
| 394 flags); | 394 flags); |
| 395 } | 395 } |
| 396 | 396 |
| 397 #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG | |
| 398 void SkGpuDevice::writePixels(const SkBitmap& bitmap, int x, int y, | |
| 399 SkCanvas::Config8888 config8888) { | |
| 400 SkAutoLockPixels alp(bitmap); | |
| 401 if (!bitmap.readyToDraw()) { | |
| 402 return; | |
| 403 } | |
| 404 | |
| 405 GrPixelConfig config; | |
| 406 uint32_t flags; | |
| 407 if (SkBitmap::kARGB_8888_Config == bitmap.config()) { | |
| 408 config = config8888_to_grconfig_and_flags(config8888, &flags); | |
| 409 } else { | |
| 410 flags = 0; | |
| 411 config= SkBitmapConfig2GrPixelConfig(bitmap.config()); | |
| 412 } | |
| 413 | |
| 414 fRenderTarget->writePixels(x, y, bitmap.width(), bitmap.height(), | |
| 415 config, bitmap.getPixels(), bitmap.rowBytes(), fl
ags); | |
| 416 } | |
| 417 #endif | |
| 418 | |
| 419 bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz
e_t rowBytes, | 397 bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz
e_t rowBytes, |
| 420 int x, int y) { | 398 int x, int y) { |
| 421 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p
ixels | 399 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p
ixels |
| 422 GrPixelConfig config = SkImageInfo2GrPixelConfig(info.colorType(), info.alph
aType()); | 400 GrPixelConfig config = SkImageInfo2GrPixelConfig(info.colorType(), info.alph
aType()); |
| 423 if (kUnknown_GrPixelConfig == config) { | 401 if (kUnknown_GrPixelConfig == config) { |
| 424 return false; | 402 return false; |
| 425 } | 403 } |
| 426 uint32_t flags = 0; | 404 uint32_t flags = 0; |
| 427 if (kUnpremul_SkAlphaType == info.alphaType()) { | 405 if (kUnpremul_SkAlphaType == info.alphaType()) { |
| 428 flags = GrContext::kUnpremul_PixelOpsFlag; | 406 flags = GrContext::kUnpremul_PixelOpsFlag; |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 if (NULL == data) { | 2016 if (NULL == data) { |
| 2039 return false; | 2017 return false; |
| 2040 } | 2018 } |
| 2041 | 2019 |
| 2042 #if 0 | 2020 #if 0 |
| 2043 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); | 2021 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); |
| 2044 #endif | 2022 #endif |
| 2045 | 2023 |
| 2046 return false; | 2024 return false; |
| 2047 } | 2025 } |
| OLD | NEW |