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

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

Issue 1784563002: unify peekPixels around pixmap parameter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update GrUploadPixmapToTexture to know about the new desc if readPixels was called Created 4 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
« no previous file with comments | « src/core/SkSpecialImage.cpp ('k') | src/image/SkImage.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 2010 Google Inc. 2 * Copyright 2010 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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 #include "SkGrPriv.h" 10 #include "SkGrPriv.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } else { 256 } else {
257 SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap .height()); 257 SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap .height());
258 tmpBitmap.allocPixels(info); 258 tmpBitmap.allocPixels(info);
259 if (!pixmap.readPixels(info, tmpBitmap.getPixels(), tmpBitmap.rowByt es())) { 259 if (!pixmap.readPixels(info, tmpBitmap.getPixels(), tmpBitmap.rowByt es())) {
260 return nullptr; 260 return nullptr;
261 } 261 }
262 if (!tmpBitmap.peekPixels(&tmpPixmap)) { 262 if (!tmpBitmap.peekPixels(&tmpPixmap)) {
263 return nullptr; 263 return nullptr;
264 } 264 }
265 pmap = &tmpPixmap; 265 pmap = &tmpPixmap;
266 // must rebuild desc, since we've forced the info to be N32
267 desc = GrImageInfoToSurfaceDesc(pmap->info());
266 } 268 }
267 } 269 }
268 270
269 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, pmap->a ddr(), 271 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, pmap->a ddr(),
270 pmap->rowBytes()); 272 pmap->rowBytes());
271 } 273 }
272 274
273 275
274 //////////////////////////////////////////////////////////////////////////////// 276 ////////////////////////////////////////////////////////////////////////////////
275 277
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 SkErrorInternals::SetError( kInvalidPaint_SkError, 696 SkErrorInternals::SetError( kInvalidPaint_SkError,
695 "Sorry, I don't understand the filtering " 697 "Sorry, I don't understand the filtering "
696 "mode you asked for. Falling back to " 698 "mode you asked for. Falling back to "
697 "MIPMaps."); 699 "MIPMaps.");
698 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 700 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
699 break; 701 break;
700 702
701 } 703 }
702 return textureFilterMode; 704 return textureFilterMode;
703 } 705 }
OLDNEW
« no previous file with comments | « src/core/SkSpecialImage.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698