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

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

Issue 1270583003: Move some parts of onReadPixels up to GrGpu readPixels. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit 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/GrGpu.cpp ('k') | no next file » | 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 781e7721e3d8731f0ac5ce888d896e88ffa6ad43..74f7e0bc107f013eefdacbe3149a13bd87a598bb 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1731,10 +1731,6 @@ static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL
bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference* drawPreference,
ReadPixelTempDrawInfo* tempDrawInfo) {
- if (GrPixelConfigIsCompressed(readConfig)) {
- return false;
- }
-
// This subclass can only read pixels from a render target. We could use glTexSubImage2D on
// GL versions that support it but we don't today.
if (!srcSurface->asRenderTarget()) {
@@ -1796,11 +1792,6 @@ bool GrGLGpu::onReadPixels(GrSurface* surface,
size_t rowBytes) {
SkASSERT(surface);
- // We cannot read pixels into a compressed buffer
- if (GrPixelConfigIsCompressed(config)) {
- return false;
- }
-
GrGLRenderTarget* tgt = static_cast<GrGLRenderTarget*>(surface->asRenderTarget());
if (!tgt) {
return false;
@@ -1812,13 +1803,6 @@ bool GrGLGpu::onReadPixels(GrSurface* surface,
if (!this->configToGLFormats(config, false, NULL, &format, &type)) {
return false;
}
- size_t bpp = GrBytesPerPixel(config);
- if (!GrSurfacePriv::AdjustReadPixelParams(surface->width(), surface->height(), bpp,
- &left, &top, &width, &height,
- &buffer,
- &rowBytes)) {
- return false;
- }
// resolve the render target if necessary
switch (tgt->getResolveType()) {
@@ -1844,10 +1828,8 @@ bool GrGLGpu::onReadPixels(GrSurface* surface,
GrGLIRect readRect;
readRect.setRelativeTo(glvp, left, top, width, height, tgt->origin());
- size_t tightRowBytes = bpp * width;
- if (0 == rowBytes) {
- rowBytes = tightRowBytes;
- }
+ size_t tightRowBytes = GrBytesPerPixel(config) * width;
+
size_t readDstRowBytes = tightRowBytes;
void* readDst = buffer;
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698