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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 2298253002: Add read/write-Pixels to GrDrawContext (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 2d9b3ef623a314fd8b056b09106261fdb8421676..a59f9d7b6ed846fccb4eb522535739eb6ddd7a06 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -205,36 +205,14 @@ bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
int x, int y) {
ASSERT_SINGLE_OWNER
- // TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
- GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps());
- if (kUnknown_GrPixelConfig == config) {
- return false;
- }
-
- uint32_t flags = 0;
- if (kUnpremul_SkAlphaType == dstInfo.alphaType()) {
- flags = GrContext::kUnpremul_PixelOpsFlag;
- }
- return fDrawContext->accessRenderTarget()->readPixels(x, y,
- dstInfo.width(), dstInfo.height(),
- config, dstPixels,
- dstRowBytes, flags);
+ return fDrawContext->readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
}
-bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes,
- int x, int y) {
+bool SkGpuDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels,
+ size_t srcRowBytes, int x, int y) {
ASSERT_SINGLE_OWNER
- // TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
- GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fContext->caps());
- if (kUnknown_GrPixelConfig == config) {
- return false;
- }
- uint32_t flags = 0;
- if (kUnpremul_SkAlphaType == info.alphaType()) {
- flags = GrContext::kUnpremul_PixelOpsFlag;
- }
- return fDrawContext->accessRenderTarget()->writePixels(x, y, info.width(), info.height(),
- config, pixels, rowBytes, flags);
+
+ return fDrawContext->writePixels(srcInfo, srcPixels, srcRowBytes, x, y);
}
bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) {
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698