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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 1831873002: Add early out for large textures (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix indent Created 4 years, 8 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 | « no previous file | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkAutoPixmapStorage.h" 8 #include "SkAutoPixmapStorage.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 }; 348 };
349 349
350 size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox y, 350 size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox y,
351 const DeferredTextureImageUsageParam s[], 351 const DeferredTextureImageUsageParam s[],
352 int paramCnt, void* buffer) const { 352 int paramCnt, void* buffer) const {
353 const bool fillMode = SkToBool(buffer); 353 const bool fillMode = SkToBool(buffer);
354 if (fillMode && !SkIsAlign8(reinterpret_cast<intptr_t>(buffer))) { 354 if (fillMode && !SkIsAlign8(reinterpret_cast<intptr_t>(buffer))) {
355 return 0; 355 return 0;
356 } 356 }
357 357
358 const int maxTextureSize = proxy.fCaps->maxTextureSize();
359 if (width() > maxTextureSize || height() > maxTextureSize) {
360 return 0;
361 }
362
358 SkAutoPixmapStorage pixmap; 363 SkAutoPixmapStorage pixmap;
359 SkImageInfo info; 364 SkImageInfo info;
360 size_t pixelSize = 0; 365 size_t pixelSize = 0;
361 size_t ctSize = 0; 366 size_t ctSize = 0;
362 int ctCount = 0; 367 int ctCount = 0;
363 if (this->peekPixels(&pixmap)) { 368 if (this->peekPixels(&pixmap)) {
364 info = pixmap.info(); 369 info = pixmap.info();
365 pixelSize = SkAlign8(pixmap.getSafeSize()); 370 pixelSize = SkAlign8(pixmap.getSafeSize());
366 if (pixmap.ctable()) { 371 if (pixmap.ctable()) {
367 ctCount = pixmap.ctable()->count(); 372 ctCount = pixmap.ctable()->count();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 return nullptr; 456 return nullptr;
452 } 457 }
453 458
454 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 459 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
455 const SkIPoint dstP = SkIPoint::Make(0, 0); 460 const SkIPoint dstP = SkIPoint::Make(0, 0);
456 ctx->copySurface(dst, src, srcR, dstP); 461 ctx->copySurface(dst, src, srcR, dstP);
457 ctx->flushSurfaceWrites(dst); 462 ctx->flushSurfaceWrites(dst);
458 return dst; 463 return dst;
459 } 464 }
460 465
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698