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

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

Issue 1412423008: Handling large jpegs in CPU raster - downsample to display res and 565 Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/image/SkImage_Gpu.h ('k') | src/image/SkImage_Raster.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 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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkImage_Gpu.h" 9 #include "SkImage_Gpu.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 24 matching lines...) Expand all
35 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { 35 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) {
36 if (as_IB(image)->getTexture()) { 36 if (as_IB(image)->getTexture()) {
37 ((SkImage_Gpu*)image)->applyBudgetDecision(); 37 ((SkImage_Gpu*)image)->applyBudgetDecision();
38 } 38 }
39 } 39 }
40 40
41 static SkImageInfo make_info(int w, int h, bool isOpaque) { 41 static SkImageInfo make_info(int w, int h, bool isOpaque) {
42 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S kAlphaType); 42 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S kAlphaType);
43 } 43 }
44 44
45 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { 45 bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkScalar scaleHint) const {
46 if (SkBitmapCache::Find(this->uniqueID(), dst)) { 46 if (SkBitmapCache::Find(this->uniqueID(), dst)) {
47 SkASSERT(dst->getGenerationID() == this->uniqueID()); 47 SkASSERT(dst->getGenerationID() == this->uniqueID());
48 SkASSERT(dst->isImmutable()); 48 SkASSERT(dst->isImmutable());
49 SkASSERT(dst->getPixels()); 49 SkASSERT(dst->getPixels());
50 return true; 50 return true;
51 } 51 }
52 52
53 if (!dst->tryAllocPixels(make_info(this->width(), this->height(), this->isOp aque()))) { 53 if (!dst->tryAllocPixels(make_info(this->width(), this->height(), this->isOp aque()))) {
54 return false; 54 return false;
55 } 55 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 if (!dst) { 402 if (!dst) {
403 return nullptr; 403 return nullptr;
404 } 404 }
405 405
406 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 406 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
407 const SkIPoint dstP = SkIPoint::Make(0, 0); 407 const SkIPoint dstP = SkIPoint::Make(0, 0);
408 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 408 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
409 return dst; 409 return dst;
410 } 410 }
411 411
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698