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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1234313002: Make readpixels work on GrTextures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix and more kRT removal Created 5 years, 5 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/GrSurfacePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 5c03ab57d28a1b52cf0bb7463d7c2498ba8de64c..1a9566ae3820f734bae4fb746e8c8330f5f78d83 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -596,32 +596,6 @@ bool GrGLGpu::onWriteTexturePixels(GrTexture* texture,
return false;
}
-static bool adjust_pixel_ops_params(int surfaceWidth,
- int surfaceHeight,
- size_t bpp,
- int* left, int* top, int* width, int* height,
- const void** data,
- size_t* rowBytes) {
- if (!*rowBytes) {
- *rowBytes = *width * bpp;
- }
-
- SkIRect subRect = SkIRect::MakeXYWH(*left, *top, *width, *height);
- SkIRect bounds = SkIRect::MakeWH(surfaceWidth, surfaceHeight);
-
- if (!subRect.intersect(bounds)) {
- return false;
- }
- *data = reinterpret_cast<const void*>(reinterpret_cast<intptr_t>(*data) +
- (subRect.fTop - *top) * *rowBytes + (subRect.fLeft - *left) * bpp);
-
- *left = subRect.fLeft;
- *top = subRect.fTop;
- *width = subRect.width();
- *height = subRect.height();
- return true;
-}
-
static inline GrGLenum check_alloc_error(const GrSurfaceDesc& desc,
const GrGLInterface* interface) {
if (SkToBool(desc.fFlags & kCheckAllocation_GrSurfaceFlag)) {
@@ -643,8 +617,8 @@ bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc,
SkASSERT(!GrPixelConfigIsCompressed(dataConfig));
size_t bpp = GrBytesPerPixel(dataConfig);
- if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top,
- &width, &height, &data, &rowBytes)) {
+ if (!GrSurfacePriv::AdjustWritePixelParams(desc.fWidth, desc.fHeight, bpp, &left, &top,
+ &width, &height, &data, &rowBytes)) {
return false;
}
size_t trimRowBytes = width * bpp;
@@ -1781,10 +1755,10 @@ bool GrGLGpu::onReadPixels(GrRenderTarget* target,
return false;
}
size_t bpp = GrBytesPerPixel(config);
- if (!adjust_pixel_ops_params(target->width(), target->height(), bpp,
- &left, &top, &width, &height,
- const_cast<const void**>(&buffer),
- &rowBytes)) {
+ if (!GrSurfacePriv::AdjustReadPixelParams(target->width(), target->height(), bpp,
+ &left, &top, &width, &height,
+ &buffer,
+ &rowBytes)) {
return false;
}
« no previous file with comments | « src/gpu/GrSurfacePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698